Search Unity

Is Adding emission to this shader posible

Discussion in 'Shaders' started by melonhead, Aug 26, 2020.

  1. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    problem now solved please remove this thread

    thank you
     
    Last edited: Aug 27, 2020
  2. MatheusMarkies

    MatheusMarkies

    Joined:
    Apr 16, 2017
    Posts:
    67
    Properties:
    Code (CSharp):
    1.      
    2.         [NoScaleOffset] _EmissionMap("Emission", 2D) = "white" {}
    3.         [HDR] _EmissionColor("Emission", Color) = (0.0, 0.0, 0.0, 0.0)
    4.  
    Emission map.
    Emission color with HDR range.

    Code (CSharp):
    1.  
    2. TEXTURE2D(_EmissionMap);
    3. SAMPLER(sampler_BaseMap);
    4.  
    5. //Pixel Shader:
    6.  
    7.     float4 map = SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, i.baseUV);/*Get emission map from a sample texture*/
    8.     color += (map.rgb * _EmissionColor.rgb); //Return color + Emission
    9.  
    10.      return color;
    11.  
     
  3. MatheusMarkies

    MatheusMarkies

    Joined:
    Apr 16, 2017
    Posts:
    67
    Code (CSharp):
    1.  
    2. Properties {
    3.  
    4.        [NoScaleOffset] _EmissionMap("Emission", 2D) = "white" {} /* <--- TEXTURE */
    5.        [HDR] _EmissionColor("Emission", Color) = (0.0, 0.0, 0.0, 0.0)  /* <--- COLOR */
    6.  
    7. }
    8.  
    You are using a Surface Shader, add emission to the surface (o.Emission).
    https://docs.unity3d.com/Manual/SL-SurfaceShaders.html

    Code:
     
    Last edited: Aug 27, 2020
  4. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    thank you, would you please now delete the code from the posts as it was a purchased shader