I’ve tried thousand of combinations witout success.
I’m trying to implement Frustum Culling with VBO.
The passes are:
[ul]
[li]VBO creation with vertices in object/local space (in other words: from its own origin at 0,0,0 before move the object inthe right world’s place)[/li][li]create sphere center (3D object’s center) with its radius (both of these values are in object/local coordinates like all whole VBO data) for later frustum culling calculations[/li][li]calculate all 6 frustum panels with PVM matrix (I suppose panel’s coords are in camera/view space)[/li][li]create a matrix with all object trasformations and send it to Vertex Shader (to place objects in right world places)[/li][li]TO DO: test if objects are in/out frustum[/li][li]Vertex Shader changes vertices position according with passed matrix (GLSL: “gl_Position = PVM * vertex”)[/li][/ul]
When I execute Frustum Test I’ve got sphere coords and radius value in OBJECT SPACE, so I’m unable to compare those values with frustum panels which are “extracted/calculated” with Projection and View matrices.
I’ve thought to multiply sphere center ([X,Y,Z,1] vector) with PVM matrix (4x4), but this multiplication returns an 1x4 vector which I don’t understand how to use it.
For example “PVM*[X,Y,Z,1]” returns [-2.4345, 0.1234, -3.5545, 103.4356]…but I just need new position point (X,Y,Z), not a vector with the 4th value!
Another problem: during frustum test all my object’s sphere radius are in OBJECT SPACE. How can I transform it in a way compatible with friustum panel’s data? “PVM*radius” (matrix*scalar)?
PS: I’ve got well objects rendered if I disable frustum test, so my VBOs and Vertex Shader works fine with the right data.