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: Weird DirectionalLight Behavior Between WebGLRenderer and WebGPU Renderer #28642

Closed
cmhhelgeson opened this issue Jun 13, 2024 · 5 comments
Milestone

Comments

@cmhhelgeson
Copy link
Contributor

Description

Working from code in pull request #28593, directional lighting behavior is strange when switching from WebGLRenderer to WebGPURenderer.

WebGLRenderer:

WebGL Array Camera

WebGPURenderer (behavior the same whether forceWebGL is enabled or not)
WebGPU Array Camera

WebGPURenderer when switching lighting in webgl_camera_array.html sample from 4 to 50

WebGPU Zoom Array Camera

It seems like the shadow written to the depth buffer in a previous pass is somehow being applied to the mesh's color output.

Reproduction steps

  1. Work from branch in pull request WebGPURenderer: Fix ArrayCamera viewports #28593 which fixes array camera viewport sizing.
  2. Go to Three.js example webgl_camera_array.html.
  3. Import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
  4. Go to line 87 of Three.js example webgl_camera_array.html. Switch new THREE.WebGLRenderer to new WebGPURenderer or new WebGPURenderer( { forceWebGL: true})

Code

renderer = new WebGPURenderer();

Live example

Screenshots

No response

Version

r166

Device

Desktop

Browser

Chrome

OS

Windows

@RenaudRohlinger
Copy link
Collaborator

Sounds like a bias issue generated from the different depth space of WebGPU and WebGL.

Maybe aligning both backend to 0-1 will solve this kind of issue. The best way would be to implement out of the box this extension for WebGL:
https://registry.khronos.org/webgl/extensions/EXT_clip_control/

@cmhhelgeson
Copy link
Contributor Author

Sounds like a bias issue generated from the different depth space of WebGPU and WebGL.

Maybe aligning both backend to 0-1 will solve this kind of issue. The best way would be to implement out of the box this extension for WebGL: registry.khronos.org/webgl/extensions/EXT_clip_control

I'm not sure if would be a bias issue when turning on forceWebGL causes the sample to exhibit the same behavior.

@RenaudRohlinger
Copy link
Collaborator

Ah, I see. I misunderstood the issue and thought the behaviors differed between the two backends, not the two renderers. In that case, it might be something to do with AnalyticLightNode. I can take a look at it!

@cmhhelgeson
Copy link
Contributor Author

cmhhelgeson commented Jul 4, 2024

Getting similar weird moire-like patterns when converting the webgl_postprocessing_pixel example to WebGPU (with and without the WIP PixelationNode pass from PR #28802. Errors appear irrespective of whether the materials are MeshPhongMaterial or MeshPhongNodeMaterial, or whether forceWebGL is set on the THREE.WebGPURenderer.

Image below is without any post-processing applied:

image

@cmhhelgeson
Copy link
Contributor Author

I believe these patterns are fixed with #28926, so I'll close the issue.

@Mugen87 Mugen87 added this to the r168 milestone Jul 28, 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

No branches or pull requests

3 participants