## The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!

 Pages: [1]   Go Down
 Author Topic: screen space ambient occlusion  (Read 7779 times) Description: 0 Members and 1 Guest are viewing this topic.
Fractal Molossus

Posts: 703

 « on: March 29, 2010, 03:24:03 AM »

Hi, I'm wondering whether any of the fractal renderers use screen space ambient occlusion? http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion
It seems like a good way to add more depth to the image without resorting to the cost of global illumination.

I know the wip3d for UF has an ambient occlusion option but it doesn't really work on the Mandelbox so I wonder whether other packages use or have considered using this screen-space technique?
 Logged
David Makin
Global Moderator
Fractal Senior

Posts: 2286

 « Reply #1 on: March 29, 2010, 01:51:57 PM »

At some point I also thought that the orbit trap based ambient occlusion didn't work for the Mandelbox but I was actually mistaken.

The thing I overlooked was the *size* of the Mandelbox - because of this the max and min settings for the orbit traps both need to be increased.

In my formula for UF you can get the correct values for the min and max occlusion values as follows:

1. Switch colouring to "Lighting+Colour".
2. Set the colour to be used to white.
3. Set the lighting method to "Camera".
4. Set the light strength to 1.0.
5. Set the diffuse and specular strengths to 0.0
6. Make sure ambient occlusion is enabled and set the base ambient to 1.0 (leave sourced ambient at zero).
7. Now adjust the min and max values for the orbit trap occlusion - for most Mandelboxes this means increase the values from the defaults.

If anyone has trouble getting it set correctly reply here and I'll post an example UPR tonight (am at work now).
 Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
chaospro
Guest
 « Reply #2 on: March 29, 2010, 08:37:16 PM »

Hi,

Hi, I'm wondering whether any of the fractal renderers use screen space ambient occlusion? http://en.wikipedia.org/wiki/Screen_Space_Ambient_Occlusion
It seems like a good way to add more depth to the image without resorting to the cost of global illumination.

I know the wip3d for UF has an ambient occlusion option but it doesn't really work on the Mandelbox so I wonder whether other packages use or have considered using this screen-space technique?

ChaosPro also has screen space ambient occlusion built in. And yes, it adds a much more realistic lighting than the "normal" lighting algorithm.

The algorithm used by ChaosPro should not depend on other settings, as it adjusts automatically and works on the image visible on the screen (basically only uses the z-buffer, thus "screen space").

The algorithm implemented in ChaosPro is this one:

http://www.malmer.nu/index.php/2008-04-09_ssao-c-style-pseudo-source-code/

Kind regards,
Martin

 Logged
David Makin
Global Moderator
Fractal Senior

Posts: 2286

 « Reply #3 on: March 29, 2010, 11:03:44 PM »

It is possible to do screen-space ambient occlusion in UF, the only problem is that it requires a z-buffer and that's problematic in UF, the rendering would have to be done in the global section with a pseudo-screen buffer as well as the z-buffer (unless the calculations where performed twice), this would be OK for resolutions up to say around 3000 pixels square but until everyone has 64-bit systems and UF is fully 64-bit enabled we'd not be able to render print quality sizes (though it'd be fine for most animations).
 Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Fractal Molossus

Posts: 703

 « Reply #4 on: March 30, 2010, 01:01:59 AM »

Awesome, so Chaospro does it, UF does a different form of ambient occlusion, but could potentially do it. I think mandelbulb3d does something like it.
David, I'll try out the method you say for getting the values right.
 Logged
Isokron
Forums Freshman

Posts: 15

 « Reply #5 on: March 31, 2010, 12:51:16 PM »

I use ssao in to add some depth cues in my realtime viewer and it gives nice results if you dont overuse it (try turning on/off postfx to see difference). Orbit traps probably gives better results though but only works with outside views (although I guess the inverse could work from inside, haven't tried).
 Logged
Buddhi
Fractal Iambus

Posts: 895

 « Reply #6 on: April 02, 2010, 01:54:43 PM »

Your posts inspired me to implementation of screen space ambient occlusion to my program. I didn't used original algorithm with random samples but I developed my own algorithm. I will describe how it works when I optimise it. Now it is not so fast but results are interesting. Please look at attached image (image was shaded using only this algorithm)
 image00118.jpg (182.31 KB, 800x600 - viewed 359 times.) Logged

ker2x
Fractal Molossus

Posts: 795

 « Reply #7 on: August 07, 2010, 09:54:27 PM »

I'm working on my own mandelbulb rendering (yay!), can you tell me more (with simple words) about your SSAO please ?
My last try is an (interesting) big FAIL!

 Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
knighty
Fractal Iambus

Posts: 819

 « Reply #8 on: August 08, 2010, 12:56:42 AM »

It looks better if you invert it:

 Logged
Buddhi
Fractal Iambus

Posts: 895

 « Reply #9 on: August 08, 2010, 10:01:11 AM »

I'm working on my own mandelbulb rendering (yay!), can you tell me more (with simple words) about your SSAO please ?
My last try is an (interesting) big FAIL!

After inverting it looks much more better.
However I will try to explain how my SSAO algorithm works.

On the first attached image there is cross-section of the fractal and example rays for one scanning direction. Red line is the z-buffer. On the second image there is view from front (from camera) and scanning directions.

For each scanning direction the algorithm finds minimum angle between camera vector and vectors created by actually calculated point (centre) and scanned point. If the angle is lower it means that in this direction there is less light. Program remembers this "light" intensity as proportional to minimum angle. Of course for this operation each screen coordinate has to be transformed to fractal coordinates.
The same operation must be repeated for each scanning direction. Resultant ambient light intensity is a sum of light intensity for all scanning directions.
For faster calculation of SSAO I have used higher scanning resolution near actual centre point and much lower for far distances (like on second image). Optimal maximum scanning distance is half image width. It gives high detail level and realistic result.
Third image shows how it looks on whole Mandelbulb. There was used only SSAO for shading.

 z-buffer.png (20.78 KB, 579x226 - viewed 283 times.)  scanning.png (88.45 KB, 251x194 - viewed 732 times.)  SSAO example.jpg (130.4 KB, 600x600 - viewed 300 times.) Logged

ker2x
Fractal Molossus

Posts: 795

 « Reply #10 on: August 08, 2010, 12:41:18 PM »

thank you very much. with the explanation and the code, i should be able to recode your implementation
I'm currently rewriting a XNA HLSL implementation with the help of code found here and there, to understand every bit of the mandelbulb, then i'll code an openCL version
 Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Rrrola
Alien

Posts: 23

 « Reply #11 on: August 08, 2010, 01:23:38 PM »

Boxplorer's fake ambient occlusion is computed from distance estimation samples taken along the normal (doesn't need a z-buffer, only 5 extra distance computations per pixel):
$\mathrm{occlusion}=1\,-\,\alpha \sum_{i=1}^5 2^{-i} \,\left(d_i \,-\, \mathrm{distance}(p + d_i\cdot n)\right),$, where d = {2δ,3δ,5δ,9δ,17δ}.
Parameter α controls strength and δ controls the scale of details that will be affected by AO.
The technique is explained in http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf, pages 47–54.

 test.jpg (141.52 KB, 512x384 - viewed 308 times.)  test_with_ao.jpg (126.34 KB, 512x384 - viewed 317 times.) Logged
 Pages: [1]   Go Down