Frustum vs Point
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement