Fix AmbientLight::affects_lightmapped_meshes not working #20083
Merged
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
Fix lightmapped materials not respecting the AmbientLight::affects_lightmapped_meshes setting.
NOTE: This only makes the setting work on the forward renderer. Making it work on the deferred renderer would probably require encoding more information in the g-buffer or similar. Please advise if I missed some obvious way to get it working on deferred.
Solution
Lights
(wgsl) members:environment_map_smallest_specular_mip_level
,environment_map_intensity
. (These where not present in the rust equivalentGpuLights
and was not used in the wgsl code)Open Questions
DIFFUSE_TRANSMISSION
is enabled on the material. Should that also be guarded by the same conditional as the indirect contribution?Testing
Ran a modified version of the lightmaps example, where there is a bright red ambient light added and the small cube do not have a lightmap added (To be able to see ambient light applied to meshes without lightmaps)
Showcase
Main: Lightmap example with bright red ambient, small box have no lightmap
(All meshes get ambient light even when
affects_lightmapped_meshes = false
)This PR: Lightmap example with bright red ambient, small box have no lightmap
(Only the small box get ambient light when
affects_lightmapped_meshes = false
)