-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
bugfix(frustra of point lights were not recalculated when a camera changes) #18519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alice-i-cecile
merged 3 commits into
bevyengine:main
from
HugoPeters1024:hp/fix-point-light-frustum-bug
Mar 25, 2025
Merged
bugfix(frustra of point lights were not recalculated when a camera changes) #18519
alice-i-cecile
merged 3 commits into
bevyengine:main
from
HugoPeters1024:hp/fix-point-light-frustum-bug
Mar 25, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IceSentry
approved these changes
Mar 24, 2025
JMS55
reviewed
Mar 25, 2025
JMS55
approved these changes
Mar 25, 2025
Contributor
JMS55
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with a small nit to improve the comment wording.
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
mockersf
pushed a commit
that referenced
this pull request
Mar 25, 2025
…anges) (#18519) # Objective - Fixes #11682 ## Solution - #4086 introduced an optimization to not do redundant calculations, but did not take into account changes to the resource `global_lights`. I believe that my patch includes the optimization benefit but adds the required nuance to fix said bug. ## Testing The example originally given by [@kirillsurkov](https://github.com/kirillsurkov) and then updated by me to bevy 15.3 here: #11682 (comment) will not have shadows without this patch: ```rust use bevy::prelude::*; #[derive(Resource)] struct State { x: f32, } fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Update, update) .insert_resource(State { x: -40.0 }) .run(); } fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<StandardMaterial>>, ) { commands.spawn(( Mesh3d(meshes.add(Circle::new(4.0))), MeshMaterial3d(materials.add(Color::WHITE)), )); commands.spawn(( Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))), MeshMaterial3d(materials.add(Color::linear_rgb(0.0, 1.0, 0.0))), )); commands.spawn(( PointLight { shadows_enabled: true, ..default() }, Transform::from_xyz(4.0, 8.0, 4.0), )); commands.spawn(Camera3d::default()); } fn update(mut state: ResMut<State>, mut camera: Query<&mut Transform, With<Camera3d>>) { let mut camera = camera.single_mut().unwrap(); let t = Vec3::new(state.x, 0.0, 10.0); camera.translation = t; camera.look_at(t - Vec3::Z, Vec3::Y); state.x = 0.0; } ``` --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Rendering
Drawing game state to the screen
C-Bug
An unexpected or incorrect behavior
C-Performance
A change motivated by improving speed, memory usage or compile times
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Solution
global_lights. I believe that my patch includes the optimization benefit but adds the required nuance to fix said bug.Testing
The example originally given by @kirillsurkov and then updated by me to bevy 15.3 here: #11682 (comment) will not have shadows without this patch: