Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Specular not see map with SurfaceOutputStandardSpecular light mode

Discussion in 'Shaders' started by bloodrayne21, May 14, 2019.

  1. bloodrayne21

    bloodrayne21

    Joined:
    Mar 24, 2015
    Posts:
    18
    Specular not see map with SurfaceOutputStandardSpecular light mode. _Smoothness value change reflect of all model, ignore specular map.



    Code (CSharp):
    1. Shader "Custom/Dissolve Specular" {
    2.     Properties{
    3.         _Color("Color", Color) = (1,1,1,1)
    4.         _MainTex("Albedo (RGB)", 2D) = "white" {}
    5.         _Specular("Specular",  2D) = "white" {}
    6.         _BumpMap("Normal Map", 2D) = "white" {}
    7.         _Smoothness("Smoothness", Range(0,1)) = 0.5
    8.     }
    9.  
    10.  
    11.         SubShader{
    12.             Tags { "RenderType" = "Opaque" }
    13.             LOD 200
    14.  
    15.             CGPROGRAM
    16.  
    17.             #pragma target 3.0
    18.             #pragma surface surf StandardSpecular
    19.  
    20.             sampler2D _MainTex;
    21.             sampler2D _Specular;
    22.             sampler2D _BumpMap;
    23.  
    24.             struct Input {
    25.                 float2 uv_MainTex;
    26.                 float2 uv_BumpMap;
    27.                 float2 uv_SpecMap;
    28.             };
    29.  
    30.             half _Smoothness;
    31.  
    32.             fixed4 _Color;
    33.  
    34.  
    35.             void surf(Input IN, inout SurfaceOutputStandardSpecular  o) {
    36.                 fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
    37.  
    38.                 o.Albedo = c.rgb * _Color.rgb;
    39.  
    40.  
    41.                 o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
    42.  
    43.  
    44.                 o.Specular = tex2D(_Specular, IN.uv_SpecMap);
    45.                 o.Smoothness = _Smoothness;
    46.  
    47.                 o.Alpha = c.a;
    48.             }
    49.             ENDCG
    50.         }
    51.             FallBack "Diffuse"
    52. }
     

    Attached Files:

    • 1.png
      1.png
      File size:
      459.6 KB
      Views:
      545
  2. bloodrayne21

    bloodrayne21

    Joined:
    Mar 24, 2015
    Posts:
    18
    fix with this
    Code (CSharp):
    1. o.Specular = tex2D(_Specular, IN.uv_MainTex;);