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

Honor camera layers on light.shadow.camera for selective shadow #30156

Open
Samsy opened this issue Dec 18, 2024 · 5 comments
Open

Honor camera layers on light.shadow.camera for selective shadow #30156

Samsy opened this issue Dec 18, 2024 · 5 comments

Comments

@Samsy
Copy link
Contributor

Samsy commented Dec 18, 2024

Description

In order to build a selective real time shadow along with a baked shadow system the light.shadow.camera should honor the layers to be tested against an object to render the shadow

I did add support on a custom build of the WebGLRenderer and this was very handy

Here an example disabling all the layers for the shadow camera but still renders :

Live Link

Solution

Before rendering the shadow, the mask is copied from the main render camera, wondering if this copy is mandatory, and if we could go with manually setting the layers instead for more controls, or maybe provide a solution to play with the shadow.camera layer without being overwritten :

shadow.camera.layers.mask = camera.layers.mask;

@Samsy Samsy changed the title Support camera layers on light.shadow.camera for selective shadow Honor camera layers on light.shadow.camera for selective shadow Dec 18, 2024
@Samsy
Copy link
Contributor Author

Samsy commented Dec 23, 2024

any thoughts @Mugen87 ?

@RenaudRohlinger
Copy link
Collaborator

Maybe if the shadowMap layer is different than default then we use shadow.camera.layer instead of camera.layer?

@Samsy
Copy link
Contributor Author

Samsy commented Dec 24, 2024

You mean adding a layer property to light.shadow, and test this one to check if it isnt default it would then be used correct ?

@Samsy
Copy link
Contributor Author

Samsy commented Dec 27, 2024

hey @Mugen87
Have you had to chance to look at this one ?

Thanks a lot

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 27, 2024

Is there currently no alternative to achieve selective shadows? I never had the use case for something like this hence I'm asking...

We could introduce a boolean property in LightShadow. When set to true, the layer configuration from the shadow camera is used instead of copying the layers from the main camera.

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

No branches or pull requests

3 participants