O'Reilly logo

Unity 3 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix D. Shaders and Cg/HLSL Programming

This appendix presents a brief overview of the structure of surface shaders and Cg/HLSL programming.

Shaders in Unity can be written in one of the following three different ways:

  • Surface shaders will probably be your best bet. Write your shader as a surface shader if it needs to interact properly with lighting, shadows, projectors, and so on. Surface shaders also make it easy to write complex shaders in a compact way—it's a higher level of abstraction. Lighting for most surface shaders can be calculated in a deferred manner (except for some custom lighting models), which allows your shader to efficiently interact with many real-time lights. You write surface shaders in a couple of lines of Cg/HLSL and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required