1. Create a useful Maya viewport shader with many interesting functions and techniques to showcase a wide range of surfaces.
2. Write a Shader with a compartmentalized structure that is easy to read and dissect for people learning the basics of shader code.
This shader is quite large and complex and because of the decision to compartmentalize much of the code into distinct functions it is not performace optimized.
You must link 1-3 directional lights into the light slots at the bottom of the attribute list – I would recommend you use my lcRTShaderTools.mel to interact with the shader.
lcBasicShaderComponents.cgfx (this is a basic stub shader for people learing cgfx and wanting something simpler to start out)
BasicTextures.zip (some basic textures for use with the lcUberShader – don’t quite remember where they all came from – thank you to the original creators)
* Although I provide 8-bit alpha support, Maya has transparency sorting issues when in this mode.
* Because there are so many attributes the Maya Attribute Editor can sometimes momentarily stall when updating/opening or switching techniques
* Only 1 input is available for an environment cubemap (this serves for both reflections and ambient color) – the shader assumes this cubemap is a properly filtered cubemap made with ATI’s CubeMapGen tool and that it has mipmaps
* When you are in Toon or LitSphere Techinques the shading color will be multiplyed by the Diffuse Texture, you can scale the contribution of the Diffuse Texture with the Diffuse Color Attr – but you cannot tint it.
* Cubemap and Hemispherical ambient color is multiplied by the Ambient Color Attr, it must be something other than black for those effects to show up.
Please use this as inspiration for writing your own shaders, the code is very easy to take apart, rearrange and unfold. I have tried to comment the code in key places of interest. I also included a more basic shader with the same coding structure as a starting point for people interested in learing.