How to tell Cycles to not include transparent shaders in AO calculations?

I am working on a project which has a lot of little logos and decal stickers stuck to the objects. The stickers are just square planes with an image texture controlling the alpha, and are joined into the main mesh using separate material slots.

The issue is that the main material I am working uses the Ambient Occlusion node, and even though most of each square is transparent, it still counts as “occluded,” by the AO node, leaving an outline around each sticker. Here’s a quick example in a test file:

Is there any way to turn off AO for transparent materials, or use something like the Light Path node to subtract out the bad bits of AO?

I tried messing around with the Light Path node a little already and got close, but still had an outline due to the fact that it was only counting camera rays that passed through the transparent shader, not the ones slightly around it that were still included in the AO calculations.

I thought about using the “Only local,” option, and separating out the stickers, but considering all the different moving parts of the main object it would be a ton of extra work to go back through and update all the shots that are already mostly done. I’ll do it if I have to, but I would rather not if possible.

Here is a simple example blend file of what I am talking about:
example.blend (474.5 KB)

Hmm, yes, apparently AO ignores the material of obstacles. The obvious idea would be to bake AO without the front plane. You would have to split it out into a separate object for that.

Otherwise, if you could explain what the purpose of the using AO inverted is, what’s the look you want to create, we might come up with an alternative idea for the material setup.

That’s a shame. Thanks for looking into it though.

Most of the stickers are actually pretty simple shapes now that i look at them, and it’s all just linked data, so I might actually just model simple shapes that eliminate the overflow.

I was just using the AO inverted because it was more visible. In the actual project I’m just using it to shift to a darker, less reflective material.

I made it work. Somehow.

Nevermind. It didn’t work. Sorry

… …

1 Like

Have you tried Geometry>Pointiness? The manual claims its a way to generate dirtmaps, and it seems with a simple test that it responds to transparency. The man page:

and a node setup:

@a59303 that would be a fantastic solution, except “pointiness” relies on geometry in the calculation. I mainly work with meshes provided to me that were generated with Autocad software, meaning really ugly meshes that don’t work well with the pointiness effect.

Thats unfortunate.