Collada plugin for After Effects

More info here
Plugins and Scripts

Lightwave

Autodesk MatchMover Import for LW11

Lightwave 11.6 python script for importing an XSI vbscript file exported from Autodesk MatchMover.

April 17, 2014

Blender Particle Conversion for LW11

Lightwave 11.6 python script for converting Blender particle cache files to a Lightwave particle pfx file.

Tutorial Link: Blender SPH Fluid Particles to Lightwave
June 2, 2014

Blender Fluids Importer

Lightwave 11.5 python script for loading the files generated by the Blender fluids simulation. It reads the geometry, velocity and particles information to generate a series of lwo files.

Tutorial Link: Blender Fluids to Lightwave
June 29, 2013

Box Shape for LW11

Lightwave 11.6 python script for creating a custom box shape with a non-modal interface. It will show in the Object Properties, Add Custom Object list as "Python Box Shape".

March 02, 2014

Info Panel for LW11.6

Lightwave 11.6 python script for displaying and modifying an object name and transform values.

March 05, 2013

HDR to Lights

Lightwave 11.5 python script used to call the medianCut script written by Steve Twist for 3DWorld Issue #134 based on Paul Debevec's Median Cut Algorithm (Debevec 2005). It reads a HDR image and creates a set of lights based on the image.

March 05, 2013

Fix Exported Collada for LW11 python script

The Fix Collada export script is a Lightwave 11 Python script that is run on a LW exported Collada file to clean it and add camera and light animation. The script also fixes some issues with material exports.

April 8, 2012

Fix Collada Import python scripts

The Collada Import Fixer Layout script is a Lightwave 11 Python script that is run on a Collada file to read camera and light data. This script will read the camera X fov or Y fov and the corresponding fov animation, light color and spotlight angle with animations and ambient light value without animations. Reads material textures from the collada file.

The Make Collada Spotlight Readable Layout script adds some Lightwave Core extra tags so that Lightwave will recognize a spotlight and import it.

August 31, 2012

Some python notes

sys.version - shows python version

message box

  • import lwsdk
  • lwsdk.LWMessageFuncs().info('Hello World', None)
    • alert level medium ->status line
    • alert level high -> dialog box

help(lwsdk.LWMessageFuncs.info)

help(lwsdk)

dir(lwsdk)

double click line in output window to populate command line

July 26, 2013

Sequence Object Surface Loader python script

right click the link above to download

object sequence surface copy

Use this LW 11.5 script to copy the surface of one object onto a sequence of objects. It can be used with the Blender Fluids importer to resurface the sequence of lwo files. The sequence of files must have their number padded with zeros and the number must be just before the ".lwo"

The files are read in one by one and the surface from a source mesh is copied into the sequenced mesh and then the mesh is saved to disc with the new surface applied.

November 8, 2013:

  • Permanent fix for item name crash
  • No need to disable the sequence
  • Progress dialog added
  • Final version until a method can be found to load a surface from disc without causing a crash

November 6, 2013:

  • Found major reason for crash - quick temp fix with error message
  • Works with other object file types(.obj)

Dialog items:

  • Object Replacement -
  • copy surface from - mesh that holds the replacement surface
  • sequenced object - one of the meshes in a sequence of lwo files that will receive the new surface assignment
  • First frame - start frame for the animation range
  • Last frame - end frame for the animation.  If both First and Last frame are left at -1 the script will automatically determine the correct values for the entire range

Notes:

  • filename can have only one '.' just before the extension
  • filename sequence digits must be before the '.'
  • filename extension must have 3 letters
October 26, 2013

Square python script(11.6)

right click the link above to download

Demonstrates mesh creation in modeler

Lightwave 11.5 version

March 12, 2012

Log Spiral python script

right click the link above to download

log spiral log spiral ui

The Log Spiral script is my second experiment with Lightwave 11's Python scripting.  The original code is from an article in 3D Artist magazine Issue #49 by Petr Sorfa for the Hash Animation software package.  The script can be run from the the Utilities tab > Python.  It can also be linstalled like an Lscript or plugin by using the Utilities > Add Plugin in which case it will show up under the Utilities > Additional list under the name "Python LogSpiral".

March 12, 2012

Morph Sequencer script

Lightwave lscript for converting a a series of morphs into a morph sequence. The script creates intermediate morphs that can be added to the final morph at set intervals to simulate a morphing sequence.

Usage:

  1. type number of morphs to use - the first morphs listed will be used
  2. type a prefix name for the new intermediate morphs
  3. choose morph order from the drop down lists
  4. choose whether interpolation is linear or not(no effect on the last morph)
  5. press ok to generate the intermediate morphs and the expressions to drive them
  6. copy the expressions to a temp location
  7. in layout: copy the expressions to the corresponding morphs
  8. final result: intermediate morphs are driven by the final/last morph values to create a sequential morph action
February 26, 2010

Poly Chain to Curve script

Lightwave lscript for converting a 2 point polygon chain to a curve. Right click the link to download the script. Install this script to modeler to use the multiple poly chains to curves script below.

Usage:
Set a background layer to receive the new curve. Select the first point of the polygon chain in the foreground layer then run the script. A curve based on the poly chain will be created in the background layer.

Multiple Poly Chains to Curves script can be used to call the poly chain to curve for multiple selections. Right click to download.

Usage:
The "single poly chain to curve" script above must be installed to modeler before using the "multiple poly chains to curves" script. Set the background layer to receive the new curves and select the first point of each of the 2 point poly chains in the foreground layer. Run the script and it will call the "single poly chain to curve" script for each point selected.

Note: Converting many poly chains can take time.

February 12, 2010

Place Camera FOV animation on a null's transform

Lightwave collada does not export camera field of view(FOV) animation. This lscript transfers the animation to the position and rotation of a null so that whatever program reads the Lightwave collada file can reconstruct the camera animation. Right-click the link above to download the script(save target as/save link as). Place the script in the lscripts folder, "...Program Files\NewTek\LightWave 3D 9\Plugins\lscripts\animate", for easy access.

Usage:

  1. Animate the camera zoom
  2. Create a null and add the lscript, "camFOVtoTransform", via the motion options, motion modifiers.
  3. Double click the "FOV Motion Mod" to open the dialog. Set the scale you intend to use when exporting the collada file and select the camera from the list. When you push OK another null will be created that has it's controllers set to follow the first null. If you don't select a camera the null will not be created and only the scale will update.
  4. The new null's rotation and position will change to follow the camera's zoom.
  5. Add a key at frame zero for this null so that motion baker will see it properly. If you don't add the key then the position keys won't bake properly.
  6. Add a Motion Baker modifier to the new null
    1. check "Use existing..."
    2. check "Overwrite keys"
    3. check positions XYZ and rotations HPB
    4. In Lightwave preferences be sure "Play at Exact Rate" is unchecked.
  7. Play the animation to bake the keys before exporting the collada file

null camera fov bake dialogs

X and Z position will contain the zoom values for x and y stored in the collada file x and z. Multiply by the composition height in After Effects to get the corresponding After Effects zoom value.

lw camera zoom graph lw cam null fov graph

Image shows the camera zoom animation and the corresponding horizontal and vertical zoom animations created for After Effects.

pick whip camera zoom

Inside After Effects:

  1. Import the collada file to using the same scale used for exporting.
  2. Go to the camera settings and change the "Measure Film Size" to Vertically.
  3. Alt click the Zoom stopwatch to activate expressions.
  4. Use the pickwhip to link to the position z value of the camera null. The position information is actually stored on the parent of the camera null(Camera_FOVKF_Yr). Items imported from Lightwave always have a "_Yr" parent so that After Effects can use Lightwave's rotation order.
  5. Multiply the resulting expression by the composition's height.

Pitch and Bank will contain the x fov and y fov in degrees which translates to x and z rotations in the collada file.; The signs are set so that they are positive when imported to After Effects using the AECollada plugin.

October 14, 2009

Place Light animation on a null's transform

Lightwave collada does not export light color or spotlight cone angle animation. This lscript transfers the animation to the position, rotation and scale of a null so that whatever program reads the Lightwave collada file can reconstruct the light animation. Right-click the link above to download the script(save target as/save link as). Place the script in the lscripts folder, "...Program Files\NewTek\LightWave 3D 9\Plugins\lscripts\animate", for easy access.

Usage:

  1. Animate the light color and/or cone angle
  2. Create a null and add the lscript, "lightConeColorToTransform", via the motion options, motion modifiers.
  3. Double click the "Light Attr Motion Mod" to open the dialog. Select the light from the list.  When you push OK another null will be created that has it's controllers set to follow the first null. 
  4. A new null now exists and  it's rotation, position and scale will change to follow the light's cone angle and color.
  5. Add a Motion Baker modifier to the new null
    1. check "Use existing..."
    2. check "Overwrite keys"
    3. check positions XYZ, scale XYZ and rotations HPB
    4. In Lightwave preferences be sure "Play at Exact Rate" is unchecked.
  6. Play the animation to bake the keys before exporting the collada file

lightwave light graph lw light null graph

Image shows the animation graph for a spot light and the null created by this script. The scale null values are too small to see here because After Effects uses a 0 to 100% for scale instead of 0 to 1.0

The rotations HPB will each contain a copy of the light's cone angle. Color will be stored in the scale values and position will also contain the same color data. However, the position for color is only valid if the scene is exported with the default 0.01 scaling. The signs are set so that they are positive when imported to After Effects using the AECollada plugin.

lw light bug

lw light bug fixed

First step after importing to After Effects is to fix the light type. Lightwave exports spot lights as point lights.

light vals from null

Image above shows the resulting expressions from pick whipping values from the light null's scale and xRotation values. The scale of the Lightwave export is not an issue.

light values from parent

This image shows the result of pick whipping cone angle and color to the light null's parent(Light_LITKF_Yr). The collada file was exported at a scale of one and so the color expression had to be divided by 100 as shown.

Use the pickwhip to link the animation to the corresponding light.

October 14, 2009

SubD UV Preparation script for Lightwave

Lscript that converts subd uv's into an clean format for eps export. Right click on the link to download the script.

subpatch frozen subd prep
default subd eps export, frozen mesh eps export, "subd preped" eps export

Usage:

  • Save the object file to insure it's safety.
  • Set the uv subpatch interpolation to "Subpatch".
  • Run the script.
  • Export the UV by using the EPS export.

The script copies the geometry to a new layer, assigns a unique surface to each face, freezes the mesh and combines the polygons based on their surface.

March 27, 2010

Doom3(idtech4) Plugins for Lightwave 11

A set of 5 python scripts for importing and exporting Doom3 skeletal mesh and animation files. Right click on the links below to download the python scripts.

February 22, 2014:

  • reversed LW11.5 changes in mesh import for compatibility with LW11.6
  • mesh and animation export has the option to use bone creation order or heirarchy order
  • script version number shows in the ui title
  • fixed rotation flipping problem in the animation exporter

August 8, 2013:

fixed mesh import for python changes in LW11.5

right click the links below to download

md5meshimport.py - load md5mesh files into modeler

md5skeletonimport.py - select the mesh in layout and use this script to load the corresponding skeleton. Any other meshes can be set to use bones from the main mesh. Keyframes for the basic skeleton pose are set at frame -10.

md5animationimport.py - select the mesh portion of the skeletal mesh in layout and run this script to load an md5anim skeletal mesh animation.

  • Match file frame rate - set Lightwave frame rate to match that of the md5anim file
  • Start Frame - imported animation will start on this frame

md5skeletalmeshexport.py - export a skeletal mesh in md5mesh file format

  • Base Pose Frame - frame that contains the skeletal mesh bind pose
  • Export in bone creation order - default of unchecked seems to work for all cases. when checked  bones are exported in the order they were created, otherwise they are exported in heirarchy order

md5animationexport.py - select the mesh portion of the skeletal mesh and run this script to export an md5anim animation file.

  • Base Pose Frame - frame with the bind pose
  • Start Frame - animation start frame
  • End Frame - last frame of the animation
  • Export in bone creation order - default of unchecked seems to work for all cases. when checked bones are exported in the order they were created, otherwise they are exported in heirarchy order

The advantages over the original plugins are

  • fixes the mesh mirror problem
  • runs on 32 or 64 bit versions of Lightwave
  • skelegons are ignored
  • weight map names do not have to match the bone names
  • surfaces do not need to be assigned manually
  • full md5mesh shader names are imported
  • no limits on the number of bones.
  • helper null is deleted after export is completed
  • gives a warning if the mesh isn't made of triangles

Meshes still import with Z up, so a workflow for imported and Lightwave original Doom3 assets needs to be developed.

The base pose for animation export should proabably be a copy of the first frame of animation. The difference between the base pose and any animation frame is what gets recorded into the file.

Click here to go to the old Doom3/Quake import export plugins page for 32bit Lightwave 8 and 9 plugins. The original plugin usage notes can be helpful with the python versions here.

April 22, 2012

Collada Weight map loader scripts and program

Lightwave lscript and executable for loading weightmaps from Collada files so that bones will bind to the proper vertices. daeSkin2weight.exe reads a collada file and creates a text file in the same location. the text file contains the weight map information. daeSkinLoad.ls is an lscript to read the text file generated by the daeSkin2weight program and assigns the vertices to their weight maps. boneweightmap.ls is a layout script that sets the selected bones to use a weightmap with the same name as the bone.

Usage:

  1. if the collada file does not load properly into lightwave, load it into blender3d(2.5 alpha) and export a new collada file
  2. run the daeSkin2weight program and open the collada file. a text file will be created with the same name as the dae file but with a txt extension
  3. load the collada file into layout to get both mesh and bones
  4. load the resulting lwo file into modeler and run the daeSkinLoad script to load the weightmaps from the text file
  5. load the updated object back into layout
  6. run the boneweightmap script to assign the weightmaps to the corresponding bones

Note:

The executable won't work for files that have spaces in their path. so it won't work in paths like "C:\Program Files" or "C:\Documents and Settings\All Users"

source code - uses visual studio 2008 and the colladadom2.2 sdk

May 04, 2010
June 6, 2013