Can I view full built in shader source?

When writing shaders in Unity it is often useful to view the built in source. Problem is that a lot is going on under the hood, which forces you to dig through the cginc files and compiled shaders. Is there any way I can get to the full cg source? Ie after all the surface shader boiler plate has been added but before the shader is optimized and compiled to the platform specific formats?

Thanks, Bas

http://unity3d.com/unity/download/archive

–Eric

Thanks, but those are just the surf functions, I’m looking for the surf functions along with all the surface shader boilerplate, ie the bulk of the code. Some of which can be found in the various cginc files, but reconstructing a functional shader is a very painstaking process of piecing together the surf functions, snippets from the cginc files, and manually decompiling gles shaders to recreate the actual vert and frag programs.

In Unity, select a surface shader and click “show generated code” in the inspector. You’ll see all the passes and a lot of the compiled Cg. They still make reference to stuff in Lighting.cginc, AutoLight.cginc, UnityCG.cginc, but you won’t be left guessing what any of the intermediate parts are.

1 Like

Ahhh, I missed that little button, thanks so much