I’m trying to optimize performance for a project where I need to find out which face the user clicks/hovers.
My model consists of multiple “volumes” or objects, but at the moment I draw them all using a single threejs mesh, to reduce number of draw calls, etc. (maybe a bad idea, if so, let me know).
Now to the ray casting. At the moment the only “optimization” involved is that I check whether the users mouse position is on the bounding box of the mesh, and if yes only then I call the ray cast method from the mesh, which checks against every single face and can be very expensive. My question is whether I can somehow check against the bounding box of the “objects”/“volumes” first and only then check run the ray casting on the faces belonging to those volumes.
Of course the other solution is to create one mesh per “object” which automatically achieves that, but I’d like to avoid that if possible.
Thanks in advance, and I’m sorry if the terminology which I used is incorrect. I’m still learning.