14
$\begingroup$

How to connect ambient occlusion texture with principled BSDF?

$\endgroup$
  • 3
    $\begingroup$ Could you better explain what you mean by "connect" What effect you would like to achieve? $\endgroup$ – Carlo Feb 18 '18 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$ – metaphor_set Feb 18 '18 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 Feb 19 '18 at 9:25
13
$\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.

| improve this answer | |
$\endgroup$
  • 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 Mar 28 '19 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$ – hatinacat2000 Jul 15 at 5:09
10
$\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:-

| improve this answer | |
$\endgroup$
  • 1
    $\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 Mar 21 '18 at 16:53
  • 2
    $\begingroup$ OP's question was "How to connect ambient occlusion texture". The other texture was for example only. $\endgroup$ – Retrax Mar 21 '18 at 16:57
5
$\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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.