![]() # 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 - Make ambient light conditionally applied depending on the affects_lightmapped_meshes setting when material mesh i lightmapped - Remove what looks to be leftover `Lights` (wgsl) members: `environment_map_smallest_specular_mip_level`, `environment_map_intensity`. (These where not present in the rust equivalent `GpuLights` and was not used in the wgsl code) ## Open Questions - Ambient light is also blended into the transmitted light if `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 <img width="613" height="601" alt="Main" src="https://github.com/user-attachments/assets/a3f206d7-5a1e-4590-8c40-69d5c6e06ce0" /> (All meshes get ambient light even when `affects_lightmapped_meshes = false`) ### This PR: Lightmap example with bright red ambient, small box have no lightmap <img width="612" height="602" alt="With fix" src="https://github.com/user-attachments/assets/d1a149a5-8994-4572-909f-8788ba2c38fc" /> (Only the small box get ambient light when `affects_lightmapped_meshes = false`) |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |