View Full Version : question on octrees

Martin_unique

01-07-2003, 09:45 AM

I'm somewhat confused on how octrees are used to check the frustum intersection with the 3d world. In OpenGL all transformations are performed on world 3d objects, while the frustum remains unchanged (along the Z axis) - at least that's my understanding. Now when using octree do you have to 1) rotate the octree cubes with the world (to maintain the 3d object <> octree node relationship) and then perform the octree/frustum intersection test ? It seems like you have to write your own rotation routines to do that since you can't simply send those to OpenGL because they will be rendered immediately. Or do you rotate the frustum (on your own), perform the intersection test, then send the detected cubes (3d objects in those cubes) to the rendering pipe ?

I would appreciate if someone could clarify this issue for me.

Martin

knackered

01-07-2003, 10:09 AM

Of course you *transform* the frustum (that's translate & rotate).

Nick Nougat

01-07-2003, 03:19 PM

Well, all transformations/rotations can be seen in two ways. If you Translate, say, 5 units along the positive Z-Axis, and then draw a triangle, you could say that you just "moved the triangle" 5 Z-units away from the camera, you could also say that you moved the camera -5 Z-units away from the object... The same goes for rotations. If you rotate the world 90 degrees you could also say you rotated the camera -90 degrees. There is no fixed frustum, just a modelview matrix which you modify and your way of looking at it(i.e. the "camera" anology or the fixed coordinate system analogy).

You can derive the current frustum planes from the current modelview and projection matrix.

This link (http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg5.htm) should help clarify how this is done. Look at the frustum culling tutorial, and maybe the octree tuts interest you too. These tutorials are quite well written.

Hope this helps

Nick

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.