[Closed] Object in camera cone ?
Helllo everyone,
I would like to know if there is an easy and fast way to know if an object (at least it’s bounding box) is in the camera viewing range ? I was thinking that maybe there was a basic command to do that, or an existing script, but couldn’t find either.
The only way I see now is to compute it using the trigonometry of the camera cone, conversion to screen coordinates etc. etc. which is a bit too much work for me at this time
thanks for your help.
Hi,
It probably wouldn’t be that much work considering max has pretty good tools for working this stuff out, even if they are a little hard to understand.
Another way to do it would be to render a image with just the object and then analyse the alpha to see if there are any white pixels. easy.
J.
Actually, there is a rather nice example in the MAXScript Reference – see the How To … Develop a Vertex Renderer tutorial. Instead of passing vertex positions, you could send the bounding box corners and compare to the pixel size of the projection plane – if the results are less then 0 or greater than the size of the image, then the object is not seen by the camera and would not be hit by primary rays (figuring out secondary rays like raytraced reflections is out of scope, of course :))…
Cheers,
Bobo
thanks. I’ll look at that. (actually, I’ll look closer at that : I did already, but didn’t understood it very well. )
But I have my answer : there is no built-in function for that.