camera frustum query

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
gtimworks
Posts: 21
Joined: Sun Nov 03, 2013 8:07 pm

camera frustum query

Post by gtimworks »

Hi there,

is there a simple way to query whether an specific element is within the camera frustum? I need this information to determine whether to play a sound that corresponds to the element.

If I understand it correctly "hardware occlusion query" doesn't work here because it goes per-pixel, not per-element.

Thanks,

gtimworks
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: camera frustum query

Post by mongoose7 »

Transform the bounding box by the MVP matrix. If the X and Y coordinates are between -1 and +1 then the box is in the cone. If Z is less than 1 it is in front of the far plane. I'm not sure about the near plane - it is either Z > 0 or Z > -1.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: camera frustum query

Post by hendu »

Or use smgr->isCulled(node).
gtimworks
Posts: 21
Joined: Sun Nov 03, 2013 8:07 pm

Re: camera frustum query

Post by gtimworks »

thanks hendu.
Post Reply