LightWave DFF Exporter plugin v0.1
by majestik
majestik@gmail.com
- Features
Brand new exporter for LightWave
Supports San Andreas DFF format with most of the features
Adjustable reflection (0-100%)
Adjustable specular and glossiness (0-100%)
Multiple UV support
Automatic pivot adjustment
Typically, what you see in the viewpoint is what you get ingame
Written in C++
- Limitations
Doesnt export light objects (omni lights - not headlights or taillights)
Doesnt support tri-strips
Doesnt support vertex colors
Doesnt support player models
Doesnt support non-triangles - POLYS MUST BE TRIANGLES!
Doesnt support LightWave smoothing groups
NO LOCKING at the moment
- Installation
Loading the plugin
- Open LightWave Layout (lightwav.exe)
- Click "Add Plugin"
- Browse to "LW Plugins" directory
- Select "lwdff.p"
Adding the plugin to menu
- Click on "Edit" button
- Select "Edit Menu Layout"
- Expand "Plugins" section
- Find "Export to DFF v0.1"
- Drag it to anywhere you want the plugin to appear - I recommend under File->Export menu
- SA DFF Guide
Before you can export your model, it needs to be prepared. The following sections are for cars.
Hierarchy
Some of this preparation can be done in Modeler. Open your model, and rename all the layers properly. Each layer represents a different object, so for example your door_rf_ok must be in a separate layer. You can rename all layers using "Layer Panel", accessible from Windows->Layer Panel in Modeler. DUMMIES ARE ADDED IN LAYOUT. You can also set-up all the materials in Modeler. Once the model is properly named and materials are finished, you can load it in Layout. Here, you can finish the hierarchy by adding Null objects. A Null object represents a dummy. Once you add all the dummies, you can parent everything correctly using the "Scene Editor". If you have trouble with parts moving when you parent them, go to Options (default key: o) and enable "Parent in place" - then the objects wont move when you parent them.
San Andreas generally follows same format as previous GTA games for hierarchy. However there are several changes:
- Objects no longer have "_hi" part in their names - i.e. bonnet_ok instead of bonnet_hi_ok.
- For cars, there are new required dummies such as ped_arm, petrolcap and engine.
- There are also additional dummies such as headlights2 and taillights2 - which can be used for foglights and such.
- For tuning cars, more dummies are needed! ug_nitro, ug_spoiler etc are some of these new dummies.
Lights
San Andreas also uses additional tricks for creating lights. The trick is to map your lights with "vehiclelights128" texture, and use a special diffuse color. Then the game will recognize your lights, and swap the texture at night. The textures used for lights are "vehiclelights128" during day and "vehiclelightson128" during night. Open the sample scene and look at the Materials in the Surface Editor - Lights FR, FL, RR and RL and are the different materials used for lights.
However, you DONT HAVE to use this. If you want your own light texture, you can do it the old fashioned way. However then the light texture wont change since the game will not recognize your light geometry.
Primary/secondary color
Instead of [prim] and [sec], all you do is color the material properly. For primary materials, the color is (60, 255, 0) and for sec materials, the color is (255, 0, 175). ZModeler hides this from the users, but thats how the game _REALLY_ handles primary and secondary colors.
Wheels
There are 2 different ways you can make wheels in San Andreas
Way #1
This is the standard SA way. Make your wheel in a separate layer, and name it "wheel". Parent this object to "wheel_rf_dummy", but not other dummies. The game will clone the wheel ingame, once for each dummy.
Advantages: smaller filesize
Disadvatages: all wheels use same model
Way #2
This is the "custom" way. The trick here is to make your "wheel" object from 1 tiny polygon, and then parent REAL wheels to each dummy. To make the 'invisible' wheel object, simply create one polygon and scale it down so it looks like a tiny dot. This is very similar to the old Wheel Mod, except:
you dont need to scale the wheels to 1.0 size
you dont need to install the wheelmod, since its kind of installed in the DFF itself.
Advantages: different wheels anywhere
Disadvatages: more tedious
You can call the NEW wheels whatever you want, for example "wheel_rf" etc. You will have to make a wheel for each dummy, since the game will not clone anything.
Materials
The following parts of the surface editor are used:
- Diffuse color
- Specular value
- Glossiness value
- Reflection value
- Reflection map (Enviroment tab in Surface Editor)
- Diffuse texture
All other surfaces parameters are ignored
Reflections
San Andreas introduced a slightly different reflection mapping. Basically, there are 2 avaiable options - use "xvehicleenv128" texture or any other texture.
1) In first case, the car must have a second UV map, which will be used for the reflection map. Ingame, the reflection map will move from back to front as you drive - giving an illusion of a moving enviroment. This usually works best for car bodys. Also note that the Reflection value will be overridden to about 9-12% or so! Its not possible to have chrome with this reflection map!
To create the UVmap for this reflection map, simply apply "xvehicleenv128" temporary as diffuse texture and just texture the car as you normally would. However, when exporting, be sure to use the correct texture as diffuse!
2) In second case, the car doesnt need to have a second UV map. This type of reflection is better for chrome or very shiny parts. This is same as Vice City reflections, and the reflection map name can be anything.
To add any reflections to materials, use the "Enviroment" tab in surface editor, and load your texture as "Reflection Map"
- Exporting
Once your model is ready, just click the export button and select where to save the dff.
It will prompt you for a collision file, you can click cancel if you want to - but its REQUIRED for SA cars.
I've inlcuded the "ColExtract" tool that i've wrote today. It will extract collision from SA cars - use it until a proper collision editor is released for SA or until I implement COL exporting from LightWaves
- Troubleshooting
Q: d3dx_25.dll? What the poo?
- Get it at http://www.m3fe.com/760/
Q: Help! my garage doesnt open!
-The hierarchy is incorrect most of time, or there is no collision!
Q: Help! it crashed while exporting!
-Contact me, so I can fix it.
- Credits
ashdexx for his help on everything
steve-m for his rwAnalyse tool
kCow for documenting dff format