Skip to content

Apply sun scatter from lights with shadows in compatibility #107740

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kaleb-Reid
Copy link
Contributor

@Kaleb-Reid Kaleb-Reid commented Jun 19, 2025

Currently sun scatter does not affect scene objects for lights that have shadows in Compatibility because directional_light_count in scene.glsl does not include lights with shadows so that they can each be applied in separate passes from each other. This pr passes in the number of lights with shadows so that they can be factored into the sun scatter.

Before:
image

After:
image

In both images the cube is fully outside the depth end of the fog and should be fully obscured as is the case both without shadows enabled for the light in Compatibility and always in Forward+.

@Kaleb-Reid Kaleb-Reid requested a review from a team as a code owner June 19, 2025 22:08
@Kaleb-Reid Kaleb-Reid force-pushed the compat-directional-shadow-scatter branch 2 times, most recently from 79a49e2 to 301ba18 Compare June 20, 2025 06:22
@AThousandShips AThousandShips added this to the 4.x milestone Jun 20, 2025
@Kaleb-Reid Kaleb-Reid force-pushed the compat-directional-shadow-scatter branch from 301ba18 to c7ded01 Compare June 26, 2025 23:42
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected in all rendering methods (including with multiple DirectionalLights).

Code looks good to me.

Testing project: test-sun-scatter.zip

Forward+ Mobile Compatibility
image image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants