SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH4 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 04-16-08, 03:42 AM   #1
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default [TEC] Import/export 3D models to/from game using S3D.

See the S3D thread for download info: http://www.subsim.com/radioroom/showthread.php?t=119571


This thread will explain all the settings, how to set up the model (with UV-channels) in 3ds Max, and how to get models back into the game.


Export to WaveFront Object file (.OBJ)
  1. In S3D, select the model you wish to export.
  2. Go to the menu: File > Export > 3D model
  3. Choose the WaveFront Object (*.obj) file filter, and then type a file name to save to (or use the default, suggested name). Click 'Save'.
  4. Before actually saving anything the Export 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: other 3D studio's may require different settings.

  5. Make sure the Save to .UVW radiobutton is checked. If you are using another 3D studio, you probably want to use the other radio button to save extra .OBJ files instead of .UVW files.
  6. In the list view you will see a file name for each map channel that the model contains. Note that the first channel can NOT be deselected. This is the main file which contains both the geometry, as well as the first map channel (diffuse). All the other map channels will use a similar file name as the first one. The added part in the filename indicates it contains the uv-data for channel x. (-uv2 = channel 2, -uv3 = channel 3). You can not change these file names, S3D does this for you.
  7. Click export to save the .OBJ file, each .UVW file (if available), and a .MTL file. Note that you will not be asked to overwrite a file if it already exists. Keep that in mind so that you do not accidentally overwrite a file that you need and haven't backed up.
Import into 3ds Max
  1. Go to the menu: File > Import...
  2. Select the .OBJ file previously exported with S3D and click Open.
  3. Verify your import settings match the screenshot below:

    • The 'Rotate model' must be unchecked. Otherwise, the model will point upwards.
    • 'Texture coordinates' must obviously be on.
    • The 'Normals' checkbox should be selected. If the to be imported model has normals (interiors do for example, ships don't) this ensures you import them as well. If the model doesn't have them, this option does nothing, so it's best to leave it on.
    • 'Use materials' must be on, but you don't have to specify the actual file.
  4. Click OK to import the model.
  5. Press render and see if you get the model rendered properly using the diffuse map. Sometimes, S3D has problems finding the correct texture, or exports a texture file name with extension .TGA, but the game may only have a .DDS. In this case, the render will fail. You should correct the materials and point them to the right texture yourself in this case.
  6. To add extra UV-data to the model do the following steps, for EACH next map channel:
    1. Select the imported model
    2. Click the menu Modifiers > UV Coordinates > Unwrap UVW. A new 'Unwrap UVW' modifier is added to the modifier stack.
    3. In the parameters of the new modifier, change the map channel to the index you are about to add. If you have previously exported -uv2, set map channel 2, etc.

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



      Click 'Yes'
    5. Now click the 'Load' button, just above the field where you changed the map channel. You can now select the .UVW file that you want to load into this map channel.
    6. All that you have to do now, is modify the materials that come with the model, and include extra texture maps that use the newly imported map channel data. If you have come this far, you probably know how to do this yourself so I'll leave this out of this walkthrough.
That's it. Model import with S3D is posted below, and the steps are pretty much similar. Just reversed.

Now, if you don't have 3ds Max, or want to try the alternative approach using extra OBJ-files per map channel, the idea is similar. Import the main OBJ-file into the scene. Then, one by one, import each next OBJ-file (with the next map channel). Copy the UVW-data from the 2nd imported OBJ-file to the original model, and once you're done delete the extra models.

If anyone wants to write a guide for other 3D software, please do!

Last edited by skwasjer; 08-27-08 at 07:35 AM.
skwasjer is offline   Reply With Quote
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
Old 04-16-08, 05:31 AM   #3
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: Milan Italy
Posts: 4,999
Downloads: 114
Uploads: 18
Default error : an item with the same key has already been added

what is this ? when I try to export my ijn tower

keltos01 is offline   Reply With Quote
Old 04-16-08, 05:42 AM   #4
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

heh, the first bug, but uhm, I'm noticing TWO channels with index 1. That is WRONG. Somewhere along the line that model got fubared. Did you import it with S3D as well (I doubt it, it shouldn't allow this to happen), or have you imported it previously with Pack3D? If yes, then it's not really S3D's fault.

Send me the .DAT, I can try to provide a 'graceful' workaround/warning...
skwasjer is offline   Reply With Quote
Old 04-16-08, 05:44 AM   #5
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: Milan Italy
Posts: 4,999
Downloads: 114
Uploads: 18
Default out of range

when I tried to export the torpedo typ V 3d model (to modify into a Kaiten) :
keltos01 is offline   Reply With Quote
Old 04-16-08, 05:45 AM   #6
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: Milan Italy
Posts: 4,999
Downloads: 114
Uploads: 18
Default fubar

I can email you the .dat, pm me where I should , and thanks !
keltos01 is offline   Reply With Quote
Old 04-16-08, 05:49 AM   #7
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

Check the 'About box' in S3D


Don't let these errors put anyone down, plenty of models do work, and maybe these are odd scenario's. I've tested dozens of models myself, and it worked for me every time. I'll have a look at these issues asap...
skwasjer is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.