March 30, 2010

lcMrBatchBake.mel v.1.5

Updated Here

This update to my Mental Ray texture baking script streamlines some of the code and adds some minor features.

You can now type in the Output Directory with less fuss – the script will parse forward and backward slashes – and will create the necessary ‘lightMap’ folder if it is not present.

Added a button to open the selected (from the dropdown list) bake set in the attribute editor.

Created a handy shelf icon.

icon_lcMrBatchBake lcMrBatchBake.bmp

Download: lcMrBatchBake.mel

March 12, 2010

lcCamTools.mel

This exposes some simple attributes about the currently active camera to the user in a small interface.  It avoids having to dig around in the attribute editor.  The attributes in the script will update for the current camera when the script window is given focus (clicked on).

Download:
lcCamTools.mel
lcCamTools.bmp (shelf icon)

lcCamTools

lcUberShader_1.2.cgfx

Goals:
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.

Download:
lcUberShader_1.2.cgfx
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)

Known Issues:
* 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.

Examples of the Shading Techniques and Options (click for full res)
lcUberShader_sphereLineup 
(click for full res)
lcUberShader_attributes

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.

lcRTShaderTools.mel v1.2

This script makes it easier to interact with HLSL and CGFX shaders in Maya.  It performs shader naming, creation/sourcing, light linking, and other helpful tasks.

This update adds light rig scaling – depending on how a hlsl or cgfx shader is coded, scaling your lights can result in incorrect lighting.  The ‘Light Rig Scale’ attribute moves the lights and scales their locator handles to give the visual impression of a ‘scale’ operation.  (you can Ctrl+MiddleClick and horizontal drag this box to interactively scale).

Known Issues:
CGFX and HLSL shaders will only work with this script if their light position/direction and light color attributes are named properly in the shader file.
Convention: light attribute names should be as follows - 'light1Dir' or 'light1Pos' and 'light1Color'
ambient color/light attribute on the shader should be – 'ambientColor'

Download:
lcRTShaderTools.zip (includes shelf icon)

lcRTShaderTools