Search Unity

Standard Shader emission checkbox

Discussion in 'Shaders' started by ArachnidAnimal, Aug 29, 2017.

  1. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,837
    Using 2017.1, the standard shader now has a checkbox for "emission".

    emission.jpg

    The manual does not discuss this checkbox.
    https://docs.unity3d.com/Manual/StandardShaderMaterialParameters.html

    Is this now some type of optimization to uncheck "Emission" if the material is not emissive?

    What is the difference between unchecking "Emission" vs having it checked with black emission color?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    You could just look at the shader code ...
    Code (CSharp):
    1. half3 Emission(float2 uv)
    2. {
    3. #ifndef _EMISSION
    4.     return 0;
    5. #else
    6.     return tex2D(_EmissionMap, uv).rgb * _EmissionColor.rgb;
    7. #endif
    8. }
     
  3. HyunMok_Moon

    HyunMok_Moon

    Joined:
    Oct 14, 2016
    Posts:
    24
    I have also question.
    How can I Emission checkbox in standard shader, enabled via script?
    In runtime, I want to Emission checked in script.

    material.EnableKeyward("_EMISSION")?

    I tried but it didn't work.
     
  4. Seyed_Morteza_Kamaly

    Seyed_Morteza_Kamaly

    Joined:
    Nov 18, 2015
    Posts:
    80