Neverwinter Nights:Tutorials:Placeables:WW2 Submarine

From TBotR Wiki

Originally posted on the BioWare forums. Re-posted here with permission.

Creating a WW2 Submarine Placeable

by Randomdays

Introduction

A short, step by step tutorial on how to import an .obj file into gMax and make an NWN ready model. It's setup for the submarine but the basics should let you import any .obj model file into the game. From start to finish, with practice, it takes about 30 minutes.

This should also work with any other imported 3D model you can bring into gMax as well.

Since I've only been working with NWgMax Plus[mda 1][mda 2]/gMax for a couple of months, I'm sure that not everything here is perfect. Corrections and comments from more experienced members are welcome, keeping in mind the basic purpose of the tutorial and the fact that it does work as intended.

Things You Will Need

  • gMax[mda 3]
  • NWMax for gMax or NWgMax Plus[mda 4]
  • The gMax .obj import script that can be found many places including here
  • A donor mdl to start with.
  • An .obj 3D model set which should have the .obj file, a texture and an .mtl file. Wavefront .obj is a common 3D model format and many 3D editors can use it or convert to it.

Step 1: Getting Set Up

Download and put the .obj import script in the gMax scripts folder. Start NWgMax Plus and gMax. On the NWgMax Plus panel, expand the "MDL Loading" section, click the Browse button, find the mdl file you've decided to use and import it. I'm using a simple placeable NWN2 imported building from the Vault. It has no destruct, death, etc animations to it.

SubTut 01.jpg

Step 2: Clean Up

Click on the parts of the model and delete everything except the aurora base and ngon. Clicking on the "Select by Name" icon on the top bar will show you everything in the current project. If you want, you can save this now and reload it later as a good starting point for future projects. Rename the Aurora Base to fit your project. In this case, "e2_sub"

SubTut 02.jpg

Step 3: Start Object Importer

Now on the right bar, click on the hammer tab, then the "Maxscripts" button. On the utilities section, you should see the Wavefront OBJ import script listed. Click on it and start it.

SubTut 03.jpg

Step 4: Import Object File

Scroll down and you'll see an import button. Click and browse to your obj file and import it.

SubTut 04.jpg

Step 5: Finding the Imported Model

The .obj is now in the project. In this case, you can't see it because it's very small compared to an NWN item. Left click on the bottom left view window to select it (grey box around it) and expand it to full screen with the min/max button on the bottom right corner.

SubTut 05.jpg

Step 6: Now That We Have Found the Model

Zooming in with the mouse wheel, you can now see the sub, standing upright.

SubTut 06.jpg

Step 7: Rotate the Model

Since the sub imported at the wrong angle, we need to rotate it. Left click on the sub to select it, then left click the "Select and Rotate" button to select that and finally right click the button to bring up a popup window. Change the X value to 90 to rotate the sub 90 degrees.

SubTut 07.jpg

Step 8: Scale the Model

Now the sub is the right angle but is still way to small. Left click the "Select and Uniform Scale" button on the top bar. By trial and error I've found that all E2 models need to be increased by an average of 13,000 times to be close to NWN size. Increase the X/Y/Z values to 13,000. Changing the values in non-uniform numbers can stretch the model in different ways from the original. You'll notice the 2 black lines crossing the view. The horizontal line will be either your X or Y axis depending on your view. Usually you'll want your mesh to rest right on this as this will represent ground level in the game. Since the sub is preset to be partially underwater, half of the mesh is below the line.

SubTut 08.jpg

Note: If the mesh does appear too small in the game (as did happen with the sub) reopen the save you should have made right before export. On the NWgMax Plus panel, expand the "General Utils" section and hit the "Scale Wizard" button. Increasing the size percentage here will increase the size of all items in the mesh at once. I had to increase the sub by another 600% to get it to about the right size.

Step 9: Reset Transforms

Clicking the min/max button again will show you all 4 default view windows again. On the NWgMax Plus panel, expand the "Mesh Tools" section and click on the "ResetXForm" button. This finalizes the changes you've made to the mesh. The scale will go from 13,000 of the old size to 100% of the new size.

SubTut 09.jpg

Step 10: Convert to Editable Mesh

Right click the sub in one of the views to bring up a popup window. On the bottom right of the popup, select "Convert to Editable Mesh".

SubTut 10.jpg

Step 11: Switch to Vertex Mode

On the right panel with the Modify(rainbow) tab selected, click on the vertex button to show all the vertices of the mesh.

SubTut 11.jpg

Step 12: Select and Weld all Vertices

Click on the edit selection on the top bar and the select all choice from the rollout. All the vertices will turn red to show they're selected.

SubTut 12.jpg

Scroll down on the right panel until you see the weld mesh section. Clicking on the "Selected" button will merge/delete duplicate vertices within the distance shown on the mesh. This will bring your poly count down and fix some possible mesh errors. Click the ResetXForms button on the NWgMax Plus panel again.

Note: You should only do this when the mesh is the proper size for the game - a very small imported mesh could lose to many polys before the resize and be missing needed parts. Before welding might be a good time to save your work.

Step 13: Creating Helpers

On the right panel, click on the "Create" tab and then the "Helpers" button under it.

SubTut 13.jpg

Step 14: Creating a Placeable Walkmesh (part 1)

Left click the "Dummy" button and then click and hold down the left mouse button on the middle of the sub in the top down view. Move the mouse to expand the box that forms until it's a little bigger than the sub - size isn't that important. Release the left button and right click to set the dummy. This will be the 1st part of the sub's PWK. Click the Modify tab and rename the dummy "e2_sub_pwk. On the modifers rollout, select "AuroraPlaceable" from near the bottom of the list.

SubTut 14.jpg

Step 15: Creating a Placeable Walkmesh (part 2)

To form the 2nd part of the pwk, hit the Create tab on the right panel and then the Geometry button below. For the sub, we'll use the simple box shape. Click the box button. Below, leave the width segment at 1 but change the length and height segments to 3.

On the top down view, move the mouse pointer to a corner of the sub, hold down the left mouse button and move the mouse to form a rectangle around the sub. Release the mouse button and move the mouse towards the top of the screen to raise the walls of the box. At a height about equal to the sub, right click and set the box.

SubTut 15.jpg

Step 16: Adjust the Placeable Walkmesh

As with Step 10[mda 5] above, select the box, convert to editable mesh and select vertices. Now though, click on a vertex and move it by holding down the left mouse button. Moving the vertices one by one, we'll shape the box to closer fit the shape of the sub. Hit the ResetXForm button on the NWgMax Plus panel to finalize the shape.

SubTut 16.jpg
SubTut 17.jpg

Step 17: Creaste a Shadow Box

On the Edit button at the top, select the "Clone" option from the rollout to make a copy of the box. Name the copy "shadow".

SubTut 18.jpg

Step 18: Add and Adjust AuroraTrimesh Settings

The "shadow" box will be what actually casts the shadow of the object in the world. Very complex objects with their own shadow can slow/crash the game. Select the Modify tab on the right panel, add the "AuroraTrimesh" to the shadow and make sure "shadow" is on and "render" is off. For the sub itself, reverse this - add the AuroraTrimesh modifier, turn on render and turn off shadow.

SubTut 19.jpg

Step 19: Add More Helpers

Repeat Step 13[mda 6] from above but make a small dummy next to the side of the sub. Rename it "sub_pwk_use01". This will be the spot the character will move to when he tries to use the sub if it's not static.

SubTut 20.jpg

Step 20: Link Everything Together

About the last thing to do is link all the items together and to the base. Click the "Select and Link" button on the top panel. Usually the top view is best - expand it and left click and hold on an item and drag to an item you want to link it to. Link the box and the usenode to the pwk, link the pwk, the sub and the shadow to the base. Click the "Select Object" arrow on the top bar and then the "Select by Name" button to see all your items. With the subtree option clicked on the bottom of the popup, you'll see what's linked together. You can undo a link and relink if you have anything incorrect.

SubTut 21.jpg

Step 21: Export the Model

Last, save your work and select the Aurora base and export the mdl. Set the classification to character and hit the export button. Since there's no animation present, it shouldn't matter which button you choose. You should now have the mdl and pwk for the sub in your output folder. Add the files to your hak and a new entry to your placeables.2da and you should have the sub in the game.

SubTut 22.jpg
SubTut 23.jpg

Editor Notes

  1. Edit to reflect the tools used -- MDA
  2. This tutorial should also work with NWMax -- MDA
  3. It may be a given, but I added it anyways. -- MDA
  4. Added links to the tools -- MDA
  5. Adjusted step # to match this tutorial -- MDA
  6. Adjusted step # to match this tutorial -- MDA
Personal tools