Download

Reading GBuffer AO in material editor

Is it possible to somehow read AO from GBuffer in material editor ?

I wanted to use it for procedural mask generation for blending textures (or at least experiment with it), but it doesn’t look like there is option to access anything beyond depth, and depth is not enough.

AO in gbuffer looks like nice base for to start with, as it is omnidirectional light source and not filtered by directional lighting.

Or maybe someone have some tutorial about creating AO in material editor (ignoring any kind of directional light), I only need AO information as it would be from omnidirectional light source, for masking purposes.

There is SceneTexture, but it doesn’t work with Opaque material.

https://dl.dropboxusercontent.com/u/70400220/Unreal/AO-Information.png

Marked area with right contrast and additional displacment texture cloud be used to procedurally generate mask.

There was a similar question a few days back, James Barnette was looking into using the AO buffer as a mask for the foam in my ocean material, but it doesn’t look like it is all that simple to do.

darthviper responded to the thread with some info, but not a full solution.

If you do manage to get it working I would be very interested to hear how you did it!! :wink:

SSAO (which is what AO GBuffer visualizer shows) is computed from the output of the base pass, and materials are evaluated in the base pass, so that’s a circular dependency.

I guess you could try and draw everything twice, but that’s probably not worth it. Would be neat for procedural texturing, I suppose some pre-baked thing could do as much if you weren’t generating the levels at runtime somehow.

Hmp. I see two options:

  1. Generate AO in lightmap channel and store it as part of mesh (on import).
  2. Generate AO and store it in mesh vertices.

I mena. Both of these can be accomplished in any dcc app.
I guess I will have to deal with vertex baked AO for now, as i’m really not fond of using even more textures and creating unique 827 maerials for each object.

While you can store “AO” in a channel, it doesn’t have to be evaluated as AO. It can be read and textured according to, whatever it is you want to do with it, and then normal SSAO can be applied.