Fog light projectors#106395
Conversation
b9a09e4 to
ef283ac
Compare
bb104cd to
483f245
Compare
|
Impresive. Can you implement this (projectors) for lightmap baking? |
- Added projector scale / offset in directional light - Added directional light matrix, scale and offset in forward shaders - Added computation logic of the projection in the forward and forward mobile shaders - Computing projector matrix in the update_light_buffers and pushing it to the gpu - Adapted light models to have projector scale and offset stored (even in gles3 for the future inclusion of projectors) - Added a sub group for the directional light projector properties - Added directional projector pipeline specialization constant for mobile and forward rendering - Edited the way decals store texture to now repeat in the border instead of storing black color - Added projector warning for DirectionalLight3D in compatibility mode (Moved the projector warning to Light3D level since all can use projector now)
There was a problem hiding this comment.
Tested locally, it works as expected. Code looks good to me.
![]() |
![]() |
![]() |
|---|
Some feedback:
- Is my approach to add the samplers available in the volumetric_fog_update method the good one ? (Adding it as a parameter)
During all my testing with various projector textures (going as low as 16×16) and volumetric fog energy increased to 100, I couldn't spot a difference between the various filter modes on all light types, even after restarting the editor and using maximum precision fog settings (512 size/512 depth/temporal reprojection disabled). With more realistic settings, it's even less likely to make a visible difference.
I think you can remove the parameter and always sample the projector texture within the volumetric fog as linear (no mipmaps).
- Add control over the impact of the projector in the fog ? (Don't know if needed in addition to the light_volumetric_fog_energy parameter)
I wouldn't add a parameter now, the effect is quite subtle in practice with the default fog volume size/depth. If you increase both of these, then it starts becoming more noticeable, but values above 128 have a heavy performance cost anyway.
With the default fog volume settings (64 size/64 depth), it is possible to see noise in the volumetric fog when moving the camera with very high scale on cloud textures in DirectionalLight3D, but only with temporal reprojection disabled. Even then, with a more realistic texture scale, it basically never happens.
- Verify if we want to use mipmaps
I don't think it's needed when temporal reprojection is enabled. When temporal reprojection is disabled though, it could help reduce noise when the camera moves, but this can be left for a future PR as temporal reprojection is typically left enabled.
|
|
||
| // Higher values will make light in volumetric fog fade out sooner when it's occluded by shadow. | ||
| const float INV_FOG_FADE = 10.0; | ||
| const float INV_FOG_FADE = 300.0; //TODO: We should change this constant to a user setting |
There was a problem hiding this comment.
This was originally configurable with Fog Fade, but that property was removed during 4.0 development to make space for Volumetric Fog Energy.
However, if we find a way to reintroduce this property without increasing the size of the push constant, it's welcome. This is main difficulty about reintroducing it. Packing two half float values inside a single float could help here, although it would limit the effective range of both values. (The default Fog Fade was 0.1 rather than 10.0, since it was expressed as the inverse.)
Added computation of the projector in the fog Added volumetric fade parameter in the environment and send it to the process fog shader in the params uniform buffer
483f245 to
00330de
Compare
|
@Calinou I don't think the process shader of the fog is using push constants, actually it only have an uniform buffer containing the parameters, so I added the fade in it. If we don't want to make it configurable we can just revert these changes but with the projectors affecting the fog, it can get really noticeable when the fade value is too high (like the old default 0.1) and fog can get through small structures. I updated this PR to be up to date with the directional light projector PR and will keep doing this until the first one get merge to then rebase on master directly |



This is a WIP branch which is based on my precedent branch to add directional light projectors.
Its goal is to responds to this discussion : godotengine/godot-proposals#11987 and make the volumetric fog affected lights projectors
Done in this PR :
To do :
My main concerns are :
Little preview :




20250514-1008-34.7902792.mp4
and closes Make Volumetric Fog affected by Spotlight Projector godot-proposals#11987.