PDA

View Full Version : [TEC] Import/export 3D models to/from game using S3D.


skwasjer
04-16-08, 03:42 AM
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)

In S3D, select the model you wish to export.
Go to the menu: File > Export > 3D model
Choose the WaveFront Object (*.obj) file filter, and then type a file name to save to (or use the default, suggested name). Click 'Save'.
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.

http://sh4.skwas.net/manual/models/1-export.jpg
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.
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.
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

Go to the menu: File > Import...
Select the .OBJ file previously exported with S3D and click Open.
Verify your import settings match the screenshot below:

http://sh4.skwas.net/manual/models/2-max_import.jpg
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.
Click OK to import the model.
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.
To add extra UV-data to the model do the following steps, for EACH next map channel:

Select the imported model
Click the menu Modifiers > UV Coordinates > Unwrap UVW. A new 'Unwrap UVW' modifier is added to the modifier stack.
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.

http://sh4.skwas.net/manual/models/3-unwrapUVW.jpg
After changing the map channel, you will be asked:

http://sh4.skwas.net/manual/models/4-confirmUVW.jpg

Click 'Yes'
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.
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!

skwasjer
04-16-08, 03:43 AM
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.

Go to the menu File > Export...
Select the WaveFront Object (*.obj) file filter, type a file name, and click 'Save'
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.

http://sh4.skwas.net/manual/models/5-max_export.jpg

Explanation of settings
'Use materials' must be enabled. Otherwise, S3D will not know which face uses what material.
'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.
'Rotate model' should be unchecked
For faces, select 'Triangles'. Both the game and S3D only support this.
We obviously want 'Texture coordinates' checked
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.
No smoothing groups
# 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.
Compress numbers, only affects file size, so 'yes'.
Press 'OK' to save the .OBJ file.
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.
Now, for each map channel (except the 1st one) follow these steps:

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.

http://sh4.skwas.net/manual/models/3-unwrapUVW.jpg
After changing the map channel, you will be asked:

http://sh4.skwas.net/manual/models/4-confirmUVW.jpg

Click 'Yes'. The changes that are lost are not the actual UV-data, so don't worry about the message too much.
Click the 'Save' button, just above the field where you changed the map channel.
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.
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.
Once done, delete the modifier. Now, we are done in 3ds Max and can import the model into the gameImport into game with S3D

Open the .DAT file and select the model which you want to replace.
Go to the menu: File > Import > 3D model
Choose the WaveFront Object (*.obj) file filter, and select the .OBJ file you want to import. Click 'Open'.
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.

http://sh4.skwas.net/manual/models/6-import.jpg

Explanation of settings
Import texture coordinates, yes
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).

http://sh4.skwas.net/manual/models/7-normalwarning1.jpg

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

http://sh4.skwas.net/manual/models/8-normalwarning2.jpg

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.
Flip coordinate system must be true to flip the Y/Z axes.
Face winding should be left as is.
'Use materials' must be checked so S3D knows which faces use which material.
If the .OBJ file contains more than one object, select the one you want to import.
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.
Before clicking 'OK', verify all the required map channels are listed in the list view. Now, click 'OK'.
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.

keltos01
04-16-08, 05:31 AM
what is this ? when I try to export my ijn tower

http://img227.imageshack.us/img227/2508/errorsamekeycopieut3.jpg (http://imageshack.us)

skwasjer
04-16-08, 05:42 AM
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...

keltos01
04-16-08, 05:44 AM
when I tried to export the torpedo typ V 3d model (to modify into a Kaiten) :
http://img234.imageshack.us/img234/7527/sanstitre1copiezf7.jpg (http://imageshack.us)

keltos01
04-16-08, 05:45 AM
I can email you the .dat, pm me where I should , and thanks !

skwasjer
04-16-08, 05:49 AM
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
04-16-08, 05:54 AM
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...

Xantrokoles
04-16-08, 07:05 AM
Skwasjer, you are the best!

We Germans really underrated u Dutsch!:p

Keep up this great job:up:

Anvart
04-17-08, 04:40 AM
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/fileformats-faq/part3/index.html ... but i can't :nope:
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/burkardt/data/obj/obj_format.txt
something with ObjLib http://www.cs.kuleuven.ac.be/~ares/libobj/obj-0.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/obj_format_specs.html for Java 3D, but ... as example ...
for other cases ... http://www.filedudes.com/OBJ_Import_for_3D_Studio_MAX-download-31719.html
??? :o http://obj.alienpicks.com/
... and so on ...

skwasjer
04-17-08, 07:08 AM
Yea nice :up:

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 :smug:

AVGWarhawk
04-17-08, 11:58 AM
Nice work!! Your editor has saved a lot of time for the modders. Hats off!

LukeFF
04-29-08, 01:44 PM
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?

http://img.photobucket.com/albums/v258/LukeFF/SH4/S3D.jpg

skwasjer
04-29-08, 07:07 PM
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.

LukeFF
04-29-08, 09:45 PM
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.

LukeFF
05-01-08, 03:34 PM
Update: I found out the reason why I can't open these OBJ files is apparently because I don't have a plugin to open these files (I have Version 3 of 3DS). I'd be very grateful if anyone could help me without with this. :)

Raptor1
05-01-08, 03:50 PM
3d Studio MAX 3? That's before it was even under Discreet wasn't it?

Either get a newer version of Max, Or get another program (Dunno if Gmax can import them, try Wings 3D or Blender)

Snaptrap
05-08-08, 12:06 AM
I've come to discover that 3DSM is the worst piece of crap program out there. Useless under Vista and even worse with x64.

LukeFF
05-08-08, 02:10 AM
I've come to discover that 3DSM is the worst piece of crap program out there. Useless under Vista and even worse with x64.

There's your problem. 3DS Max is a very good program and is used by many developers these days.

Snaptrap
05-08-08, 03:05 AM
I've come to discover that 3DSM is the worst piece of crap program out there. Useless under Vista and even worse with x64.

There's your problem. 3DS Max is a very good program and is used by many developers these days.

They're probably still running XP or Leopard. Thankfully I found something better for texturizing models. :rock:

HELLISH1
03-19-10, 05:27 PM
They're probably still running XP or Leopard. Thankfully I found something better for texturizing models. :rock:
3ds max 2010 works great with sd3, on all platforms as long as you have the sp1 and the hot fix that followed. Only one hotfix after sp1, easy to find:rock:

HELLISH1
03-19-10, 05:28 PM
Update: I found out the reason why I can't open these OBJ files is apparently because I don't have a plugin to open these files (I have Version 3 of 3DS). I'd be very grateful if anyone could help me without with this. :) FBX plug-in fixes that problem:rock:

von faust
11-03-10, 02:45 AM
A .dat file "contains" many 3D models.
It's possible to export multiple 3D model in one step and not individually one by one ?

jjones100
11-09-10, 05:47 AM
Guys I have tried out exporting an existing 3d model of the Richelieu battleship in order to try out a few things such as making a super-Richelieu ship with double the size of the original ship model's hull. I used the 3d modeling software called Softimage XSI and it imports existing 3d models with relative ease as well as allowing for the quick rescaling etc of the imported 3d model. When I saved the newly uniformed scaled model and reimported it back into the 3deditor software, it worked perfectly when I tested out from the software's render viewport window. However what I would like to ask guys who have more experience about such 3d modeling/texturing work is what can be done to prevent the original texture from coming out stretched/squashed in various places on the rendered 3d model if I just try and perform a non-uniform scale of the model along one coordinate axis instead of a full uniformed scaled along all 3 axes when say I want to just lengthen the existing hull of a ship instead of performing a full whole uniformed scale.

iambecomelife
11-09-10, 08:13 AM
Guys I have tried out exporting an existing 3d model of the Richelieu battleship in order to try out a few things such as making a super-Richelieu ship with double the size of the original ship model's hull. I used the 3d modeling software called Softimage XSI and it imports existing 3d models with relative ease as well as allowing for the quick rescaling etc of the imported 3d model. When I saved the newly uniformed scaled model and reimported it back into the 3deditor software, it worked perfectly when I tested out from the software's render viewport window. However what I would like to ask guys who have more experience about such 3d modeling/texturing work is what can be done to prevent the original texture from coming out stretched/squashed in various places on the rendered 3d model if I just try and perform a non-uniform scale of the model along one coordinate axis instead of a full uniformed scaled along all 3 axes when say I want to just lengthen the existing hull of a ship instead of performing a full whole uniformed scale.

You will probably have to re-UV map the 3d object to prevent these distortions. This can be difficult because large, complex models can sometimes crash your 3d modeling program. For wings3d, which I use, you right click the faces that you want retextured and select "UV Mapping" from the tab that appears. A 2d arrangement of the UV map will then pop up, and you can adjust it to your satisfaction. Wings3d lets you apply the texture to the model as it's rendered so that you can see what it will look like ingame - most other programs probably have this feature, too.

ZigmundFreund
11-29-10, 12:49 PM
3ds max 2010 works great with sd3, on all platforms as long as you have the sp1 and the hot fix that followed. Only one hotfix after sp1, easy to find:rock:

When you write 3ds max 2010 what is the exact version you are talking aboot? ver. 9 'ish?

Madox58
11-29-10, 06:33 PM
3Ds Max 2008 is version 10 so version 12 would be 2010.
Unless AutoDesk decided to change things again.
Just following the proper 'Nameing' is a test in and of itself.
Some versions you Capitalize one thing,
then latter versions you capitalize others.
:doh:

Yamato_NF
12-13-10, 08:55 PM
hi...
ive been wondering reading all of this.
is it possible to use proEngineer to model SH4 ships?
it is a very powerful Parametric Design tool, and i use it for School,
i would like to use it for SH4 models
Reguards, :salute:
Yamato_NF

sidslotm
07-26-11, 12:21 PM
good tutorial this, thanks.

Kpt_Kipp
11-16-11, 07:39 AM
S!

when I'm going to export a ship I realized that ALL is not selected so pls How I have to select ALL?
and where turret guns are?
can you help pls?

regards

Karle94
11-17-11, 08:36 AM
hi...
ive been wondering reading all of this.
is it possible to use proEngineer to model SH4 ships?
it is a very powerful Parametric Design tool, and i use it for School,
i would like to use it for SH4 models
Reguards, :salute:
Yamato_NF

As long as you can convert the model to .obj.

chrysanthos
01-28-12, 06:08 PM
i want to convert ships from silent hunter 3 and 4 into virtual sailor...is this going to work? and i need any 3d program?

iyiskipper
08-10-13, 01:12 PM
I found some older useful documentation, & pointers pertaining to
(importing in your ships with S3D) covering a little more on nodes, explinations

if you want to read up some over in the Submarine Sim Central forums.

Link:Messing around with S3D finally (http://forum.kickinbak.com/viewtopic.php?f=70&t=1140&st=0&sk=t&sd=a&sid=6ef5fe9f8c70a1d87e55a7f8f19c703b)

rotary crazy
10-05-13, 03:56 PM
what am I doing wrong?

The render of the model looks perfect in 3d max but in the game the texture is all over the place


Thanks

Madox58
10-05-13, 04:25 PM
what am I doing wrong?

The render of the model looks perfect in 3d max but in the game the texture is all over the place


Thanks

Would need to see an example to tell you what is wrong.

Yamato_NF12094413
10-15-13, 07:07 AM
http://www.subsim.com/radioroom/showthread.php?t=208348

I did the CVN78 , I hope someone can import it to silent hunter . :)

I also upload the OBJ file , if you want to do it for silent hunter .

D-L : http://www.mediafire.com/download/co.../CVN78+obj.rar (http://www.mediafire.com/download/cowhc1g5ysn1tyq/CVN78+obj.rar) :rock:

Jeff-Groves
12-23-18, 11:27 PM
Any update on this issue?
I'm experiencing something similar.
_____________________________
Alexandra
Also see import export (https://w2c.ca/en/training/customized-customs-coaching/) services

Can you be more specific?
Exactly what issue are you having?

JeromeHeretic
01-05-19, 09:34 AM
Do you know how to move objects between S3D and Blender? I need to change a pivot point of one object, to make it rotary, so i exported object from S3D, imported to blender, changed origin, export to wavefront .obj and when i want it import back to S3D i got the rerror msg" "InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: Selected Index

So what i did wrong?

Jeff-Groves
01-05-19, 02:49 PM
Can you give me a link to down load your file?

JeromeHeretic
01-06-19, 12:59 AM
I think i found the problem. Blender was exporting faces in incorrect format.
After few unsucessfull tries i read how the format works ( http://paulbourke.net/dataformats/obj/ ) and create my own "mvorigin" script.
But now, when i'm trying replicate the problem i can't replicate it. Now exports looks correctly (i didn't try import it, just as im looking into the file).

JeromeHeretic
01-08-19, 07:46 AM
Can you give me a link to down load your file?


Well, so problem remains. Im not able import any object created or modified in blender. :-(
So here it is. I get tactical map (i didn't find object which is more simple) and export it by S3D, can download there: http://www.ucw.cz/~jerome/SH3/test/
And then i import it to blender and export it out. That's only action i did with object. After that i change Linux end of line (LF) to end of line which is used by windows (CR+LF). You can download it there: http://www.ucw.cz/~jerome/SH3/test_blender/
(missing uv2 just ignore, it is not important at this moment)

When i try it import back by S3D, i got that error ""InvalidArgument=Value of '0' is not valid for 'SelectedIndex'"

JeromeHeretic
01-08-19, 08:08 AM
I found it! S3D needs to have group name, but in blender export is just object name. So when i change line "o MAP_tactical_it1.001" to "g MAP_tactical_it1.001", S3D import it without problems... so stupid thing, LOL :-)

Seaowl
01-10-19, 04:55 AM
Sorry, I haven`t seen your question earlier.
I had exactly the same problem. There is no need to edit the files manualy.
In my case the problem was gone, as I checked "objects as obj groups" * in the blender export options.
greetings :salute:

*Edit: Sorry. Donīt check "material groups". Was a mistake of mine.

**Edit 2: After some testing it seems that sometimes is nescessary to check "material groups", sometimes not. It worked fine for me to have both checked , but now I stumbled upon a modell - the NLGH lightship - where checking "material groups" during blender export messed up the whole texturing after reimporting in S3D.

Perhaps someone has more knowledge about these things?

JeromeHeretic
01-11-19, 12:57 PM
And also i noticed, that SH3 allow only triangles, in blender you can do it in edit mode by pressing ctrl+t.


EDIT: Aha... i found, that you can check "Triangulate faces" option in export menu.

JeromeHeretic
01-12-19, 05:53 PM
**Edit 2: After some testing it seems that sometimes is nescessary to check "material groups", sometimes not. It worked fine for me to have both checked , but now I stumbled upon a modell - the NLGH lightship - where checking "material groups" during blender export messed up the whole texturing after reimporting in S3D.



And isn't problem in that, that you by mistake unwrap some part of model and by this step was mapping changed in other way as was texture mapped originaly? Once i did it by mistake too and didn't noticed at first, just after i compared mapping of original object with my version.