Skip to content
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

WebGPURenderer: Fix shadow layers #28451

Merged
merged 2 commits into from
May 22, 2024
Merged

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented May 21, 2024

Related issue: Closes #28438

Description

This fix prioritizes camera.layers during the renderer shadows instead of using the layers independently.

@@ -191,6 +191,7 @@ class AnalyticLightNode extends LightingNode {
rtt.setSize( light.shadow.mapSize.width, light.shadow.mapSize.height );

light.shadow.updateMatrices( light );
light.shadow.camera.layers.mask = camera.layers.mask;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like a lot this solution, currently the WebGLRenderer only relies on the main camera and never care about the shadowCamera.layers:

const visible = object.layers.test( camera.layers );

but I believe this new solution is as good if not better!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

An interesting point about WebGPURenderer is that we do not have a shadow class directly linked to the core, but it is part of the Node class integrated with the lights, allowing different approaches to shadow rendering as extensions.

@sunag sunag marked this pull request as ready for review May 22, 2024 01:42
@sunag sunag merged commit 1164bf1 into mrdoob:dev May 22, 2024
11 checks passed
@sunag sunag deleted the dev-fix-shadow-layers branch May 22, 2024 01:43
@mrdoob mrdoob added this to the r165 milestone May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebGPURenderer: wrong layers testing in AnalyticLightNode
3 participants