Cg Programming/Surface Shaders

From Wikibooks, open books for an open world
Jump to: navigation, search


Unity's Surface Shaders provide a simplified way of programming Cg shaders by automatically adding shader code for lighting and shadow computations such that programmers only need to specify material constants.

An introduction to Cg and Surface Shaders is provided by the Noobs Guide to Shaders in Unity Gems.

Another introduction to Surface Shader scripting with several video tutorials is available at Unity Cookie.

If you already know Cg, the shader examples in Unity's documentation and the source code of built-in surface shaders are very useful to understand Surface Shaders.


< Cg Programming

Unless stated otherwise, all example source code on this page is granted to the public domain.