Ambient occlusion

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 18, 2012 at 16:48

When raytracing, you sample each lights, giving a dot free result right? But when sampling for ambient occlusion, the shadows have dots like in a path tracer and takes a long time to converge. How do you fix that so it appears smooth?

Thanks

17 Replies

Please log in or register to post a reply.

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Apr 18, 2012 at 17:57

The “dots” are called noise or variance and appear when you want to numerically integrate a function by random sampling it. One way to reduce it is to render it into a buffer and blur it. But I have no idea what the state-of-art approach for AO currently is.

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 18, 2012 at 18:24

Sounds like a good idea! thanks Roel :)

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 18, 2012 at 20:43

hmmm, easier said than done! Any ideas or links to papers on how to blur a map?

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Apr 18, 2012 at 21:27

That’s very basic, it’s all over the internet. You can find that yourself. And it is in the directx sdk (or at least, it used to be last time I checked).

By the way, this is state of the art SSAO according to my rss reader:

http://publications.dice.se/attachments/GDC12_Stable_SSAO_In_BF3_With_STF.pdf

http://research.nvidia.com/publication/alchemy-screen-space-ambient-obscurance-algorithm

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 18, 2012 at 21:35

Great, thanks Roel

B20d81438814b6ba7da7ff8eb502d039
0
Vilem_Otte 117 Apr 18, 2012 at 22:29

Blurring ambient occlusion is wrong! Well you can do with some bilateral stuff (or gaussian filters - which are a lot better, but too slow for real time), but you’ll lose micro-details in ambient occlusion, it just won’t look okay.

So what’s best to do - simply performing true ambient occlusion with enough samples (I think jittered 32 samples is enough for nice low-frequency ambient occlusion), let’s assume we can go with half screen size ambient occlusion buffer. So let’s do the math - we have to do (at 720p) 230 400 * 32 samples per frame - totalling 7 372 800 local rays/s. And we need at least some decent 30 fps - thats totally 221 184 000 rays/s (221 MRays/s) … this is not far from impossible.

At ompf.org mpeterson states, that “on dual sandy (3.06ghz) around 290mrays/s with ray length of 0.25 * scene-diag” (Fairy forest scene) which actually seems enough (note that 0.25 * scene-diag is quite large radius for AO and you’ll most likely use much smaller one). Not mentioning that you can actually run ray tracing on GPU. Also the less radius, the more Mrays/s you will get - so you can get quite nice correct local AO at decent framerate :)

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 18, 2012 at 23:54

I’ve noticed that. I made a MakeGaussianKernel function and used that to blur the AO map but it looked like crap. I get nice results on random rays but it take so long! I’ll try what you suggested, thanks!

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Apr 19, 2012 at 07:19

Things like screen space ambient occlusion are always wrong anyway. But since Vilem Otte mentions ompf, are you talking about AO in rasterisation or in ray-tracing, Alienizer? In ray-tracing you get AO-effects for free, they simply emerge. In rasterisation, AO is—unless pre-computed—an “effect” based on true AO.

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Apr 19, 2012 at 09:21

Pre calculating AO and storing in your meshes gives the best results IMHO.

The screen space stuff is good, but not available on some platforms (you need render to texture which doesn’t exist on a lot of mobile platforms)

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 19, 2012 at 11:48

Make sense, Thanks!

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Apr 19, 2012 at 21:03

But of course the drawback of pre-calculation is that it is valid only for the geometry for which it is calculated - so you have static geometry with nice AO.

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 19, 2012 at 23:26

yeah, I ran into that problem :wacko:

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Apr 20, 2012 at 09:16

It’s a pain. A hell of a lot of things I used to do as “standard” are no longer available to me because some <expletive deleted> was limp wristed when writing the standards.

Now render to texture is “optional” and only supported by opengl extensions, which of course means “not available” to anyone who has to write for multiple platforms.

Our engine creates a single binary that can run on all supported platforms, but we still have to have run time flags and platform dependant code to handle stuff that should have been a requirement rather than an optional feature.

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Apr 23, 2012 at 23:57

@Vilem Otte

At ompf.org mpeterson states, that

What happened to ompf.org anyway? They were up for so long, I can’t beleive they shut down!

B20d81438814b6ba7da7ff8eb502d039
0
Vilem_Otte 117 Apr 25, 2012 at 12:32

In fact nobody knows what actually happened to ompf.org - anyway Jacco Bikker revived it at http://igad2.nhtv.nl/ompf2/ some time ago. The shame is, that the database was lost (well something is still available from google cache, and I read that some archived version from 2009 is also on TheWaybackMachine).

666709a3f4af078844a719184b9d5f48
0
jlippo 101 May 09, 2012 at 18:08

Infamous 2 used a nice AO fields and decals for realtime AO effects with small SSAO.
Video

There also were paper about indirect illumination with cone tracing of voxels, it also had AO only version running interactive framerates.
Basic idea is to voxelize environment, prefilter it (mipmaps) and use it for cone tracing. (further from point you go, smaller mipmap you use thus reducing need for lots of rays.)
Video

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 May 10, 2012 at 06:38

who cares if its noisy, ao looks awesome anyway even with the noise.