Sign in to follow this  
at0m

Frustum vs Point

Recommended Posts

at0m    122
Hi, I'm implementing a frustum culling algorithm in a vertex shader for OpenGL (using GLSL) and I have a problem with the equations (don't work as planned). Here's the algorithm : I have : -pos is the center of the aabb -l is the length of the aabb -Mp is a projection Matrix -Mm is a ModelView Matrix -pt = Mp * Mm * pos; (So it's the transformed position of the center) Pt is in the frustum if ALL the following assertions are wrong : - pt.x + l/2 < -pt.w; - pt.x - l/2 > pt.w; - pt.y + l/2 < -pt.w; - pt.y - l/2 > pt.w; - pt.z + l/2 < -pt.w; (Note : for directX, it's pt.z + l/2 < 0 ) - pt.z - l/2 > pt.w; But it's not working properly, some objects get culled even though they are still visible. Have I done something wrong ? Regards, B [Edited by - at0m on April 27, 2010 11:00:25 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this