Using Unity's built-in CgInclude files

Our first step in writing our own CgInclude files is to understand what Unity is already providing with us for shaders. When writing Surface Shaders, there is a lot happening under the hood, which makes the process of writing Surface Shaders so efficient. We can see this code in the included CgInclude files found in the directory that you installed Unity in at Editor | Data | CGIncludes. All the files contained within this folder do their part to render our objects with our shaders on the screen. Some of these files take care of shadows and lighting, some take care of helper functions, and some manage platform dependencies. Without them, our shader-writing experience would be much more laborious.

You ...

Get Unity 2018 Shaders and Effects Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.