Correct ways to apply AO texture?

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.

AO is supposed to be just a very soft shadow from ambient light.

I think we’re missing the point.. The AO node is not related to illumination, but some measurement of geometry…

(basically a white furnace with no bounces)

There’s no problem to use it to fake some shadows or change some colors, or whatever. It’s good to have.

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.

Additionally to @Secrop “missing the point” perspective..

The question may not be how to generate some AO texture but or some asset in some exchange format without shader info:

How to set up a “correct” shader when there is a AO texture attached to the object but no info about the shader setup ?

Well, doesn’t that depend on what the original artist’s intended use of the AO map was?

I was asking this because i’m not sure about the meaning of the question:

  1. apply it “correctly” as the artist to properly bake the tetxure

as mentioned in this discussion or

  1. “apply” the AO-texture to some no fully “known” shader setup..

as a “user” of some asset with some already backed.

Properly for both is some knowledge needed, but maybe to “only setup the (almost) best ( or correct) way to (re-)build / up the shader nodes” there is “only” some more general knowledge needed.

Some may think this (the “meaning” of the question) is irrelevant because you have to know “all this” anyway. But i often discovered that there are more than one aspect to any subject, so i’m simply curious about the different answers… so it’s totally of egoistic curiousity because i’m always eager deepen (or expand) my knowledge, or to learn something knew :grinning_cat_with_smiling_eyes:

( And i forgot to like all the answers until now.. so doing it now :sweat_smile: )

Can’t tell if there’s a question or some advice there, but ok. :wink:

It’s a question because:

So my “idea” is more:

Do one needs to know “everthing” about AO to re-create the artists-intended application of the map (so one needs to know the origianal application) or more a “general” unstanding of AO so that one even might dispose the map and use some actually used render engine feature..

I have often seen artists doing some “basic shading” to while furtehr more refineing their models then use another (specialist) app to bake and or add the materials and shader setups and then finally importing these in some game engine for representation and even fine tune some settings in those.

In this case it was the same artist and (s)he seems to know what is needed but i also saw artists to use “some asset” and fine tune some basic imported shaders or recreate them from scratch and so the alos seems to know a lot about it to achieve a certain look, especially when the also have the “origianl” application installed (or have a lot of in-game images) and can compare thise while using their “shader knowledge”.

tl;dr
What’s the correct way at all when one is not the “original author”. Or mre specific for example: is an AO texture map even really needed for every use case at all ?

Or is it “simply” → experience. So one “just sees” that there is something wrong and so adjust it accordingly ? Then the answer is : it depends.. :winking_face_with_tongue:

Multiply. Multiply whatever is giving the material color by the AO map or some amount of it. That’s it. AO is useful for many things like making dirt, dust, rust and so on, but then nobody ever calls the maps “AO” if they are only made using AO as a tool. If it’s “AO” it’s about ambient light, the maps represent soft shadows from the surrounding environment and they are supposed to make those shadows darker.

Certainly not. Why would you even say that? :laughing: If we are talking in the context of path tracing, that’s just an ancient technique used to fake global illumination from the times it was not practical to calculate more precisely. We don’t even use the term “global illumination” that much, it’s just the norm now. It’s still useful for real-time rendering and exaggerating shadows of surface detail, but that’s that. It’s just an option…

Just search for “how to bake AO map” and restrict the search to the last month.. so if this is not needed why soooooooo much people want to learn about this.

So this just “proves” my “questioning/challenging” about the context :laughing:.
It may depend on the render engine.

The OP has noticed:

And finds it hard to believe that this is the intended use :laughing: But it is. It’s just an overlay that does not interact with the lighting in the scene - that’s it. That’s correct. :laughing: That’s what AO is.

…but by that logic AI is the thing that you need right now as well. For everything as well :laughing: :laughing: :laughing: There must be something not entirely accurate about that… I can feel it. :laughing:

Multiply is probably what the original author intended, indeed. But it’s still not “technically correct” to apply it to anything related to direct lighting. I’m no expert, but I would think realtime renderers apply AO in a more correct way; affecting precalculated lookup environment. Think what “ambient” means; ambient light that is simply added to the shader back in the old days, but would also attenuate reflections from probes. I haven’t tried, but with the new raycast node, it might be possible to mimic how we did things in order to blend local (real, possibly limited to screen space) reflections with an environment probe, where the AO was used to dim the specular. Not real, by any stretch of the imagination, but “easier on the eye” compared to sharp transisions.