Faking AO in a different way.

After a recent discussion in a thread on faking Ambient occlusions. I wanted to know if anyone of you graphic programmers out there think this could be a plausible method of faking AO:

I was thinking of a method like “Sphere Masks” inside the material but instead of having only one sphere mask as an influencer in the material we could potentially have multiple ones (maybe the collision objects?" act as sphere masks on a character and we could use that to drive a simple multiplier on other materials we wish the “AO” to take affect on and this sort of makes it appear like there’s some form of contact shadowing going on.

While I don’t expect something like this to work universally on every object but at the very least the hero objects in the game could have a setup like this one that would work pretty well regardless of any dirty post process effects.

After all if it visually seems to be working well with one spherical mask right now why wont it with multiple capsule shapes on the whole body? What do you think?

I’m not sure I fully understand what you’re proposing, but this sounds quite similar to the way capsule indirect shadows work for characters, and how distance field indirect shadows work for static meshes. The main difference I notice is that those approaches take into account some directionality rather than being purely ambient.

Yes somewhat similar to capsule shadows but the problem with capsule shadows is that it requires you to have baked lighting as well as actual lights in the scene. the method I’m proposing works without any lights in the scene. Consider VR and mobile applications as well as stylized lighting scenarios for games that don’t need real time lighting to take place in the engine and should be fully dynamic.

What you are referencing to are ambient occlusion decals and are already widely practiced.

Yes its like decals I guess, or more like placing individual decals on key parts of the body and joints. But i want to exclude the actual body from being affected by it, it should only affect everything else around it, I haven’t tested if you could exclude objects from decals yet.

Unfortunately Decals of the modulated sort which is necessary for shading areas don’t work in UE4 yet outside lit scenes. I have submitted a report and heard back from Epic that they are looking into this.

Anyway I guess if that’s fixed then I could try placing decals on the body and try and see if i could fake AO with special masks, I really don’t like the current AO in UE4 besides can’t really use it with Forward renderer even if it did work.

Ambient occlusion decals work just fine in 4.22

Unfortunately no those don’t work at all in unlit scenes. Here’s a link to my previous post.

I did a quick search looks like thislink was doing something similar. Will investigate a bit more.

If it’s a small amount of spheres/ellipsoids/capsules, yes, it’s possible. Basically, you keep a list of the shapes positions and params, then for each pixel you compute the distance to each shape and use the minimum distance to calculate the AO. If the number of shapes is fixed and small, you can pull this off with only the material graph, but it’s best done using custom nodes. The positions and params for each shape can either go into a material collection or a texture (you’d need to see which one works best in your target hardware).

Hey Thanks Manoel, I’m thinking of a character model so its not fixed but moving, you will have the key sections, hand joint, arm joints, one body and legs/feet. So lets assume anywhere between 6 to 14 capsules.

It will be great if you could point to some tutorials or notes if you know of any as to how to achieve this?