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

WebGPUBackend: Fix Occlusion Query Logic #30288

Merged
merged 3 commits into from
Jan 9, 2025
Merged

Conversation

ycw
Copy link
Contributor

@ycw ycw commented Jan 8, 2025

Occlusion query result 0 = no samples pass = occluded, but current assertion is non-0 = occluded

Demo the issue: https://threejs.org/examples/#webgpu_occlusion,

In the demo, occluded color is set to blue, non-occluded color is set to green, so when the sphere is fully occluded, the plane should be in blue, not green

@ycw ycw changed the title WebGPURenderer: Fix Occlusion Logic WebGPUBackend: Fix Occlusion Query Logic Jan 8, 2025
Copy link

github-actions bot commented Jan 8, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.51
79.09
339.51
79.09
+0 B
+0 B
WebGPU 490.94
136.33
490.94
136.33
+2 B
+4 B
WebGPU Nodes 490.41
136.21
490.41
136.22
+2 B
+7 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.35
112.14
465.35
112.14
+0 B
+0 B
WebGPU 560.24
151.73
560.24
151.74
+2 B
+3 B
WebGPU Nodes 516.33
141.52
516.34
141.52
+2 B
+4 B

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 8, 2025

In the demo, occluded color is set to blue, non-occluded color is set to green, so when the sphere is fully occluded, the plane should be in blue, not green

In this case, do you mind changing the description text of the example? It would be great if you could regenerate the E2E screenshot of webgpu_occlusion.

Besides, does the WebGL backend also needs this fix? Sorry, I'm currently not into the occlusion query code. Hopefully someone else can additionally review this PR.

@sunag sunag added this to the r173 milestone Jan 9, 2025
@sunag
Copy link
Collaborator

sunag commented Jan 9, 2025

I inverted the colors in the example. Added the fix to WebGLBackend too.

@sunag sunag merged commit 95a994c into mrdoob:dev Jan 9, 2025
11 of 12 checks passed
@ycw
Copy link
Contributor Author

ycw commented Jan 9, 2025

Thanks

@ycw ycw deleted the fix-webgpu-occlusion branch January 9, 2025 16:53
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.

3 participants