Combining octree and hierarchical scenemanager...

Started by paandar, April 19, 2013, 13:13:53

Previous topic - Next topic

paandar

Well, reached the point where I want to see some stuff in my 3d world, I have some doubts about scene management and culling.

My plan is to represent the world with an octree (at vertex level, not bounding boxes level) for all the static meshes that conform walls, celings, etc.
Also, I need a way to introduce moving meshes in this world in an hierarchical form so I can group related things together (eg.: tires in a car) to apply transformations, lighting and material to an entire branch. Each of this moving groups would have a defined bounding box (eg.: a complete car).

Now, first of all about frustum culling (occlusion will be the next step), and here it comes

Do I have to use the octree for culling?
Do I have to use the hierarchical scenemanager with its bounding boxes for culling?
How would be the relationship within both trees? At vertex level? At bounding box level? Do they share the same data?
What happens with the data in the octree when a non static object moves?
What happens if a non static object is in the middle of two or more octree nodes?

Hope someone can give me a hint about where to start with this,
Thanks

rherma

I doubt this is a question for the open gl forum.

Anyways, if I understand you correctly you simply want to be able, as a first step, put several 3D objects in world and only render those objects that are visible through your camera.
The first step would be frustrum culling. Your camera has a view frustrum, if an object is inside the view frustrum volume then it is visible and should be rendered.
To check for that you use the objects boundning box.
So you do not need to have a octree, that is just a nice improvment.

in psuedo code:
foreach(model in world)
{
	if(camera.checkFrustrum(model.boundingbox))
	{
		draw(model);
	}
}

if your model consists of several meshes and each mesh has a boundingbox then you can of course check each mesh, and thus render a "partial" model.

I am not an expert when it comes to this, but that is where I would start.

Here is a tutorial on frustrum culling: http://www.flipcode.com/archives/Frustum_Culling.shtml.
There are probably many tutorials on both frustrum culling and octree scene management.