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: wrong layers testing in AnalyticLightNode #28438

Closed
RenaudRohlinger opened this issue May 20, 2024 · 0 comments · Fixed by #28451
Closed

WebGPURenderer: wrong layers testing in AnalyticLightNode #28438

RenaudRohlinger opened this issue May 20, 2024 · 0 comments · Fixed by #28451
Assignees
Labels

Comments

@RenaudRohlinger
Copy link
Collaborator

RenaudRohlinger commented May 20, 2024

Description

The AnalyticLightNode should test the scene camera layers property instead of the current shadow camera layers property (light.shadow.camera.layers in _renderScene).

We could introduce a renderer._cameraLayersOverride property or a getter/setter just like _renderObjectFunction (the latter being overkill in my opinion).

The main issue I currently have is that in updateShadow, if we use frame.camera as the reference and there are multiple lights casting shadows in the scene, the next value of frame.camera won't be the actual camera of the scene anymore but the previous Orthographic shadow camera from the previous light.

renderer._cameraLayersOverride = camera.layers;

renderer.setRenderObjectFunction( ( object, ...params ) => {

	if ( object.castShadow === true ) {

		renderer.renderObject( object, ...params );

	}

} );

/cc @sunag

Reproduction steps

in webgpu_shadowmap.html add camera.layers.enableAll(), then pillar1.layers.set( 2 ); and no shadow pillar will be visible in the scene as it should.

Version

r164

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

Successfully merging a pull request may close this issue.

2 participants