-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
BatchedMesh: Add pure annotations, fix camera position for sorting #27236
Conversation
// prepare the frustum in the local frame | ||
if ( perObjectFrustumCulled ) { | ||
|
||
_projScreenMatrix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurred to me that I don't fully understand how this frustum generation logic works - it was copied from WebGLRenderer and then ".muliply( this.matrixWorld )" was added - why is it that we use camera.matrixWorldInverse here instead of camera.matrixWorld to get the frustum in world frame?
_projScreenMatrix
.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
.multiply( this.matrixWorld );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In WebGLRenderer
, _projScreenMatrix
transforms from world space directly to clip space and maybe it would be less confusing to stick to this logic in BatchedMesh
, too?
Meaning .multiply( this.matrixWorld );
should be removed and _frustum
needs to check bounding spheres in world space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's significantly more matrix multiplications for no gain, though, since it means each bounding volume needs to have the world matrix multiplied in.
I just want to understand how the Frustum.setFromProjectionMatrix
function works. It must take an inverted matrix? It must be true since camera.projectionMatrix
is what compresses everything into the clip space box. Even if we just talk about what WebGLRenderer is doing - it wasn't clear why this results in a frustum that can check for intersections in world space since camera.matrixWorldInverse
should transform into the local space of the camera.
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
I'm not sure when the next release is but this should be merged before 159, I think, since it fixes a bug. |
You can see when the next milestone is due here: |
…rdoob#27236) * Add pure annotations, fix camera position for sorting * Update annotations
Related issue: #22376
Description
/*@__PURE__*/
annotations for global cache variables