Hello. Is there correct way to apply ambient occlusion texture to shader?
The most popular one is using multiply node, which is not correct, it acts as overlay that doesn’t interact with lighting in any way.
Another way is using “Shader to RGB” node, whichin theory should apply AO texture in a way that letting it interact with lighting, in practice it presents it’s own issues.
Another one is applying AO texture via compositor, which is cumbersome imo.
So… is there any way to use AO texture in a way, that let it interact with lighting. I need to to preview how ORM texture looks like in Blender before loading it into the engine + scenes that I render
In Cycles, AO is just a surplus, as the renderer does AO by default. In Eevee, there’s also AO calculation done by the renderer (thought in screen space).
Normally, using AO is usefull to create certain shading effects (like discoloration, some occlusions attenuations, etc). That’s why you have a Color and a Factor output, and not a Closure, which lets you use AO information in any way necessary.
The AO node is a helper node, so there’s not a “Correct way” to use it.
No. Ambient occlusion is not a real phenomenon. It’s only an approximation of stuff not getting lit by ambient lighting when it’s close to other stuff. Use it any way you like as an artistic effect.
Unfortunately there’s no way to tell Cycles to shade something differently when it’s lit. This area of rendering is in motion, though: material lighting nodes or radiance stylization might let you do that more easily in the future.
There is an exception to this, which is in the case a set of textures comes with an AO map. In that case, it’s used to fake the darkness in the recessed areas of the texture, as that doesn’t get the real light calculations (unless you use true displacement).
I think that’s the thing being discussed here.
In theory, the best way to apply a pre-existing AO texture would be for it to appear only in shadows and not on directly lit areas of the mesh. There is no way to do that in Cycles unless you involve compositing and mix 2 renders.
The best way would be not to use AO at all and calculate real light interactions - real shadows. AO is just an approximation based on the idea that if something is close to something else, it’s less likely to receive light because the light is probably blocked. AO has nothing to do with calculating actual lighting. Calculating actual lighting in Cycles replaces the need for AO. At least it’s supposed to. It’s sometimes not enough and using AO may help atchieve desired look easier. Using AO with multiply is the most common thing to do and it makes most sense, because it’s supposed to represent blocked light and make things darker. I think that’s pretty much all there is to it. Either use AO or look for more accurate ways to calculate light…
I know that and I am not disagreeing with you, but AO is often included with sets of texture and can act as a generic approximation that’s independent of the lighting conditions. The discussion here is about AO textures, I am merely saying how it’s meant to be used if it’s included.
Sometimes the AO bitmap is used as a mask (as-is or tweaked with other nodes) to simulate rust, dust, discoloration, grease, and similar phenomena.
In such cases, its usefulness is not in adding “black” to your textures but to actually mask other shaders to mix with the base shader. It’s often applied modified by ramps, inverted… with all sorts of tweaking to fit your desired result.
Edit: I guess I was quite off-topic from the OP question. I’ll leave the answer here anyway since even for games the AO bitmaps are used like this, and backed, for game engines.
This is not necessarily the case. Just because an object is lit by a light, does not mean it cancels out a shadow from another. It all depends on strength. in other words - multiplying is fine.
I fully agree with the answer you gave earlier and have said the same to some users in the past. But here, we are talking about AO textures, not the AO node. Either that, or the original post is worded weirdly, because “AO texture” isn’t the same as rendering with AO as lighting.
Lots of PBR texture sets you find online include an AO texture and this confuses people who often don’t know what to do with it. It tends to be included as a cavity pass that matches the features of the texture itself. This offers more customization than if they had included that info as part of the color texture directly.
I agree that using AO directly on the geometry is a downgrade compared with actual lighting.