2.91 - Displacement from ambient occlusion


I am trying to achieve procedural displacement which is based on ambient occlusion, meaning it will displace geometry based on its proximity to other objects.

The image below shows that the texture was made using a plane and a cube. This plane is wavy when displacement output is directly connected to the noise texture (“displacement only” under material settings), but it flattens as soon as I multiply it with the AO.

According to the texture pattern on the plane it should be working, as it works with bare “value” from the noise texture. Shouldn’t the plane be displaced by a fixed 0-1 amount, as the AO factor is also probably in that range?

Only muting the multiply node shows that the texture itself does displace the plane.

1 Like

This is not good idea. AO not suitable to Displace.

Don’t use Invert. Use “Subtract” (1 - AO) and check “Clamp”.

This is a situation where I would expect there to be effects from hidden operation order inside of Blender.

What causes ambient occlusion? Geometry. So Blender needs to know your displacement before calculating ambient occlusion.

If you want to use (pre-displacement) ambient occlusion as a parameter for displacement, consider baking AO to an image texture.

@Hikmet - what is the difference between invert and 1-AO? Does the invert node change the output from a “factor” value to an “image” value?

@bandages - I figured baking the texture and displacing it would be one way, but as I said I am trying to take a procedural approach.

You guys think it would be possible if we had a separate displacement node we could precalculate “some displacement” to, and then mix in the AO?

I don’t know how work “Invert” node but sometimes produce invalid results. If I use with Greyscale images or I use sRGB, then I usually don’t use “Invert” node. “Invert” node only works right with Non-Linear RGB.

I don’t think it will be possible, not without a bake, no.

I don’t know what else you’re being told here. There’s nothing wrong wtih invert-- it’s just a three channel 1-n, clamped, it’s fine, there is absolutely no difference between what you’re doing and what you’re being told to do. You can do some basic testing on these if you have any doubts and want to see for yourself. I just used combine, separate RGB and some greater/less than math nodes to make sure before I said anything.