• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Implementing Meagher's Octree Renderer

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1D.V.D  Members

Posted 15 April 2014 - 10:45 PM

I have a question about Donald J. Meagher's paper called Efficient Synthetic Image Generation of Arbitary 3D Objects. The paper for those who don't know is a method of rendering octrees or octrees of voxels written back in the days when floats were too costly to use on CPU's. The algorithm pretty much goes like this:

1. Recurse through your octree in front to back order

2. If octree node is visible, project onto a quadtree of the screen

3. Find which nodes are intersected by the node

4. If that spot of the screen is free, draw the node

Part 3 and 4 is where it gets confusing for me. He mentions some sort of overlay algorithm where you make 4 bigger bounding boxes around the bound of the projected node and use this to test against the quadtree. He also tests I guess the remaining nodes against the bound of the projected node as well as lines created from the silouhette lines (edges) of the projected node for intersection.

To me, a lot of this seems redundant for example, whats the purpose of this overlay algorithm if he already checks the bound of the projected node against the quadtree nodes? Also, how does he get the line formula without doing division? Isn't a division needed for the slope?

The way I thought about implementing was also to use the bound of the projected node which would give you something like this:

http://i.imgur.com/rHFP7HB.png

At this point, you would recurse through the quadtree until you got a list of all the nodes intersecting the bound of your projected node:

http://i.imgur.com/Qi1tsZm.png

Here's where im sort of lost as to what I should do.Although I have a list of all nodes intersecting the bound of the projected node, they don't always encapsulate the actual projected node as shown by this picture:

http://i.imgur.com/POkr1cE.png

So do I do the same thing as he does in terms of making line formulas for each edge of the faces and then checking if the node is on other side of the line? Won't this be computationally heavy just to figure out where a shape sits in terms of the screen quadtree? If I intersect 12 nodes like in my drawn case, I would have to do 144 line checks (4 lines per face * 3 faces * 12 nodes) + more for however many times I subdivide to get down to the pixel level. I could test all of the nodes against the 6 edges of the projected node but then I wouldn't know which pixels correspond to the face of the octant which is important if each octant face has a different color.

I also was wondering if there would be a way of figuring out which faces are not on screen without projecting them all? I know it should be possible since you only have a few possible cases (3 or 2 faces are actually projected). Or can this be done with some kind of distance tests?

And also, if someone understands how the paper describes doing this, that would be of great especially the overlay algorithm he uses.

### #2D.V.D  Members

Posted 16 April 2014 - 12:43 PM

Okay so I re-read the the paper and I understand the overlay algorithm a bit better. Its explained in a really weird fashion but its pretty much just standard quad tree insertion as far as I understand. You start of with the root of the quad tree and check if the bound of your projected node intersects. If it does, you check it against the quad tree's children. In the paper they illustrate only the case where at this point, the bound intersects all 4 of the children but there are actually 3 cases with a square (and rectangle I believe).

1. It could be completely encapsulated inside one of the roots children.

2. It could overlap two of the roots children.

3. It could overlap 4 of the roots children.

In each case, you could just recursively subdivide until you found out to the pixel level where your projected node sits and since your projected nodes will usually try to be 1 pixel or less (working with large voxel data sets and the nature of this renderer), then your probably going to hit around a pixel or two for your bound. Whats also important to note its that if your projected node has children, then subdivide it as well and check its children against the next nodes instead of itself (as long as its not less than or equal to 1 pixel).

So all in all, your left with this kind of algorithm for the first half:

1. Project the root of the octree.

2. If it is visible, subdivide the quadtree

3. If the root has children, project its children and check which quadtree nodes they overlap. (if no children, than just check the root octant)

4. Keep going until you hit 1 octree node per pixel or you hit a leaf node

I'm still confused as to how he makes the half planes and checks for that. I don't really know the math of planes too well but I assume its just simply y = mx + b lines for the edges of the projected octree node. It still confuses me how he doesn't use multiplication or division for these operations. Also, I still want to know, is there a quicker way to check if a projected node overlaps a bunch of quad tree nodes if you already know which quad tree nodes its bound overlaps?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.