Jump to content


Ambient occlusion


17 replies to this topic

#1 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 18 April 2012 - 04:48 PM

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

#2 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 18 April 2012 - 05:57 PM

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.

#3 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 18 April 2012 - 06:24 PM

Sounds like a good idea! thanks Roel :)

#4 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 18 April 2012 - 08:43 PM

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

#5 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 18 April 2012 - 09:27 PM

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....F3_With_STF.pdf
http://research.nvid...rance-algorithm

#6 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 18 April 2012 - 09:35 PM

Great, thanks Roel

#7 Vilem Otte

    Valued Member

  • Members
  • PipPipPipPip
  • 362 posts

Posted 18 April 2012 - 10:29 PM

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 :)
My blog about game development (and not just game development) - http://gameprogramme...y.blogspot.com/

If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D

#8 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 18 April 2012 - 11:54 PM

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!

#9 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 19 April 2012 - 07:19 AM

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.

#10 Stainless

    Member

  • Members
  • PipPipPipPip
  • 610 posts
  • LocationSouthampton

Posted 19 April 2012 - 09:21 AM

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)

#11 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 19 April 2012 - 11:48 AM

Make sense, Thanks!

#12 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 19 April 2012 - 09:03 PM

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.

#13 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 19 April 2012 - 11:26 PM

yeah, I ran into that problem :wacko:

#14 Stainless

    Member

  • Members
  • PipPipPipPip
  • 610 posts
  • LocationSouthampton

Posted 20 April 2012 - 09:16 AM

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.

#15 Alienizer

    Member

  • Members
  • PipPipPipPip
  • 440 posts

Posted 23 April 2012 - 11:57 PM

View PostVilem Otte, on 18 April 2012 - 10:29 PM, said:

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!

#16 Vilem Otte

    Valued Member

  • Members
  • PipPipPipPip
  • 362 posts

Posted 25 April 2012 - 12:32 PM

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).
My blog about game development (and not just game development) - http://gameprogramme...y.blogspot.com/

If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D

#17 jlippo

    New Member

  • Members
  • Pip
  • 7 posts

Posted 09 May 2012 - 06:08 PM

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

#18 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2757 posts

Posted 10 May 2012 - 06:38 AM

who cares if its noisy, ao looks awesome anyway even with the noise.
you used to be able to fit a game on a disk, then you used to be able to fit a game on a cd, then you used to be able to fit a game on a dvd, now you can barely fit one on your harddrive.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users