Search Unity

How does one add Illumination to a shader?

Discussion in 'Shaders' started by FairGamesProductions, Aug 31, 2014.

  1. FairGamesProductions

    FairGamesProductions

    Joined:
    Mar 8, 2014
    Posts:
    81
    I am extremely inexperienced with shader code, but unfortunately I must dive in.
    So, I have this shader that has: Diffuse, Normal, Reflection and Specular. I need to add Illumination to it.
    Code (CSharp):
    1. //Hard Surface Shader Package, Written for the Unity engine by Bruno Rime: http://www.behance.net/brunorime brunorime@gmail.com
    2. Shader "HardSurface/Hardsurface Free/Opaque Specular"{
    3. Properties {
    4.     _Color ("Main Color", Color) = (1,1,1,1)
    5.     _SpecColor ("Specular Color", Color) = (1, 1, 1, 1)
    6.     _Shininess ("Shininess", Range (0.01, 3)) = 1.5
    7.     _Gloss("Gloss", Range (0.00, 1)) = .5
    8.     _Reflection("Reflection", Range (0.00, 1)) = 0.5
    9.     _Cube ("Reflection Cubemap", Cube) = "Black" { TexGen CubeReflect }
    10.     _FrezPow("Fresnel Reflection",Range(0,2)) = .25
    11.     _FrezFalloff("Fresnal/EdgeAlpha Falloff",Range(0,10)) = 4
    12.     _EdgeAlpha("Edge Alpha",Range(0,1)) = 0
    13.     _Metalics("Metalics",Range(0,1)) = .5
    14.  
    15.     _MainTex ("Diffuse(RGB) Alpha(A)",2D) = "White" {}
    16.     _BumpMap ("Normalmap", 2D) = "Bump" {}
    17.     _Spec_Gloss_Reflec_Masks ("Spec(R) Gloss(G) Reflec(B)",2D) = "White" {}
    18.     _Illum ("Illum (RGB)", 2D) = "black" {}
    19.  
    20. }
    21.  
    22.     SubShader {
    23.      
    24.         Tags {"Queue"="Geometry" "RenderType"="Opaque" "IgnoreProjector"="False" }
    25.         UsePass "Hidden/Hardsurface Pro Front Opaque Specular/FORWARD"
    26.      
    27.     }
    28.         Fallback "Diffuse"
    29.     }
    30.  
    I've been searching for a solution all day, and I haven't found anything that could help me.
     
  2. CatchCo

    CatchCo

    Joined:
    Nov 27, 2012
    Posts:
    17
    I don't believe your fallback Diffuse has an Illumination channel. Using a fallback of "Self-Illumin/Diffuse" should fix that.
     
  3. FairGamesProductions

    FairGamesProductions

    Joined:
    Mar 8, 2014
    Posts:
    81
    I don't see any difference.