Clay: Blur AO

Authored by Marcelo Mutzbauer (1xundoredo) on Sep 16 2017, 7:31 PM.



One way to reduce noise for ao occlusion is to do blur the occlusion values.

8 Samples, Blur-value:0

8 Samples, Blur-value: 2

With this patch, this can be done by using the 'Blur' slider below the sample control. (defaults
to 2, 0 means no blur)

The way this is done currently is by splitting up the 'clay' pass (which uses clay_frag.glsl) into two passes:
One that does the occlusion checks and stores them into the color buffer(r: cavity, g: edges).
We then blit the color buffer into a temporary texture and use it for the second pass, which does the actual
materials and blurs+applies the ao from a texture.

As a result of this, we have to draw the scene 3 times. Doing deferred shading would solve this, but I don't
know whether there are any changes to the material system on the radar, in which case it would probably be
better to wait first.

Another solution would be to do the depth prepass and AO pass in one go, however that would still mean have
to draw the scene twice. Also, we'd have to do unnecessary ao calculations where triangles overlap on the screen.

Diff Detail

rB Blender
Build Status
Buildable 830
Build 830: arc lint + arc unit

The implementation in itself is clean but:

  • There is some leftover blank lines.
  • As you said adding another pass and the necessary blit are not great for performance. (and people are already complaining about performance of it already)
  • we DO plan to move to defered rendering for the clay engine.
  • Doing a box blur in 1 pass is really inefficient. Also you should note that doing a simple box blur will add artifacts on depth discontinuity.
  • If optimisation is the goal, you should check "Practical Realtime Strategies for Accurate Indirect Occlusion" and do what they do to reduce noise (2 pass bilateral upsampling, lower resolution AO computation etc, temporal smoothing).
  • Also this patch adds another parameter (we try to avoid that as much as possible) to what should be a very straight forward engine. This option does not impact the "look" of the render but the performance and I think it's not really necessary.