SUBSIM Radio Room Forums
HW3 supports Subsim through his many Amazon purchases, you can too!
Want to support Subsim and make Amazon pay for it? Click here to start any Amazon shopping.


SUBSIM: The Web's #1 BBS for all submarine and naval simulations!

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

Subsim wants to upgrade your account!
Reply
 
Thread Tools Display Modes
Old 04-16-2008, 03:42 AM   #1
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 18
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-2008 at 07:35 AM.
skwasjer is offline   Reply With Quote
Old 04-16-2008, 03:43 AM   #2
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 18
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-2008 at 07:44 AM.
skwasjer is offline   Reply With Quote
Old 04-16-2008, 05:31 AM   #3
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: piétrebais belgium
Posts: 4,735
Downloads: 76
Uploads: 5
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-2008, 05:42 AM   #4
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 18
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-2008, 05:44 AM   #5
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: piétrebais belgium
Posts: 4,735
Downloads: 76
Uploads: 5
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-2008, 05:45 AM   #6
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: piétrebais belgium
Posts: 4,735
Downloads: 76
Uploads: 5
Default fubar

I can email you the .dat, pm me where I should , and thanks !
keltos01 is offline   Reply With Quote
Old 04-16-2008, 05:49 AM   #7
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 18
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
Old 04-16-2008, 05:54 AM   #8
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 18
Uploads: 3
Default

Btw, I've just exported all the torpedoes succesfully myself (stock 1.5). Send me that .DAT as well, because its obviously a modded one. And by the looks of that shot, the stock torpedoes don't have a map channel 3, so that model must be fubared as well... You are probably doing something wrong here or using tools that corrupt the models (this may be S3D as well of course, but I can't put a finger on it).

[edit] Come to think. I think you have used the raw chunk import/export functionality incorrectly. Some of the settings for this are a bit of a black box and I suspect you have those settings wrong. I have posted a walkthrough for this some time ago as well, I'll look it up

PS: please put bug reports in S3D thread, not here...

Last edited by skwasjer; 04-16-2008 at 06:06 AM.
skwasjer is offline   Reply With Quote
Old 04-16-2008, 07:05 AM   #9
Xantrokoles
Seasoned Skipper
 
Join Date: Jan 2008
Location: Germany
Posts: 660
Downloads: 13
Uploads: 0
Default

Skwasjer, you are the best!

We Germans really underrated u Dutsch!:p

Keep up this great job
__________________
Xantrokoles is offline   Reply With Quote
Old 04-17-2008, 04:40 AM   #10
Anvart
Admiral
 
Join Date: Jan 2006
Location: Russia ©, E-burg
Posts: 2,230
Downloads: 60
Uploads: 1
Default

I think, that this stuff is not new for Skwasjer, but for other people it can be useful...
Limited WaveFront Obj format:
common http://www.fileformat.info/format/all.htm
http://www.faqs.org/faqs/graphics/fi...rt3/index.html ... but i can't
http://www.royriggs.com/obj.html
http://en.wikipedia.org/wiki/Obj
http://en.wikipedia.org/wiki/MeshLab
http://www.martinreddy.net/gfx/3d/OBJ.spec (more seriouse) ...
the same http://orion.math.iastate.edu/burkar...obj_format.txt
something with ObjLib http://www.cs.kuleuven.ac.be/~ares/l...1/doc/OBJ.spec
............................. http://www.cs.kuleuven.ac.be/~ares/libobj/index.html
may be ... or not ... http://www.fileformat.info/format/wavefrontobj/
not bad http://www.okino.com/conv/imp_wave.htm
4u http://www.wotsit.org/list.asp?fc=2
http://www.nacse.org/~moorchri/vwrl/...mat_specs.html for Java 3D, but ... as example ...
for other cases ... http://www.filedudes.com/OBJ_Import_...oad-31719.html
??? http://obj.alienpicks.com/
... and so on ...
__________________
The best regards.
Alex ®


Last edited by Anvart; 04-17-2008 at 07:32 AM.
Anvart is offline   Reply With Quote
Old 04-17-2008, 07:08 AM   #11
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 18
Uploads: 3
Default

Yea nice

There's alot of useful resources available online regarding the OBJ-format. I have used some of those 'old' pages myself many years back as well
skwasjer is offline   Reply With Quote
Old 04-17-2008, 11:58 AM   #12
AVGWarhawk
Buick Driver
 
AVGWarhawk's Avatar
 
Join Date: Jun 2005
Location: In a 1954 Buick.
Posts: 24,805
Downloads: 72
Uploads: 0
Default

Nice work!! Your editor has saved a lot of time for the modders. Hats off!
__________________
“You're painfully alive in a drugged and dying culture.”
― Richard Yates, Revolutionary Road
AVGWarhawk is offline   Reply With Quote
Old 04-29-2008, 01:44 PM   #13
LukeFF
Silent Hunter
 
Join Date: Apr 2005
Location: Riverside, California, USA
Posts: 3,842
Downloads: 41
Uploads: 5
Default

I just followed this procedure to export a ship model, and 3DS Max is telling it cannot import it. Is there something I'm doing wrong?

__________________


ROW Sound Effects Contributor
RFB Team Leader
LukeFF is offline   Reply With Quote
Old 04-29-2008, 07:07 PM   #14
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 18
Uploads: 3
Default

By the looks of the settings, no. I will need to know which ship model you tried, and if it's a modded one, I also need the dat-file. I can't verify it otherwise.
skwasjer is offline   Reply With Quote
Old 04-29-2008, 09:45 PM   #15
LukeFF
Silent Hunter
 
Join Date: Apr 2005
Location: Riverside, California, USA
Posts: 3,842
Downloads: 41
Uploads: 5
Default

Quote:
Originally Posted by skwasjer
By the looks of the settings, no. I will need to know which ship model you tried, and if it's a modded one, I also need the dat-file. I can't verify it otherwise.
It's the Kinposan, one of the stock ships.
__________________


ROW Sound Effects Contributor
RFB Team Leader
LukeFF 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 10:21 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © 1997- 2014 Subsim