September 7, 2010

Maya Realtime Shaders – Big Update

Up to date downloads are available here: Download Page
I’ve been reading alot of technical papers and was inspired to rewrite and double check all my shaders.  First, some things were broken for example, ambient color was not doing what its supposed to do.  Second, I finally understood the whole linear-lighting thing and all my rgb inputs have been appropriately gamma corrected.  With linear lighting, tonemapping and exposure become much more useful, so I implemented a simplified version of the Uncharted 2 “film-tonemap curve”.  Third, I wanted to make it easier to do rewrites and maintain the code, so i switched the way I was working with multiple lights and inspired by rsl illuminace loop am now doing my lighting through a loop.  This means I can change the code without having to worry about the number of lights or keeping track of their variables and passing them to all needed functions.  I only have to initialize an array to hold that information.
lcUberShader.cgfx and lcNextGenShader.fx are now visually the same although slight differences in the languages are apparent in the code.  I still recommend using cgfx over hlsl for Maya.
lcSkinShader.cgfx and lcHairShader have few changes beyond linear math option and code style changes.  Some attributes have been removed or rearranged - especially with the lcSkinShader, old posts with attribute descriptions may no longer apply.
lcLitSphere.cgfx is an implementation of matcap/lit sphere shading – just for fun and in case anyone is interested.
Pictures: (click for larger)
shaderCompare_A[1]

hairShaderComparison[1]
litSphereImage[1]