Papervision 3D Programming Tutorial - Quadtree Renderer
See the difference the new Papervision Quadtree renderer can make for complex 3D scenes. Demo and source code included.
VIEW THE DEMO
DOWNLOAD THE CODE
A common problem with a software 3D rendering is deciding the order in which triangles are drawn. Why is this important? It's important because those triangles furthest from the camera need to be drawn first, so those closer to the camera can draw over the top of them.
Imagine you were painting a house standing alone in a field against a mountain backdrop. The first thing you would paint is the sky, and then the mountains. This would give you a backdrop. To this scene you would paint the field, and those trees behind the house. Then you would paint the house, followed by the trees in front of the house. This is just common sense: those objects closest to the viewer should be painted last, and therefore painted over the more distant objects. Imagine if you painted the house first and the mountains last - you would paint the mountains right over the house and not see the house at all.
Rendering a 3D scene is very similar to painting. In the same way that the more distant mountains are painted first and then the house is painted over the top of that image, the most distant polygons that make up the scene should be rendered before those closer to the camera.
It seems like a simple concept right? But what about polygons that intersect? Look at the highlighted area in the image below.

Here we have a vertical plane intersecting a horizontal plane. Who is behind who? The answer is that the planes are both in front and behind each other at the same time. And as you can see, the standard Papervision renderer does not handle this situation very well. This is because Papervision assigns a single value to each polygon which represents it's depth in the scene. Obviously this single value can not represent the fact that a polygon can be both behind and in front of another at the same time, leading to the situation in the screenshot: one polygon is calculated to be behind (or in front), and is rendered as such.
Now take a look at this screenshot.

Notice the difference? The horizontal plane now intersects the vertical plane as you would expect. This is thanks to the QuadrantRenderEngine: a new renderer in Papervision that will split intersecting polygons so they are drawn properly. You'll also notice that, in addition to the polygons intersecting properly, that the vertical plane has also been split up into several smaller polygons. This is necessary for the rendering process, but these additional polygons have the drawback of incurring a performance cost.
In the demo application you can switch between the basic and Quadrant rendering engines by toggling the checkbox in the top left hand corner of the screen. It makes it easy to see the difference that the Quadrant rendering engine makes.
-
Papervision 3D Programming Tutorial - Quadtree Renderer
| By mcasperson | in Programming
See the difference the new Papervision Quadtree renderer can make for complex 3D scenes. Demo and source code inclu...
-
Papervision 3D Programming Tutorial - Creating a Papervision Component
| By mcasperson | in Programming
See how Papervision can be packaged into a SWC Flash component, which allows you to drag and drop Papervision into ...
-
Papervision 3D Programming Tutorial - Traer Physics
| By mcasperson | in Programming
See how to implement cloth physics in Papervision 3D. Demo and source code included....
-
Papervision 3D Programming Tutorial - 3D Image Transitions
| By mcasperson | in Programming
Implement 3D image transitions with this Papervision demo . Source code and online example included....
-
Papervision 3D Programming Tutorial - Environment Mapping
| By mcasperson | in Programming
Learn how to implement environment mapping with Papervision....
-
iPhone Resizing a UIImage | By eh9212 | in Programming
How to resize a UIImage in a UIImageView and a UIButton...
-
Threading in dot net 2.0 - separate copy of static variable among different threads using ThreadStatic attribute | By xxris | in Programming
How each thread keeps a separate copy of same static variable using ThreadStatic attribute ....
-
ADAPATIVE ALGORITHM TO FINDOUT DUPLICATE RECORDS | By pinakbhusanmishra | in Programming
Records are list of row that are stored inside database . this is an efficient technique to find out the duplicatin...
-
ALGORITHM TO FIND OUT HIDDENLINKS IN WEBSITES | By pinakbhusanmishra | in Programming
Here we can find out the hidden links in the websites that basically people uses for the browsing ads....
-
PHP and MySQL | By ChaimChaikin | in Programming
PHP is a server side programming language that is used mainly for dynamically creating and mantaining websites. PHP...
-
AS3IsoLib Tutorial Series - Interaction | By mcasperson | in Programming
In this tutorial we add mouse interactivity to the scene....
-
AS3IsoLib Tutorial Series - Camera | By mcasperson | in Programming
In this tutorial we allow the view of the isometric scene to be moved with the mouse....
-
AS3IsoLib Tutorial Series - Height | By mcasperson | in Programming
In this tutorial we show the height of an isometric object by adding a shadow....
-
AS3IsoLib Tutorial Series - Materials | By mcasperson | in Programming
In this tutorial we modify the appearance of the isometric cube at runtime....
-
AS3IsoLib Tutorial Series - Moving Boxes | By mcasperson | in Programming
In this tutorial we add some animated isometric boxes to the scene....








No comments yet.