View Single Post
Old 04-16-08, 03:43 AM   #2
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

To import a 3D model in the game, the steps are similar to my previous post, but this time, we move in reverse.

I'm assuming you have collapsed the modifier stack, and/or created new map channels or changed uv-data in 3ds Max.


Export to WaveFront Object file (.OBJ) from 3ds Max

The .OBJ file format can only be used to store one map channel (the 1st one). If our model has more than one channel, we also have to export one or more .UVW files to hold the UV-data for the other channels.

First, we export the .OBJ file. This is pretty simple and you may have done it before, however I'm going to describe it step by step anyway.
  1. Go to the menu File > Export...
  2. Select the WaveFront Object (*.obj) file filter, type a file name, and click 'Save'
  3. Before actually saving anything the OBJ exporter dialog will appear. Verify your settings so they look like this screenshot below.

    Note: other 3D studio's may require different settings.



    Explanation of settings
    1. 'Use materials' must be enabled. Otherwise, S3D will not know which face uses what material.
    2. 'Create material library' may be enabled. As long as an .MTL exists with the same name as the .OBJ file you can leave this unchecked, but otherwise you should have it checked. If the .OBJ-file is not linked to a .MTL-file, S3D can't import it.
    3. 'Rotate model' should be unchecked
    4. For faces, select 'Triangles'. Both the game and S3D only support this.
    5. We obviously want 'Texture coordinates' checked
    6. Some game models need normals, others don't. My general rule of thumb is to export the normals (so have it checked). S3D will warn you if you replace a model that has no normals with one that does. It also warns you if it is the other way around. In S3D you can decide whether to skip normals as well.
    7. No smoothing groups
    8. # of Digits, set it relatively high. Around 10 is fine. This ensures S3D can optimize the UV table better after loading additional map channels from .UVW/.OBJ files, and also reduces the change for anomolies ingame.
    9. Compress numbers, only affects file size, so 'yes'.
  4. Press 'OK' to save the .OBJ file.
  5. Now, for each additional map channel, we want to export the UV-data. To do this we add a temporary new Unwrap UVW modifier. Select the model. Click the menu Modifiers > UV Coordinates > Unwrap UVW. A new 'Unwrap UVW' modifier is added to the modifier stack.
  6. Now, for each map channel (except the 1st one) follow these steps:
    1. In the parameters of the temporary modifier, change the map channel to the index you want to export. By default the 1st channel is specified, but we don't need to export this channel (it's already in the .OBJ file). So change the channel to 2, 3, etc.

    2. After changing the map channel, you will be asked:



      Click 'Yes'. The changes that are lost are not the actual UV-data, so don't worry about the message too much.
    3. Click the 'Save' button, just above the field where you changed the map channel.
    4. Specify the filename where you want to save the UVW-data to. It is important that you use the exact filename together with a postfix indicating the map channel. For example, if the .obj file saved earlier is saved as test.obj, for channel 2 append '-uv2' to the filename to make test-uv2.uvw, for channel 3 append '-uv3' to the filename to make test-uv3.uvw, etc. This is VERY important, otherwise S3D won't find the files.
    5. Once you have saved the map channel, move back to the first step for additional map channels. You can reuse this temporary modifier for all channels.
  7. Once done, delete the modifier. Now, we are done in 3ds Max and can import the model into the game
Import into game with S3D
  1. Open the .DAT file and select the model which you want to replace.
  2. Go to the menu: File > Import > 3D model
  3. Choose the WaveFront Object (*.obj) file filter, and select the .OBJ file you want to import. Click 'Open'.
  4. The .OBJ file is now quickly scanned for available objects, after which the Import settings dialog will appear. All the settings by default are set to work with 3ds Max. Verify your settings so they look like this screenshot below.

    Note: depending on the 3D studio used to export, different settings may be required.



    Explanation of settings
    1. Import texture coordinates, yes
    2. Import vertex normals checked. If the model you are about to replace contains no normals, and the model you are to import does, you will receive a warning (and you may choose to skip).



      If the opposite is true, you will also receive a warning.



      If you know for sure no normals are needed, you may uncheck this option. But it's easier to leave it enabled so you don't forget about this and get the warnings.
    3. Flip coordinate system must be true to flip the Y/Z axes.
    4. Face winding should be left as is.
    5. 'Use materials' must be checked so S3D knows which faces use which material.
    6. If the .OBJ file contains more than one object, select the one you want to import.
    7. If you have exported .UVW files from 3ds Max, you must select the first radio button. If you have exported additional .OBJ files, select the 2nd radiobutton.
  5. Before clicking 'OK', verify all the required map channels are listed in the list view. Now, click 'OK'.
  6. S3D will be crunching some numbers, and that's about it. Model imported. Save, enable mod and test in game!
For those that don't use 3ds Max, and want to use additional .OBJ files to import the extra UV-channels, the methods are similar. Just save an OBJ-file for each map-channel (you must copy the UV-data to the 1st channel before exporting), and follow the 'Import into game with S3D' steps above.

Last edited by skwasjer; 08-27-08 at 07:44 AM.
skwasjer is offline   Reply With Quote