[SOLVED] How can we get a list of objects that Three.js is rendering inside the camera (not frustum culled)?

I believe that Three.js is “Frustum Culling” objects outside the camera view (because when I zoom the camera and less objects are visible the performance increases).

How can I get a list (from Three.js) of objects that are not Frustum Culled?

I know I may be able to traverse the tree and do it myself by comparing object positions and size to the camera frustum, but I’m wondering if there’s some data in the Three renderer that I might be able to just grab and read, assuming Three.js is already tracking that.


I took a look: looks like WebGLRenderer internals are well hidden (private vars inside the constructor scope), so I’m not sure if there’s a simple way to see which objects are not frustum culled other than making my own Frustum and performing duplicate work.

It’d be nice if there was a way to get this info for free because the renderer is already doing it. So I made a feature idea for it on GitHub.

Create 4 planes for the frustum of the camera, bound box the objects and check for inside planes.


I’ll do similar to what the WebGLRenderer does (generate a frustum based on the camera and see if an object intersects).

EDIT: That worked fine. [SOLVED]

Keep in mind that this check may be expensive, and you’re doing it twice for everything.In which case, you may want to disable frustum culling, and cull yourself.

You mean because renderer is doing it once and so am I? True! Would be great to get that information from the renderer for free.

Good thing in my case I’m doing it only once after a user lets go of a dragged object, so it isn’t as bad it would be doing it every frame.