/****************************************************************************** Copyright Alex Hogan, 2006 The author accepts no liability from your use or misuse of the content provided here. Use at your own risk. Description: This is a quick example shader that will work in Maya 7.0 and output an unlit, user-defined color. ******************************************************************************/ // globals from Maya float4x4 worldMatrix : World; // World or Model matrix float4x4 wvpMatrix : WorldViewProjection; // Model*View*Projection float4x4 worldViewMatrix : WorldView; float4x4 worldViewMatrixI : WorldViewInverse; float4x4 viewInverseMatrix : ViewInverseTranspose; float4x4 ViewInv : ViewInverse; float4x4 wvIT : WorldViewInverseTranspose; float4x4 viewMatrix : View; // tweakables float3 inColor < string UIName = "inColor"; string UIWidget = "Color"; string Type = "Color"; > = { 0.0, 0.0, 0.1}; // structures and shaders ///////////////////// struct a2v { float4 Position : POSITION; //in object space }; struct v2f { float4 Position : POSITION; //in projection space }; v2f BlinnMVS(a2v IN) { v2f OUT; OUT.Position = IN.Position; float4 Pobject = float4(IN.Position.xyz,1); float4 Pworld = mul(worldMatrix,Pobject); OUT.Position = mul(wvpMatrix,Pobject); return OUT; } float4 BlinnMPS( v2f IN ) : COLOR { return float4( inColor, 1.0); } //////// techniques //////////////////////////// technique BlinnM { pass { DepthTestEnable=true; DepthMask = true; DepthFunc = LEqual; VertexProgram = compile arbvp1 BlinnMVS(); FragmentProgram = compile arbfp1 BlinnMPS(); } }