Ambient Occlusion with OpenSG

7543b5c50738e23b200e69fe697ea85a
0
NomadRock 101 Sep 11, 2005 at 16:19

05-09-11.jpg

Description
In my new job at VRAC in Iowa State University I am working toward providing John Deere with new ways to display their models in real time and more visually pleasing than their current CAD programs allow.

We are using OpenSG as a framework which is widely used at VRAC. All models are rendered in Fedora Core 4 linux with my GeForce 6600gt in real time. The trick displayed here is to precalculate lighting using estimated ambient occlusion. The theory is that points on objects with more access to the outside world are generally brighter, so in a well lit room, the tip of your nose is brighter than the inside of your ear.

In this implementation I build a KD-tree of all triangles in the scene, then cast random rays for each vertex in the hemisphere in the direction of the vertex normal from a point just barely offset from the vertex. The percentage of rays that do not hit any triangles is the “accessibility” of the vertex and directly translates to the brightness used here. For production uses, this value will be blended with the diffuse lighting and perhaps other forms of lighting.

The top two images are just my test torus and cylinder and you can see that the algorithm has troubles where the shadowing on the end of the sphere looks off because there is no vertex in the center. The availability is calculated in a second or so. The next two images show a pair of free 3DS models available on the net. They are in the realm of 10k triangles and at higher quality estimations can take more than an hour. The production models will have millions of triangles and several levels of detail so clearly further optomization is needed. However, this will be part of a process that can be automated over night so it is not necessary that the calculation be instantaneous.

We are looking into implementing in GLSL an algorithm from Nvidia in GPU Gems which does an approximation in real time in their CG language. We need this CPU implementation because even though it takes time to precalculate, the actual rendering is just as fast as if no lighting calculations have been done at all even on lower end graphics cards.

The biggest point of optomization is going to be the KD-tree node splitting algorithm so that the ray intersect tests go faster.

2 Replies

Please log in or register to post a reply.

3c6597370b476903ed475f70b4b3ce31
0
john 102 Sep 12, 2005 at 17:42

very cool work! off-loading some of this work to the GPU would be a good step forward.

new ways to display their models in real time and more visually pleasing than their current CAD programs allow

based on your description, it seems it will be very difficult to acheive that goal of rendering in real-time :)

How much performance improvement do you estimate after applying the optimizations you referred to?

(OT:) on a related note, should we call the “dev snapshot”, the “image of the day” now?

7543b5c50738e23b200e69fe697ea85a
0
NomadRock 101 Sep 12, 2005 at 18:26

@john

very cool work! off-loading some of this work to the GPU would be a good step forward.
based on your description, it seems it will be very difficult to acheive that goal of rendering in real-time :)

How much performance improvement do you estimate after applying the optimizations you referred to?

[snapback]21170[/snapback]

Well their CAD programs are quite limited, for example they only display raw triangles and colors per geometry section. They actually have safety lables made entirely out of geometry :blink:

One obvious way to increase performance is to convert some of that geometry to a texture which is applied to underlying geometry. We are also generally looking into visual enhancments that can be performed during a pre processing step like the AO model above so that it does not negatively affect the run time drawing speed.

To be quite honest, I am not sure what kind of performance gains we will be getting. In the comming weeks we will need to do a lot of profiling to try an estimate which parts will benefit most from what kind of optomizations.