Skip to content

WebGLRenderer: Auto-correct reversed projection matrix #31410

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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

WestLangley
Copy link
Collaborator

Currently, reversed depth buffer is set globally, and not on a per-camera basis. I think that is reasonable.

Since there are many cameras used by the engine that the user does not have access to, just auto-correct camera.reversedDepth upon first-use.

I think camera.reversedDepth can be made private, as the property would only be used by the engine itself.

Copy link

github-actions bot commented Jul 14, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.28
78.93
338.01
78.83
-271 B
-98 B
WebGPU 558.52
154.58
558.52
154.58
+0 B
+0 B
WebGPU Nodes 557.45
154.37
557.45
154.37
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 469.62
113.66
469.2
113.5
-426 B
-158 B
WebGPU 634.18
171.62
634.18
171.62
+0 B
+0 B
WebGPU Nodes 589.31
160.95
589.31
160.95
+0 B
+0 B

@WestLangley WestLangley added this to the r179 milestone Jul 14, 2025
@WestLangley
Copy link
Collaborator Author

In the examples, sometimes the renderer is instantiated prior to the camera, and sometimes the camera is instantiated prior to the renderer.

In that regard, I think having the renderer auto-correct the projection matrix lazily, upon first use, is a reasonable approach.

@WestLangley WestLangley marked this pull request as ready for review July 14, 2025 16:16
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.

1 participant