Search Unity

Unity 5 - Surface Shaders

Discussion in 'Shaders' started by MaT227, Sep 29, 2014.

  1. MaT227

    MaT227

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

    I would like to have more precisions about Surface Shaders (and shader developement in general) in Unity 5. I would like to know how the new coming features will be accessible and handled.
    I am talking about the new Global Illuminations or Reflection Probes features for example.

    Thank you very much.
     
    Last edited: Sep 29, 2014
    Project-Mysh likes this.
  2. Project-Mysh

    Project-Mysh

    Joined:
    Nov 3, 2013
    Posts:
    223
    For the moment, all I know for surface shaders using unity 5 Standard PBL is:

    You have to include "UnityPBSLighting.cginc":
    Code (CSharp):
    1. #include "UnityPBSLighting.cginc"
    Then define "Standard" lighting model:
    Code (CSharp):
    1. #pragma surface surf Standard
    The output model:
    Code (CSharp):
    1. struct SurfaceOutputStandard
    2. {
    3.     fixed3 Albedo;        // diffuse color
    4.     fixed3 Specular;    // specular color
    5.     fixed3 Normal;        // tangent space normal, if written
    6.     half3 Emission;
    7.     half Smoothness;    // 0=rough, 1=smooth
    8.     half Occlusion;
    9.     fixed Alpha;
    10. };
    And here you are. Reflection probes and GI works automatically with "Standard" model. For the moment, I dont know how to enable Metallic workflow output model.
     
    Last edited: Dec 30, 2014
  3. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Thank you for your great answer. What about custom lighting :)
    I'am going to take a look at the Built-in Shaders, it should be interesting.