BakedVertexColorLighting

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Removing all content from page)
m (Reverted edits by Joseph05408 (Talk); changed back to last version by NeARAZ)
Line 1: Line 1:
 +
Author: [[User:Joeante|Joachim Ante]]
  
 +
==Description==
 +
Similar to builtin Lightmapped/Vertex Lit, but this uses lighting baked into vertex colors instead of a separate lightmap texture. Any additional Unity lights add on top of baked lighting.
 +
 +
Works on dual texture graphics cards (NVIDIA TNT2, ATI Rage 128 and up).
 +
 +
==ShaderLab - BakedVertexColorLighting.shader==
 +
<shaderlab>Shader "Baked Vertex Lighting/Vertex Lit" {
 +
Properties {
 +
    _Color ("Main Color", Color) = (1,1,1,1)
 +
    _SpecColor ("Spec Color", Color) = (1,1,1,1)
 +
    _Emission ("Emmisive Color", Color) = (0,0,0,0)
 +
    _Shininess ("Shininess", Range (0.01, 1)) = 0.7
 +
    _MainTex ("Base (RGB)", 2D) = "white" { }
 +
}
 +
 +
SubShader {
 +
    Pass {
 +
        Material {
 +
            Diffuse [_Color]
 +
            Ambient [_Color]   
 +
            Shininess [_Shininess]
 +
            Specular [_SpecColor]
 +
            Emission [_Emission]   
 +
        }
 +
        Lighting On
 +
        SeperateSpecular On
 +
        SetTexture [_MainTex] {
 +
            constantColor [_Color]
 +
            Combine texture * primary DOUBLE, texture * constant
 +
        }
 +
    }
 +
       
 +
    Pass {
 +
        Blend One One
 +
        Lighting Off
 +
 +
        BindChannels {
 +
            Bind "Vertex", vertex
 +
            Bind "TexCoord", texcoord
 +
            Bind "Color", color
 +
        }
 +
 +
        SetTexture [_MainTex] {
 +
            Combine primary * texture
 +
        }
 +
        SetTexture [_MainTex] {
 +
            constantColor [_Color]
 +
            Combine previous * constant
 +
        }
 +
    }
 +
}
 +
}
 +
</shaderlab>

Revision as of 19:26, 19 October 2009

Author: Joachim Ante

Description

Similar to builtin Lightmapped/Vertex Lit, but this uses lighting baked into vertex colors instead of a separate lightmap texture. Any additional Unity lights add on top of baked lighting.

Works on dual texture graphics cards (NVIDIA TNT2, ATI Rage 128 and up).

ShaderLab - BakedVertexColorLighting.shader

<shaderlab>Shader "Baked Vertex Lighting/Vertex Lit" { Properties {

   _Color ("Main Color", Color) = (1,1,1,1)
   _SpecColor ("Spec Color", Color) = (1,1,1,1)
   _Emission ("Emmisive Color", Color) = (0,0,0,0)
   _Shininess ("Shininess", Range (0.01, 1)) = 0.7
   _MainTex ("Base (RGB)", 2D) = "white" { }

}

SubShader {

   Pass {
       Material {
           Diffuse [_Color]
           Ambient [_Color]    
           Shininess [_Shininess]
           Specular [_SpecColor]
           Emission [_Emission]    
       }
       Lighting On
       SeperateSpecular On
       SetTexture [_MainTex] {
           constantColor [_Color]
           Combine texture * primary DOUBLE, texture * constant
       }
   }
       
   Pass {
       Blend One One
       Lighting Off
       BindChannels {
           Bind "Vertex", vertex
           Bind "TexCoord", texcoord
           Bind "Color", color
       } 
       SetTexture [_MainTex] {
           Combine primary * texture
       } 
       SetTexture [_MainTex] {
           constantColor [_Color]
           Combine previous * constant
       } 
   }

} } </shaderlab>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox