I've been developing a mel script to make it easier to create/assign/interact with hlsl and cgfx shaders in maya.
Linking lights, changing light colors, making sure you have the correct .mll's loaded - providing an easier interface for managing lights.
I made this originally for my fellow production artists at work - so they would actually use the CGFX/HLSL shaders that mimic our game engine - because otherwise its a bit complicated to set them up (artists are picky and fickle I know!)
It should work with any CGFX or HLSL shader as long as certain conditions are met, these are:
light attribute names should be as follows - 'light1Dir' or 'light1Pos' and 'light1Color'
ambient color/light attribute on the shader should be - 'ambientColor'
(why no light intensity? light color value can easily be overdriven to accomplish the same thing)
Works with up to 3 directional or point lights (mix and match)
Download:lcRTShaderTools.zipSample Shaders for testing:lcUberShader.cgfx - this my flagship CGFX shader for Maya
lcNextGenShader_1.3.fx - more interesting shader written in HLSL (deprecated in favor of lcUberShader.cgfx)
I've done as much testing as I can reasonable stand on this script - I don't make any promises but myself and my fellow artists have found it helpful.
Eventualy I'll get around to translating my HLSL shaders to CGFX and adding fancy features.
If you like writing mel scripts please feel free to use this script as a starting point or inspiration.
Replies
Thx
Download link is the same - on the first post.
Added a check-box to turn off by default the Ambient Color control across all shaders - this was useful for my coworkers because our shaders are very simple - but for more complex shaders it was annoying. there is an opportunity here for more contextual control (change ambient color only on selected geo) maybe in a future release.
Download link is the same in first post.
Because of issues when you scale your lights I have added an internal 'Visual' scale
This doesn't change any 'scale' transform attributes, it moves the lights and scales their locators giving the appearance of scale increase.
Download link is the same in first post.
@Pale-Face
Thanks for the kind words - if you liked my hlsl .fx shader try my brand new lcUberShader.cgfx