Skip to content

lighting.rs example: Improved ambient light showcase #19658

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
merged 2 commits into from
Jun 15, 2025

Conversation

RosyArts
Copy link
Contributor

@RosyArts RosyArts commented Jun 15, 2025

Objective

As someone who is currently learning Bevy, I found the implementation of the ambient light in the 3d/lighting.rs example unsatisfactory.

Solution

  • I adjusted the brightness of the ambient light in the scene to 200 (where the default is 80). It was previously 0.02, a value so low it has no noticeable effect.
  • I added a keybind (space bar) to toggle the ambient light, allowing users to see the difference it makes. I also added text showing the state of the ambient light (on, off) and text showing the keybind.

I'm very new to Bevy and Rust, so apologies if any of this code is not up to scratch.

Testing

I checked all the text still updates correctly and all keybinds still work. In my testing, it looks to work okay.
I'd appreciate others testing too, just to make sure.


Showcase

Click to view showcase Screenshot (11) Screenshot (12)

RosyArts added 2 commits June 15, 2025 15:46
- Ambient light now has a reasonable brightness (previous value 0.02 is so dim it makes no difference)
- Pressing space bar toggles ambient light to showcase it's effect
- Text added to show current state of the ambient light (on, off) and the keybind to toggle it
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and simple, thanks! I definitely think that this is a better way to showcase the ambient light effects.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Jun 15, 2025
@alice-i-cecile alice-i-cecile added the M-Deliberate-Rendering-Change An intentional change to how tests and examples are rendered label Jun 15, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 15, 2025
Merged via the queue into bevyengine:main with commit 83a1c07 Jun 15, 2025
40 checks passed
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-Examples An addition or correction to our examples M-Deliberate-Rendering-Change An intentional change to how tests and examples are rendered S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants