Remove URP Screen Space Ambient Occlusion on specific layer gameobjects

I have an interior scene in my game, and while ambient occlusion enhances realism, certain game objects close to the camera, such as the chessboard, box, and cup, appear overly dark. I’m seeking guidance on how to selectively remove ambient occlusion for these objects. How can I achieve this?

1 Like

Also wondering if there is a way to omit certain objects or materials from receiving SSAO.

Hi! Here’s a solution:
9859917--1420272--Capture d’écran 2024-05-28 211024.png
In this image, the cube is on a layer we’ll call “IgnoreSSAO”
The sphere and the floor are on the default layer. (I cranked up the SSAO so it’s visible between the sphere and the floor.)

You’ll need to open your Renderer asset.
Right at the top of the inspector, under “Filtering” > “Opaque Layer Mask,” disable your “IgnoreSSAO” layer.
This should make the objects on that layer disappear. Which is good!

The “Ignore SSAO” layer will be rendered through a separate RenderObject (sorry, I haven’t looked into RenderGraph yet, so if you’re using Unity 6 you might get a warning telling you that RenderObjects are obsolete…)

“Add Renderer Feature” > “Render Object”
The setup for the render object is really simple: under “Filters” > “Layer Mask,” just assign your “IgnoreSSAO” layer.

In the context of a very simple scene at least, that was enough to make it work!

1 Like

It works perfectly ! Thanks for your help .

1 Like

Perhaps you can also refer to this. It provides the DirectLightingStrengthWeight parameter to control each object’s ambient occlusion effect on direct lighting.

  1. go to \your_project\Library\PackageCache\com.unity.render-pipelines.universal\Shaders
  2. find whatever shader you want to use (if you want lit then find Lit.shader, if unlit then Unlit.shader etc.)
  3. make a copy of it
  4. find _SCREEN_SPACE_OCCLUSION pragma keyword
  5. comment it or remove
  6. create a material out of this modified shader and its done

image