Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity 5 Surface Shader - Ambient issue

Discussion in 'Shaders' started by MaT227, Oct 27, 2014.

  1. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Hey everyone,

    I am trying the new Unity 5 and it is really great but I am facing an issue when using Surface shader. As the issue is the same when using the Legacy Diffuse shader I'll talk about this issue using this shader.

    If I apply the Legacy Diffuse shader, the material uses the ambient light defined in the Scene Render Settings. But if I turn my object static, it uses the Indirect lighting provided by the Global illumination AND the ambient light setting defined in the Scene Render Settings which gives a too bright result.

    I would like to know how can I turn off the ambient light when the object is static ?

    Thank you !
     
  2. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Did you try a separate surface shader with the noambient option applied?
     
  3. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Yep, noambient deactivate real-time ambient lighting, but I think that creating two shaders is not the good solution. And the Unity 5 Default shader handles this correctly.
     
  4. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    I haven't tried Unity 5 myself yet. It's just my experience that the legacy lightmapped shaders in Unity 4 should have noambient applied to fit in with shaders without a light map.

    This double ambient lighting in Unity 5 when marking static might actually be a bug. Usage of global illumination should turn of the fixed ambient term.
     
  5. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    I didn't know that lightmapped shaders should have noambient in Unity 4.
    It seems that this is the same behaviour in Unity 5 but the strange thing is that it's handled in the Default shader. I searched in the built-in shaders but I didn't found anything relevant.
    Maybe @Aras has an explanation about it. :)
     
  6. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Well, that's just my opinion. I've made my own lightmapped shaders with noambient, because that way I can combine lightmapped with non-lightmapped. It does seem the issue is similar in Unity 5.