Expose objects' frustum culled state
See original GitHub issueDescription of the problem
The WebGLRenderer already calculates whether an object is frustum culled, using an internal Frustum.
It’d be nice if this information was exposed so that we don’t have to duplicate the Scene traversal and calculations with our own Frustum outside of the renderer.
A couple ideas:
- Maybe Mesh objects can have an
onFrustumCullChange
property that isundefined
ornull
by default. If it is set to a function, then when the frustum culling for the object changes the function can be called with true or false. - Another idea would be to just set a boolean flag on the Mesh objects, but this would make logic relying on it be one frame behind. In most cases it wouldn’t be a problem. The user could make the property into a getter/setter to achieve the same feature as the
onFrustumCullChange
idea.
Any other ways to do it without requiring a second traversal and calculations?
Three.js version
- Dev
Browser
- All of them
OS
- All of them
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Frustum Culling | Bruno Opsenica's Blog
Frustum culling is a solution to this problem wherein we identify which primitives are actually relevant to the current view by performing ...
Read more >Visibility and Occlusion Culling
View Frustum culling uses the visible screen area of the camera's field of view (FOV) to cull objects not within this space. The...
Read more >Occlusion Culling - Unity Manual
Occlusion Culling is a feature that disables rendering of objects when they are not currently seen by the camera because they are obscured...
Read more >Is there an Object3D poperty to check if it's within camera ...
One reason for this is that exposing the object's frustum culling state can be perceived from certain users as buggy.
Read more >Frustum Culling
Frustum culling can be useful to avoid computation of things that are not visible. You can use it to not compute the animation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I guess you can currently do this hack:
But I agree with @Usnul. I would use cannon.js or something.
In my current case I’m doing the in-view detection only once when the user stops dragging an object, and not every frame, so performance is not as important in my current case, but I could see this being important if the detection needs to happen every frame, especially if there’s many objects in the scene.