[newbie] Octree occlusion issue

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

Recommended Posts

I've noticed that it doesn't seem to work if you check if the points in an octree node are within the frustum to determine if a given node should be rendered, if the camera is oriented in such a way that none of the points appear within the frustum. This can easily occur if the camera is inside a given node. I could just align the camera with a side of the cube. This could be the root node, which is very large; none of the points are within the frustum so nothing is rendered. What are some possible solutions to this?

Share on other sites
Here's a top-down MS-painted picture of the problem:

Share on other sites
The correct way to test if a box is inside the frustum is to check if all of the box's vertices are outside of one of the frustum planes (doesn't matter which one). This article has some code that does this (it assumes the box is axis-aligned, but if you're using an octree that's just what you need), and might also contain some other information useful to you.

Share on other sites
It sounds from the question like you're currently testing visibility by seeing if any of the corner points of a node are inside the frustum. That's not the best way to go about it, as you'll have the sorts of problems you mentioned. Googling for "frustum aabb" produces lots of nice stuff, try this from Toymaker's Direct3D FAQ: http://www.toymaker.info/Games/html/direct3d_faq.html - about half way down the page there's a function.

[eep, beaten to it]

Share on other sites
here is my code of frustum-aabb if it helps anyone

        public CollisionTestResult contains(AABB aabb)        {            CollisionTestResult result = CollisionTestResult.Inside;            for (int i = 0; i < 6; i++)            {                Vector3 p = aabb.Min;                if (planes.A >= 0)                    p.X = aabb.Max.X;                if (planes.B >= 0)                    p.Y = aabb.Max.Y;                if (planes.C >= 0)                    p.Z = aabb.Max.Z;                Vector3 n = aabb.Max;                if (planes.A >= 0)                    n.X = aabb.Min.X;                if (planes.B >= 0)                    n.Y = aabb.Min.Y;                if (planes.C >= 0)                    n.Z = aabb.Min.Z;                if ((planes.A * p.X + planes.B * p.Y + planes.C * p.Z + planes.D) < 0)                    return CollisionTestResult.Outside;                else if ((planes.A * n.X + planes.B * n.Y + planes.C * n.Z + planes.D) < 0)                    result = CollisionTestResult.Intersects;            }            return result;        }

1. 1
2. 2
Rutin
29
3. 3
4. 4
5. 5
khawk
14

• 11
• 11
• 23
• 10
• 9
• Forum Statistics

• Total Topics
633648
• Total Posts
3013111
×