UnlitAlpha

From Unify Community Wiki
Revision as of 20:53, 29 December 2005 by NCarter (Talk | contribs)

Jump to: navigation, search

Author: Neil Carter (NCarter)

Description

This shader is useful for sprites and other billboards that shouldn't be affected by lighting and should be visible from both sides. Note that alpha testing is used instead of blending, which means partial transparency is not possible - texels are either completely opaque or completely transparent. On the other hand, it's much faster than blending.

Usage

Place this shader somewhere in your Assets folder hierarchy, create a material which uses it and apply it to the relevant objects.

ShaderLab - UnlitAlpha.shader

<shaderlab>Shader "UnlitAlpha" {

   Properties
   {
       _Color ("Main Color", Color) = (1,1,1,1)
       _MainTex ("Base (RGB) Trans. (Alpha)", 2D) = "white" { }
   }
   Category
   {
       ZWrite On
       Alphatest Greater 0.5
       Cull Off
       SubShader
       {
           Pass
           {
               Lighting Off
               SetTexture [_MainTex]
               {
                   constantColor [_Color]
                   Combine texture * constant, texture * constant 
               } 
           }
       } 
   }

}</shaderlab>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox