Posted on 04-11-2008 under
3ds max,
Algorithm
I continued developing my method for SSAO and worked a bit on making it look better over a series of frames in an animation. So basically I ended up generating the same sphere for any given number of samples (same random seed) and then rotate the samples using by reflecting them with a per-pixel random normal, as described here.
That is all fine, but the real improvement came when I used energy minimization on my sampling sphere. Instead of just settling with random spherical coordinates I put my sphere through a energy minimization routine, and the difference is staggering. I’ll let the pictures speak for themselves:

SSAO without energy minimization
Notice how noisy and high contrast this looks.

SSAO with energy minimization
Much less noise with the same number of samples, and more realistic contrast.
So how does one do this? It is quite simple. Just generate your sample sphere with normalized vectors. Then iterate through them and apply some force between each point until they reach and equilibrium. About 100 iterations should be more than enough, and since this is done in a pre-process stage it really doesn’t matter how long it takes.
Here is some code: Read more »
Tags: 3ds max, Ambient Occlusion, Energy Minimization, Programming, SSAO
Posted on 04-09-2008 under
3ds max,
Algorithm
Ok, now it is time to actually show how the method I use works. This is C style code, but with some changes from my original code, for clarity. That is because my code handles the many layers of the 3ds max G-buffer and how pixels are weighted and works with transparency. Also, my code also has a method for simulating ambient radiance (more on that in a later post).
Read on for the actual code.
Read more »
Tags: 3ds max, Ambient Occlusion, Programming, Source code, SSAO
Posted on 04-09-2008 under
3ds max
To complement the previous post. Here is a “pretty” render of the SSAO effect. This also utilizes my custom DOF/motionblur plugin that, contrary to the crappy built-in 3ds max versions, handles both at the same time and with better sampling and high dynamic range support. All built into a sweet package that now also has ambient occlusion.
Tags: 3ds max, Ambient Occlusion, Depth of Field, Motion Blur, Rendering, SSAO
Posted on 04-09-2008 under
3ds max
Crysis introduced it, the world said wow!, and from there everyone wanted to do their own 3d-engine screen space ambient occlusion.
I implemented it in 3ds max as a render effect using the fine article written by IƱigo Quilez, and with a little help from a render element I managed to get it to only modify the ambient channel. Well, I didn’t actually implement it. I reimplemented it. because this and every text I’ve read about it on the web has some artifacts that are unacceptable in a vfx scenario, and can actually be avoided without any major performance penalties (if any).
In a later post I will detail what modifications I did to remove these artifacts, but in the mean time here are some screenshots. These are rendered in 3dsmax, but I’ve lowered the number of samples to 32 (which is what real-time engines should be able to handle) and I’ve turned off anti-aliasing. I’ve also, for clarity made the SSAO affect all channels, the way most game engines will do it, instead of just the ambient channel. Usually I also apply gamma to the render to make it more realistic, but I’ve removed that aswell so we get the pure linear pixel experience.
In other words, this is an image that a 3d engine should be able to produce without any problems.
Naturally, if you want to use these few samples you probably should do some blurring of it before presenting it, but this is a better reference for real-time scenarios. In software renders using 500 samples is fast and gives very smooth results.
-
-
No occlusion
-
-
SSAO occlusion applied
-
-
SSAO occlusion only
Tags: 3D, 3ds max, Ambient Occlusion, Lighting, Programming, Render Effect, Render Element, SSAO