Simply Lit

From Unify Community Wiki
Revision as of 18:04, 26 October 2010 by Jessy (Talk | contribs)

Jump to: navigation, search

Author: Jessy


This is a very basic shader. It just applies ambient and diffuse vertex lighting to your textured model.

You can use this as a springboard to learn to write your own more complex lit shaders; I've created chapter 8 of this series specifically to help you do that.


Drag a single texture onto the material's only variable slot. Adjust the "Ambient Light" to taste, in Unity's Render Settings, and apply any other real-time lights you like. Use Color to alter the way this model looks, after affecting overall scene lighting, if you need to, or just leave it as white otherwise.

As written, the shader allows overbrightening to 2x the value of the texture. This is done with the keyword Double. Change Double to Quad, if you want 4x overbrightening, or just delete the word if you don't want overbrightening at all. (Use only the range you need, as you can more precisely control the lighting with a smaller range.)

Click here to download this shader.

ShaderLab - Simply Lit.shader

<shaderlab>Shader "Simply Lit" {

Properties { _Color ("Color", Color) = (1,1,1) _MainTex ("Texture", 2D) = "" }

SubShader { Lighting On Material { Ambient [_Color] Diffuse [_Color] }

Pass { SetTexture [_MainTex] {Combine texture * primary Double} } }


Personal tools