20
$\begingroup$

How to connect ambient occlusion texture with principled BSDF?

$\endgroup$
3
  • 4
    $\begingroup$ Could you better explain what you mean by "connect" What effect you would like to achieve? $\endgroup$
    – Carlo
    Commented Feb 18, 2018 at 22:08
  • 3
    $\begingroup$ Without knowing all the sufficient information, the only correct answer would be: There is no need for Ambient Occlusion in the Principled Shader, because it defines the material and not the object's interaction with light. $\endgroup$ Commented Feb 18, 2018 at 22:28
  • $\begingroup$ ...as any other texture? AO is a "world" shadowing fearure, and it can be baked to an image. Use that image as any other texture. $\endgroup$
    – m.ardito
    Commented Feb 19, 2018 at 9:25

3 Answers 3

19
$\begingroup$

You don't connect it at all. The lack of an AO input on Cycles' Principled BSDF node is not an oversight. See my answer here about what AO is and is not for: Adding Ambient Occlusion to Material

Ambient occlusion is so-named because it is occlusion for an "ambient" light type. Cycles does not really have an ambient light, at least not one that accepts pre-cache occlusion data. (the world AO effect is technically an ambient lamp, but it is the only one, and as of 2.79 it always samples its own occlusion on the fly, never from a texture). Since there is no ambient light, shaders have no need to define shading for it.

If you want to use AO data for mesh-dependent texturing effects, you should do these while authoring the texture, that way you do not need to load a separate AO map at render time.

$\endgroup$
2
  • 2
    $\begingroup$ Still useful for effects in procedural textures, though, especially in NPR.. but then, you probably wouldn't be using the Principled Shader $\endgroup$
    – Robin Betts
    Commented Mar 28, 2019 at 18:19
  • $\begingroup$ Ditto, I need to keep light from illuminating a throat texture. People need to fake "black-hole" effects sometimes. If AO is the wrong name for that, oops, but I think the application is obvious and it's not wrong to want to cheat physically accurate renders $\endgroup$ Commented Jul 15, 2020 at 5:09
13
$\begingroup$

The above answers are only partially correct. While it's correct that You don't want to apply ambient occlusion via a texture to your diffuse/base color the truth is that we still need ambient occlusion as a separate texture. Here's the reason:

Ambient light from your HDRI has no way to accurately remove itself from details created via a texture map! Say you have something small like panels lines or skin pores... From certain angles and lighting conditions these need to not receive as much light due to self shadowing. Often times it's much more efficient to produce these smaller details in a texture. Proper lighting for these small details will ONLY happen if you have a very detailed displacement map active with enough subdivisions on the model to properly describe the surface. But what about the cases where you want to avoid such a dense scene?

Many game engines use AO textures as a separate input channel for this exact reason (we even use this technique in VFX!).

When call of duty first went full PBR everything looked like it was covered in Vaseline because the specular lighting would shine even in the cracks of our normal map details. This was the reason behind implementing a "cheat" for details that didn't exist in the geometry.

TLDR: Details that cannot be efficiently created in geometry still need self shadowing which cannot be accounted for without a seperate AO channel to remove the inaccurate diffuse and spectacular lighting cast by the HDRI. Keep in mind that the AO channel in a shader should never effect direct lighting cast by area lights and spot lights.

$\endgroup$
12
$\begingroup$

enter image description here

Use this node setup, setting up AO in principled is the same as any other node.

The AO in this node setup basically does two things:-

  1. Determines the colour of the AO. As you can see the color of the AO is plugged into the Mix RGB node. I additionally added a color ramp to intensify the AO effect.

  2. Determines the distribution. In this node setup the Alpha of the AO is used to determine the distribution, as the AO is being Overlayed on the diffuse texture. Similarly, you can use the AO texture to control the distribution of other additional shaders or just use it directly.

Blendfile:-

$\endgroup$
2
  • 2
    $\begingroup$ This is not how you use AO. AO is AMBIENT occlusion. There is no ambient light, and thus you don't need occlusion for it. If you want to overlay your AO on diffuse as a texturing effect, that's one thing, but there's no reason to do it in-shader in this case. Pre-combine them in an image editor so you only need to load 1 map. $\endgroup$
    – JtheNinja
    Commented Mar 21, 2018 at 16:53
  • 2
    $\begingroup$ OP's question was "How to connect ambient occlusion texture". The other texture was for example only. $\endgroup$
    – Retrax
    Commented Mar 21, 2018 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .