• 14
• 12
• 9
• 10
• 13

Octree space partitioning bug

This topic is 4694 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi ,i just finished putting togather my octree space partitioning library . picture here The problem is that i have a bug and i don't know how to eliminate it .Whenever i move the camera i see some missing polys in the corner of my camera and so i see the polys as they are built. The surface is build from bezier patches as an example for my lib. What could be the problem ? THX!

Share on other sites
The problem is that your polygons aren't being drawn until after they are in view of the camera, so the problem is going to lie in how you determine if they are in view or not.

Are you sure that you're calculating your viewing frustum properly (your camera is properly synched with your math, your surface are getting drawn where you think they are)? Maybe you check to see if the center of a node is in view instead of if any tiny little part is in view?

Share on other sites
not an OpenGL problem, shoved over to Game Programming

Share on other sites
This sounds like a standard culling issue to me...

Are you using loose octrees? How are you assigning surfaces to tree-nodes? Are the undrawn parts inside a node which is currently visible? Do some testing...

Share on other sites
Only a part of the node in which the missing polys are, is visible
What do you mean by loose octrees?

Share on other sites
Well remember you're not culling against your surfaces, but against the nodes that contain your surfaces, and the parents of those nodes, etc.

If your surface exceeds the bounds of the node containing it (or any parents), then if the node-bound lies outside the frustrum, the surface will be culled (even if it appears to be inside the frustrum) - giving you either the results you are getting (or remarkably similar ones).

Share on other sites
bool CFrustum::isCubeInView(C3dPoint center, float w){w/=2;//!!!!!!!this shows empty polys w=width of the cube//!!!!!!!!if i take 'w' instead of w/2 everything seems OK//for(int i=0;i&lt;6;i++){    //LEFT FRONT TOP corner 	if(cPlanes[A]*(center.x-w)+cPlanes*(center.y+w)+cPlanes[C]*(center.z-w)+cPlanes[D]&gt;0)continue;	//LEFT BACK TOP  corner	if(cPlanes[A]*(center.x-w)+cPlanes*(center.y+w)+cPlanes[C]*(center.z+w)+cPlanes[D]&gt;0)continue;	//RIGHT BACK TOP corner	if(cPlanes[A]*(center.x+w)+cPlanes*(center.y+w)+cPlanes[C]*(center.z+w)+cPlanes[D]&gt;0)continue;	//RIGHT FRONT TOP corner	if(cPlanes[A]*(center.x+w)+cPlanes*(center.y+w)+cPlanes[C]*(center.z-w)+cPlanes[D]&gt;0)continue;    			//LEFT FRONT BOTTOM corner    if(cPlanes[A]*(center.x-w)+cPlanes*(center.y-w)+cPlanes[C]*(center.z-w)+cPlanes[D]&gt;0)continue;    //LEFT BACK BOTTOM corner	if(cPlanes[A]*(center.x-w)+cPlanes*(center.y-w)+cPlanes[C]*(center.z+w)+cPlanes[D]&gt;0)continue;	//RIGHT BACK BOTTOM corner	if(cPlanes[A]*(center.x+w)+cPlanes*(center.y-w)+cPlanes[C]*(center.z+w)+cPlanes[D]&gt;0)continue;    //RIGHT FRONT BOTTOM corner	if(cPlanes[A]*(center.x+w)+cPlanes*(center.y-w)+cPlanes[C]*(center.z-w)+cPlanes[D]&gt;0)continue;    return false;}return true;

Share on other sites
Well the problem is probably not in your cube/frustrum culling algorithm, but in the method you use to assign surfaces to nodes - are you cutting surfaces along node-edges, or resizing node-bounds to accomodate the new contents correctly?

Share on other sites
Well it doesn't split the polys ,it assigns the cutted poly to all nodes that have some part of the poly inside. This is because I still don't know how to handle the texture coordinates in case of a cutted poly.