Cars (Destructible Props)

From WiCWiki

Revision as of 09:22, 4 February 2008 by PhoenixFury (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

Cars Introduction

Cars are the only unit/prop in WIC that can be crushed by other units, they also have a specific shader (Cars Wreckable). Because of this there are a number of car specific steps you have to follow in order of it to work correctly. These Cars are props, and will not be able to move, and are as such static objects!


Modo and Cars

Modelling (Creating “model.lwo”) First model the Vehicle in one layer. The same material and UV should be applied to the whole model. When finished, make sure that there are no weight maps attached to the model (you can’t delete the Subdivision weight map). Now you’re able to texture the model. Create one texture for the color Ex: Car_Color.dds and one texture for when the car is wrecked Ex: Car_Wrecked.dds. When you’re finished with the texture, map it to the model. Save the mesh to Ex: model.lwo using LWO (Lightwave Object) format!

LOD’ing In order for the game to run smoothly there has to be LOD’s (Level of Detail) of all things in the game. To Create a LOD simply take the original mesh and start deleting edges so that the polycount in the end will be halved. Do this without altering the UVmap or else the vehicle will look strange. Save the original model as Ex: Car_Lod2 and Car_Lod3. As I mentioned earlier the polycount should be half of the original model. If the car has 1000 polys the LOD2 should have 500 and the LOD3 should have 250 polys. If there’s time you can make a LOD4 as well. This however should contain an ultra low number of polys, something like 60-70 polys will do fine. TIP: Have the Uv map so you can se it while LOD’ing, this makes it easier to spot any mishaps in the Uv while LOD’ing.

Shadow Mesh In order for the car to cast shadows there has to be a shadow mesh. You could use the original mesh but it would be too expensive. The Shadow mesh has to be one single piece of geometry resembling the shape of the vehicle. There can be no holes in the mesh for it to work in the showbox. The shadowmesh has to be fitted inside the original mesh or there might be artifacts in the showbox later. The shadow mesh should be named Ex: model_shadow.lwo There should also be a LOD for the Shadow. Named Ex: Shadow_Lod2.lwo.

If there is a problem with the shadow mesh being half of its original size later, just export it to object, open it with Lightwave modeller and resave it as a Lwo, it should now work properly in the showbox.


Lightwave Modeler and Cars

The idea is to weight paint the model in Lightwave modeller and animate it in Lightwave scene. You can do this in multiple ways but I recommend the following. Load your car into Lightwave modeller. Place your skelegons (under the setup option) as the picture shows. The Idea is to place the skelegons where you want the deformation to occur.

Divide the car into different layers, one with the wheels and one with the body. Then take the respective skelegons and put them in their respective layer. This means that you put the skelegons that are supposed to animate the wheels in the wheels layer and so on.

Now go to the Map option and give the model its weights. (TIP: Name the skelegons to make it easier in the future!) Remember all skelegons has to have weight to it or the showbox will complain later. The wheel skelegons should each have 100 % weight of their respective wheel.

Skelegon layout

Image:image001.jpg

Ex: I got the front left wheel polygons selected, I weight it 100 % to the left wheel skelegon. The body should be smoothly divided between its skelegons for best result. Also in the origin create a root skelegon for use later. Remember all skelegons must have weights attached to them including the root skelegon.

Image:image003.jpg Image:image002.jpg
Evenly distributed weight map Wheel 100% weighted to back wheel skelegon


If weighed correctly the model should be ready to be saved. Put all the skelegons and mesh in one layer, save it as Ex: model_whole.lwo!

Then with the same model, delete the skelegons and overwrite the original model (model.Lwo), it’s still the same model as before but with weight maps. Deleting the skelegons is necessary because the showbox won’t accept skelegons, that’s why they are removed. You might have to map your texture to your car once more after this!

Lightwave Scene

The idea of this is to make three different states called hurt states. One for when the car is whole (not crushed), one for when the car is crushed, and one for when the car is completely wrecked.



Model_whole.lws

Open model_whole.lwo in Scene using the + key. In the setup option convert the skelegons to bones. Then enter the scene editor and place all the bones under the root joint, using the Scene editor. Under the Items option Replace (Replace>Replace with Object), the model_whole.Lwo mesh with the model.Lwo mesh. You do this because the Lightwave scene (lws) file you are making will link to the correct mesh (model.lwo). If you don’t do this the showbox will complain later, because it won’t accept files with skelegons in it.

Now it is time to animate the car so that when you drive over it, it shows its “crushed animation”. Depending on the car you are animating the animation will be different.

To think about: The wheels should be attached to the body of the car at all times, meaning the wheels can’t come off and land a few meters away. When animated down, the wheels bones should stay in the same area, and be rotated and only slightly translated. Because if they are not they will be flying all over the place once the car is flipped and turned into a physics body, and that will look strange (experiment with the animation, to get it just right). Ten frames should be sufficient for a crush animation. When the animation is satisfactory make sure all bones are keyed.

Now make sure the mesh in the scene is the right one. In the scene editor the mesh should be model.lwo.

Saving the file should be done to lws (lightwave Scene). To something like Model_whole.lws

Also save the file as model_hur2.lws (will be explained later) this one will be used later in the showbox!


Model_hur2.lws

Clear the scene File>Clear scene

Now we will create the hurt 2 state and the after state.

The hurt 2 state should be the car model in its crushed state with all its bones keyed to the same frame. Meaning the car should not be animating when you pull the timeline, just be keyed to its crushed state. Frame 0 and 10 should have the same key. The car just needs a state where it does nothing but all the bones are keyed.

Ex: Open the model_whole.lws scene and go to the last frame, press enter type 0 in the key option and choose all items in the list and press ok. Save again to model_hur2.lws


Model_after.lwo

Now we need a hurt 3 state, this is when the car has been crushed. Open the model_hur2.lws select the mesh in the scene editor. Go to the last frame. Save: File>save>Save Trans Object and save it to model_after.lwo. The model_after.lwo file also loses its texture so go ahead and re map it with the wreck Texture (Car_wrecked).Now there should be the following files.


Model.lwo

model _whole.lws

model_hur2.lws

model_after.lwo

model_shadow

model_shadow_Lod2

model_Lod2

model_Lod3


In the model_after.lwo file select the mesh in the scene editor and save it as a Trans object File>Save>Save Trans Object as model_after.lwo. The model_after.lwo file also loses its texture so go ahead and re map it with the wreck texture in modo or lightwave. In the showbox use the Car_wrecked shader for this mesh (model_after.lwo) as well.


Showbox and Cars

Now with all the states, textures and models ready you should be ready to put them all together in the showbox.

The showbox connects all the single files into one big file called a MRB. This MRB is the file the engine uses in game. The MRB loads the different files each time the scene reloads, so if you have to change the model, texture or weight maps there is always the possibility to do so.

Open the model_whole.lws in the showbox, an option box should appear select stand.

If you can’t see your model, it is because you haven’t assigned a material/shader to the model. Select the Model.lwo in the meshes option in the upper right corner of the screen. You should get a few new options in the bottom of the screen. In the Surface option Change the Surface file to Cars Wreckable. Then select the other mesh model_after.Lwo and assign the Normalmap units shader to it.

Image:image004.jpg

In the upper Left corner enter the object option, in the lower parts of the screen there should appear an add Complete state button. Use this to add the other states of the car.

Press it and select the model_whole.Lws. The option box appears again, choose hurt a little.

Press it again and select model_after.Lwo and choose hurt a lot in the option box.

Now in the upper left corner select hierarchy and flatten the bones tree (right click choose flat). Your bones should have the states under them STND, HUR 1, HUR2. And the one on the bottom should be HUR3. Now we have to add Child/Bone States. Just click the blue bone icons and there should be a button (addChild/Bone State) on the bottom of the screen. Press it and select hurt a lot from the option box that appears.

Now click on the STND on your root joint (the one under the blue bone icon). In the lower portion of the screen there are a few check boxes. If it’s not already checked you should check the Active checkbox, in order to save it press (apply to childs) this means just what it says, that your changes are applied to all the children of the root joint. Do this to HUR1 and HUR2. The HUR3 Active checkbox should be unchecked.

Furthest down on the list, there should be a long name with the address of your model_whole address on it. Here on the other hand the HUR3 Active checkbox should be checked and all the others unchecked.

Try out if you did it right by pressing the F1, F2, F3 and F4 keys. The result should be that the car is animated down. And one with just the wreck mesh in it (model_After.lwo).

Image:image005.jpg


Shadows

To add shadows to the scene simply press the Shadow tab, on the top of the screen next to the physics tab. Click new, and then just save it to the same directory as the MRB. Now Press the Add button and add your shadow mesh to the scene. A popup window will appear, choose <root>, then press ok. Now press the Add Skinned button, choose your shadow mesh again, and press ok. In the popup window choose the one on the bottom. The result should look like in the picture.

Adding the Lod2 of the shadow is simple. Just click the Add Lod2 button and repeat the steps above but with the Lod2 mesh.

For the two shadow meshes the Force Cap Rendering option should be checked.

To Change settings for the Lod2 shadow mesh the Edit 2nd LOD checkbox has to be checked.

Before exiting the shadow editor you have to press the Save/Update button in order for the changes to take place.


Adding the LOD’s

The Lod’s are easily added, in fact if named correctly (Ex: Car_Lod2) they should be added automatically. Pressing the Lods tab to the right of the shadow tab brings up the settings for the LOD’s.


Particles

Adding particles can be cool, especially when they are triggered by the different states.

Choose the bone from which you want the particle effect to emerge from. Press the add particle emitter button in the lower portion of the screen.

If you want the particle effect to be delayed, choose state in the “Next Animation” list to whatever state you want it to be, Time to next animation regulates the delay time to the particle effect. Ex: if you type 5 then it will be 5 seconds delay on the effect.


Physics

The physics are needed for the model to react to the world around it. In the physics tab you will find all the physics attributes needed for the car.

You should by this time have saved the model. To do this; File>MRB Export

This creates a MRB file which can be read by the engine.

Open the Physics tab and press the >> button, which will open up the physics list. There you find a generate button, press it. This opens a popup window, press ok. This generates physics boxes for the bones. The Physics boxes are used by the engine as collision objects, this means that when a vehicle collides with the box it reacts in a certain way.

Place the Physics boxes around the area of the bone. Meaning, the respective bone should have their physics box close to them.

When all the physics boxes have been arranged. Each box has to be configured so that it reacts in the right way when in game. To do this first copy the picture below.

Select the upper most bone/mesh and under the settings you just copied there is another option.

For the mesh (Should be the top one) the option should be.

All the others should have the same as the picture.


Texturing

When texturing the vehicle there are a few things you have to think about. In the Cars Wreckable shader there are four maps, color map, Wreck map, Environment map and Transparency map.


Color Map

The color map is just a regular color map, but with this color map you have to add an alpha channel. This alpha channel will control the environment maps strength. This means that where the alpha is black the environment map will be zero and where it is white the environment map will be maxed out. So if an area is dark in the alpha the area will be less reflective, and the other way around. Save it as a DXT5 mipmap.


Wreck Map

All this does is overlaying the color map for it to look like the car got crushed.

Save it as a DXT1 mipmap.


Environment Map

This is the environment map that you control with your color map’s alpha.


Transparency Map

This map controls which areas that are transparent and which are not. Black is transparent white solid. Save it as a DXT1 mipmap.


Wreck Texture

The point of this is for the wrecks of the vehicles to look like hiress wrecks, but infact cost almost nothing in processing power. The vehicle’s last state which have the Normalmap units shader applied to it, have a few different maps. The Color and specular map should be a low resolution version of the color map, with small alterations. Radiosity and Alpha test should be a color map with a bump in the alpha channel, with the texture of some burned out materials. This is because it is supposed to act as an overlay of the color map to make it look more higress than it actually is.

Now the vehicle should be ready for the game. GL HF.

Personal tools
User Created Content