Proper Ambient Light#6849
Merged
Merged
Conversation
wookieejedi
approved these changes
Jul 21, 2025
wookieejedi
left a comment
Member
There was a problem hiding this comment.
Really fantastic to have decals properly fixed and insignias actually working again! Overall works well in my tests, too.
|
This has been bugging me relentlessly for a very long time and I'm super happy to see it fixed. Thank you! |
wookieejedi
added a commit
to wookieejedi/fs2open.github.com
that referenced
this pull request
Jul 24, 2025
Small one-line fix that follows up scp-fs2open#6849. That PR removed the `!(Viewer_mode & VM_EXTERNAL))` check within a section of `ship_render_player_ship` to optimize insignia rendering, but turns out that check is needed to ensure `show-ship` properly works. This PR restores that check to fix this bug, and ideally the thoughts about slightly optimizing insignias can be considered later. Tested and works as expected.
BMagnu
pushed a commit
that referenced
this pull request
Jul 24, 2025
Small one-line fix that follows up #6849. That PR removed the `!(Viewer_mode & VM_EXTERNAL))` check within a section of `ship_render_player_ship` to optimize insignia rendering, but turns out that check is needed to ensure `show-ship` properly works. This PR restores that check to fix this bug, and ideally the thoughts about slightly optimizing insignias can be considered later. Tested and works as expected.
This was referenced Jul 24, 2025
Kestrellius
pushed a commit
to Kestrellius/fs2open.github.com
that referenced
this pull request
Jul 26, 2025
* Remove ambient handling from amin / decal pass * Add ambient light to deferred pass * Make decals work and fix double insignia rendering * Fix decal vertex shader * render insignias as decals * Cleanup of old insignia stuff * Move insignia post-processing to model load * perform envmap lighting in deferred shader * Remove Envmapping from main shader * Fix MSVC warning * exclude def_files from clang tidy
Kestrellius
pushed a commit
to Kestrellius/fs2open.github.com
that referenced
this pull request
Jul 26, 2025
Small one-line fix that follows up scp-fs2open#6849. That PR removed the `!(Viewer_mode & VM_EXTERNAL))` check within a section of `ship_render_player_ship` to optimize insignia rendering, but turns out that check is needed to ensure `show-ship` properly works. This PR restores that check to fix this bug, and ideally the thoughts about slightly optimizing insignias can be considered later. Tested and works as expected.
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR moves ambient light (including from envmaps) from the main shader to the deferred lighting pass. This means, that things modifying the G-Buffer would not be correctly lit by environment light. Notably, anything changing the diffuse texture in a place not directly lit by a non-ambient light (i.e. lots of decals) would just be invisible, as well as things rendering to the emissive buffer (i.e. insignias) would have an already ambient-lit model base which they could not darken, leading to a faded appearance.
This alone fixes #6838.
While this also fixes the underlying root cause of faded insignias, there's an additional problem with insignias in that the CPU-side light estimation used for insignia rendering was often inaccurate or outright wrong. To make insignias look proper, this PR also piggybacks insignias off of decals. This is a slightly lossy conversion, as insignias could previously have arbitrary polygons, wheras now they're reduced to a decal in a specific spot, but due to the restrictions on insignia UV-mapping and the need to be using the square insignia textures, I believe that this is effectively not noticeable for the insignias actually in use.
This fixes #1309 and it fixes #5674.
This PR also addresses the Insignia side of #5161.