Search Unity

Question How to override Ambient Color for single objects?

Discussion in 'Universal Render Pipeline' started by Bordeaux_Fox, May 28, 2022.

  1. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Hi,

    I'm looking for a way two have some objects in my scene render with a different Ambient Color than the default in Lighting / Environment settings. Basically, I want to capture some objects in a Render Texture. They should look like they where captured in a "neutral" room. But since I have a moving sun, the objects will reflect the night time colors. So, the objects in the render texture should always have a grey ambient color and just ignore the time of day ambient color of the regular scene. My findings so far: If I set the "Ambient Occlusion" node in Shadergraph to zero, they will render just with a black ambient color. Maybe there are some hidden internal shader properties to override this.
     

    Attached Files:

  2. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Bump. Any solution? :)
     
  3. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    509
    Hi. I guess using unlit shaders is not a solution and I'm assuming you need physically based shading, maybe you could fake the shading with local reflection probe + lightprobes. Not sure if those lightprobes can be manipulated in any way by script or prevent them from rebaking with the scene.

    Another solution would be a custom shader that has a fixed ambient light.
     
    Bordeaux_Fox likes this.
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Thanks for the reply! Yes, I actually need the URP Lit Shader. So it seems you cannot have "two" ambient colors in the same scene or some sort of override :(. My solution is to quickly overwrite the ambient color via a script, then render the offscreen 3D inventory items, then switch back to the default sky ambient colors during the same frame.