Boned Models with Lightwave
Thanks to the efforts of Petterms and others, some of the mystery has been removed from the process of creating Shockwave3D models with bones. Traditionally, it's been difficult, since the Lightwave Exporter is a bit finicky and buggy, but you can get fairly reliable results for creating boned models which can be animated using Lingo.
Requirements for Exporting Bones to Shockwave3D From Lightwave
- You need to create a weight map for each bone, including a default root bone. For every vertex, the total values of the weight maps over all bones need to add up to 100%. (See below for some helpful tips on achieving this.)
- Do not bother setting up skelegons in Modeler. Instead, create your bones in Layout.
- When you create your bones in Layout, open the bones properties panel for each of your bones and turn on the "Use Weight Map Only" option, and select the weight map for that bone. Turn "Weight Normalization" off unless you aren't changing bone lengths, and leave "Multiply Strength by Rest Length" off. Click "Bone Active" to turn it on.
- Your bones take their initial orientation and position from the first frame, regardless of the properties settings, so make sure your first frame has the bones layout you want.
- Bones should never share weightmaps. You should have a one-to-one relationship between bones and weight maps.
- Unlike some earlier assertions, you don't need to have each point set to 100% on only one bone. You can spread the percetage across multiple bones if you like, such as having a vertex with 25% influence from one bone and 75% influence from another. (But they do need to add up to 100% over all bones.)
- If you get bad results when you import your .w3d into Director, try quitting all Lightwave applications, re-launching them, re-loading your scene, and exporting again. Sometimes, the internals of Lightwave get flakey, and stop exporting correctly.
Helpful Scripts for Creating Bones in Lightwave
Lightwave has a programming language embedded in it called "LScript." When you find yourself doing many redundant and tedious things in Lightwave, it's usually a good candidate for creating an LScript to do the work for you.
Below are some LScripts that I've found useful for modeling boned models for Shockwave3D. To use them, download them (you may need to do a "Save As" operation) to your hard drive to someplace handy for Lightwave work. Then, you can either call them manually using the Utilities » LScript command, or you can use the Utilities » Add Plugins command to add them to your system, add them to the Map » Weight menu using the Edit » Edit Menu Layout command, and then create keyboard shortcuts for them using the Edit » Edit Keyboard Shortcuts command. I recommend the latter, because as you start using bones, you'll start to use them more often.
Map Details - Editing Multiple Weight Maps at Once
Given that all your weight maps for a particular vertex must add up to 100%, you will find yourself switching between multiple weight maps, making edits and checking values as you go. To make this process easier, you can use this Weight Detail LScript.
To use it, select some points on your model and run the Weight Detail script. You will be presented with a dialog box containing all the weight maps you currently have defined and the amount of weight you've assigned to each map for those points.
If the points have different weights maps assigned, then the default values for the amounts in the dialog boxes will be the average values across all points, so this is a quick way to average the weight values over points if you want.
If you don't cancel the dialog box, it will apply the new weights for those vertices according to what you type in for the weight maps. If you set up this script on a key command, this is a very quick way to assign weights to your maps, check that they add up to 100%, and edit multiple map values at once.
Download Weight Detail
Recommended Keyboard Shortcut: Alt/Option D (for "Detail")
Map Analysis - Checking and finishing your map
Once you have set all your bone weight maps, you'll want to check that they all have 100% bones associated with them before exporting it from Layout. You can use the Weight Analysis LScript to make this easy for you.
To use it, run the Weight Analysis script. You are given a choice of a map to put the analysis into (I'd recommend creating a temporary one called "Analysis" or something), and then a choice of what to put into the map.
- Analysis
-
The Analysis option is designed to help you find problem areas on your model, anyplace that the model's points on the weight maps does not add up to 100%. When you run this analysis, it set the weight map that you select to be 100% (red) for vertices which have over 100% total weight assigned to them, -100% (blue) for vertices which have under 100% total weight assigned to them, and 0% (normal) for vertices that are correctly set to a total of 100%. It will leave out the map that you are adding the analysis to.
For instance, suppose there were several vertices which you hadn't gotten around to setting weight map values for - they add up to zero. If you run this script, the weight map you select would be set to look like this:
This lets you easily see which points still need work. All the blue vertices indicate areas with less than 100% weight allocated to them. If there were red spots, they would be places where we had gone over our allotment of 100%.
- Leftovers
- The Leftovers option is designed to help you "finish" your model by cleaning up the leftovers. If you go through and assign weight map values to your model, you can have this script take whatever remains and place it into another weight map. Where vertices don't add up to 100%, the weight map selected will have the balance assigned to it. Where vertices add up to more than 100%, the weight map selected will have a negative value assigned to it (not recommended). This is good for assigning the values for your "root bone", to catch all the vertices you didn't assign weight values for elsewhere.
One quick note of caution for using this Lscript - be sure you clear out any weight maps that do not represent weight maps for bones before using this Lscript, or you could get erroneous results. In particular, you'll want to clear out any weight maps that are the result of earlier analysis operations.
Download Weight Analysis
Recommended Keyboard Shortcut: Alt/Option A (for "Analysis")
BlurVMaps - Blurring weight maps
I can't take credit for this one, since it comes from Mike Green, but it sure comes in handy for making smooth-acting weight maps.
To use it, select the weight map(s) you want to blur, and the script does the rest by blurring the weight map values to surrounding vertices. If you are getting hard creases where you don't want them, or if your vertices need to move more smoothly, this script is for you.
(I'm archiving the script here for my own purposes, but you should probably go to Mike Green's site to ensure that you are downloading the latest version.)
Download BlurVMaps
Recommended Keyboard Shortcut: none - you don't need it that often