Search Unity

Disable Specular Highlights/Reflection in surface shader

Discussion in 'General Graphics' started by lolun, Apr 21, 2020.

  1. lolun

    lolun

    Joined:
    Nov 25, 2014
    Posts:
    16
    In the standard shader, there are these 2 options to check "Specular Highlights" and "Reflections". I am writing my own surface shader with standard lighting and I can't figure out how to implement these 2 options. Specifically, I want to disable environment reflections while still enabling ambient lighting. I've tried:
    Setting "Reflection Probes" to "Off" on my MeshRenderer does nothing. Setting SurfaceOutputStandard.Occlusion to 0 in my shader disables both ambient lighting and environment reflections.
    Adding
    #define _SPECULARHIGHLIGHTS_OFF 1
    to my shader does nothing.

    Is there a tag or define somewhere? Is this even possible? I'm on Unity 2019.2.11
     

    Attached Files:

  2. joaocarrion

    joaocarrion

    Joined:
    Oct 14, 2015
    Posts:
    6
    Hello, not sure you ever find a solution, but I had the same problem and this solved it to me, I found it on the standard shader code.

    Code (csharp):
    1.  
    2. Properties {
    3. ...
    4.   [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
    5. ...
    6. }
    7.  
    8. Subshader {
    9. ...
    10.         #pragma target 3.0
    11.         #pragma shader_feature_local _SPECULARHIGHLIGHTS_OFF
    12. ...
    13. }
    14.  
     
    ecv80 likes this.