Advertisement

Calc octree order in camera space

Started by January 13, 2015 09:17 AM
1 comment, last by pabloreda 10 years, 1 month ago

Hi, I have a problem:

I have a 8 vertex cube in camera space, center is the camera origin viewing to z positive and I need calculate the octree order.

now I search the vertex with less distante to camera (0,0,0) but is expensive.

In the literature, always use object space, center in cube, and is easy calculate comparing the cube center and the camera position.

lhttp://www.flipcode.com/harmless/issue02.htm

I try operate about matrix transformation but is expensive too. if invert the matrix and transform the negate center of cube, I get the numbers for comparing like the link, but, transform a vertex is expensive too.

my question is

I need calculate the octree order but in camera space, it can be done more fast?

Thank's in advance

One possible way - treat octree as dumb bsp.

When traversing node, you check where's camera relative to implicit splitting plane.

If it's on the left, then you start traversing left halfspace, otherwise right. With selected halfspace you do the same check, but choosing next splitting plane. You will have 3 checks for every node, one for each implicit splitting plane.

You can get reverse sorting by selecting opposite halfspace, i.e. if cam is on the left of plane, you start traversing right halfspace.

Advertisement

work! thank's a lot..

This topic is closed to new replies.

Advertisement