Pages

Showing posts with label mel. Show all posts
Showing posts with label mel. Show all posts

May 25, 2011

lcShaderTools.mel–v2.3

Download

Updated to let you interact with my new CGFX shaders featuring point lights.

lcShaderTools

August 26, 2010

lcMrBatchBake.mel – Mental Ray for Maya Texture and Vertex Baking

Download - Updated – 08/27/2010
Script: lcMrBatchBake.mel
Icon: icon_lcMrBatchBake lcMrBatchBake.bmp

NOTE: Apparently this script doesn't work on the Mac, I don't have one to test with so you guys are out of luck sorry.'

Now you have the option to bake vertex color as well as texture maps.  This is great for baking ambient occlusion to vertices for game models.  I also consolidated and simplified a lot of the code. Plus now its colorful!
lcMrBatchBake_1.7

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

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

February 20, 2010

lcRTShaderTools.mel

Maya Real Time Shader Tools Mel Script

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.zip

lcRTShaderTools

Sample Shaders for testing:

lcBasicShader.cgfx - this is a testing/stub shader written in CGFX
lcNextGenShader_1.3.fx - more interesting shader written in HLSL

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.

October 27, 2009

lcUVMover.mel

lcUVMover.zip (script and icons)

Lets you move around your uv’s with precise numerical values – also lets you work in non-square aspect ratio UV space for scale and rotation operations – normally the rotation manipulator doesn’t work properly in non-1:1.

check readme.txt for instructions

run with command – lcUVMover;

lcUVMover

October 16, 2009

lcSubDivCalc.mel

lcSubDivCalc.mel

Opens a small window – type a number in the first field (polycount) – the rest will auto-fill with polycounts calcuated at 8 additional levels.

Why? because if you can build your mesh at a certain polycount to start you can optimize the number of polygons you can work with in Zbrush depending on your RAM.

lcSubDivCalc

January 22, 2009

lcCCMesh.mel

lcCCMesh.mel

Adds the CCMesh Toggle to a Mental Ray Subdiv Approximation Node.
To use: select one or more SubdivApprox nodes in the Outliner (uncheck show DAG objects only) or Hypershade and run the command lcCCMesh

if you use the old style ccmesh mode, your mesh must be all quads or all tris, cannot use a combination or you will get errors.

July 1, 2008

yet another Fake IBL

lcFakeIBL.mel

This one is very 'beta', use at your own risk

Creates a dome of lights who's color is based on the texture sampled from a sphere

Set the number of lights - more are neccessary for more detailed lighting, for example if you use a file texture.

Create the Sphere first, adjust its shader/texture to your liking as well as scale.

With the sphere selected, create the lights with 'Add Lights/Remake Lights'. if you change the spheres shader or texture you have to remake the lights.

adjust the 'Intensity Multipyer' to increase or decrease the intensity of all the lights.

A helper node called IBL:HelperNode is created by the script, with all the adjustable attributes, so the script interface is not neccessary to adjust the lights.
This node can be selected by unchecking 'show DAG objects only' in the Outliner.

PS: the code for the mental ray vertex color baking is probably the most interesting part of this mel script and exploring that was one of the main reasons for writing this script

Source Script - a mini dev utility

lcSourceScript.mel

type the name of a script - must be located in one of the maya script paths, such as 'my documents/maya/scripts/'
You can source it, or source and run it. This is useful when writing scripts with an external application and lets you update and test your changes.

lcSourceScript

3 new mel scripts

lcTransferAttr.mel

Use this script to transfer uv infromation from one object to any number of duplicates. objects must have the same point order. Select the targets first, select the source object last. Type lcTransferAttr to run.

lcFixNormals.mel

This script performs an important cleanup operation on geometry that is mirrored using -1 scaling. After scaling an object, if you freeze the transforms, a funny thing happens, the 'opposite' attribute will be activated so that even though the surface normals are flipped, the object displays correctly. It would be better to set the display attributes correctly and flip the normals to their proper orientation. This script flips the normals and adjusts the attributes of objects with the 'opposite' attribute activated. Select your geometry, type lcFixNormals to run.

lcMakeDisp.mel

Select an object, enter a name and press 'Make it' to run. creates a shader and corresponding shading network on the selected object setup for displacement mapping. also creates and assigns corresponding Approximation Nodes.

Mental Ray Batch Bake

Updated Here


This utility gives an easy to use interface for mental rays texture baking abilites - bake shaders, lighting, shadows to a texture file.


You can create a bake set with a custom name, and it will be assigned to the currently selected objects.

bake sets from the current scene will be listed in the 'Sets' list. You can assign more objects to the set or select the objects currently in the set.

to view the set and its objects in more detail open the Outliner, select a set and check its attributes in the Attribute Editor to set resolution and file type.

Bake Camera is only neccessary in certain situations and can be left alone or set to the rendering camera

Bake Shadows is neccessary for shadows or Ambient Occlussion

File Output Directory: by default goes to the current project in 'Project'/renderData/mentalray/lightMap

specify your own directory such as D:/textures
(make sure you use forward slashes '/')
this directory must have a folder 'lightMap' already created. So the full path would be D:/textures/lightMap

Big Bake It button executes the render, be aware it can take some time.

If there is a problem with the interface, sets dont show up in the list, Reset the interface with the 'Reset' button.