Skip to content

Frustum: Support reversed depth in setFromProjectionMatrix() #31464

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

Merged
merged 2 commits into from
Jul 25, 2025

Conversation

WestLangley
Copy link
Collaborator

As the title says.

Copy link

github-actions bot commented Jul 21, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.22
78.88
338.22
78.88
+0 B
+0 B
WebGPU 560.72
155.17
560.72
155.17
+0 B
+0 B
WebGPU Nodes 559.64
154.96
559.64
154.96
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.49
113.56
469.6
113.58
+103 B
+20 B
WebGPU 635.72
172.04
635.83
172.07
+103 B
+26 B
WebGPU Nodes 590.37
161.29
590.47
161.31
+103 B
+19 B

@WestLangley
Copy link
Collaborator Author

WestLangley commented Jul 21, 2025

@Mugen87 FYI. Camera.reversedDepth can be set lazily by the renderer, but it has to be set before Frustum.setFromProjectionMatrix() is called, and that is currently a problem...

@WestLangley WestLangley added this to the r179 milestone Jul 21, 2025
@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 21, 2025

Can't you just pass in the reversedDepthBuffer flag from the renderer when setFromProjectionMatrix() is called?

@WestLangley
Copy link
Collaborator Author

Can't you just pass in the reversedDepthBuffer flag from the renderer when setFromProjectionMatrix() is called?

I don't think the renderer is accessible when the method is called...

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 23, 2025

The light shadow classes could access the renderer if the shadow map module passes its reference to updateMatrices().

FrustumArray is used in context of BatchedMesh which could pass the renderer reference in its onBeforeRender() callback.

AFAICS, with a bit of refactoring, it should be possible to just work with reversedDepthBuffer.

@WestLangley WestLangley marked this pull request as ready for review July 25, 2025 05:10
@WestLangley
Copy link
Collaborator Author

TBH, I'd appreciate it if this can be merged so we can get to the point where reverse depth is working correctly. There were so many bugs to address.

I'll be glad to help with a refactoring once this settles down.

Oh, remember, we still have to get reverse depth working for WebGPURenderer.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 25, 2025

Sorry, my intent was not to block the PR. If we passing the reversed depth buffer boolean from Camera or WebGLRenderer can be implemented at a later point.

I would wait with WebGPURenderer support until the implementation in WebGLRenderer is more stable so we confident the decided approaches work in production.

@Mugen87 Mugen87 merged commit 08697ea into mrdoob:dev Jul 25, 2025
9 checks passed
@WestLangley WestLangley deleted the dev-frustum branch July 25, 2025 14:45
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.

2 participants