PDA

View Full Version : [TEC] SH4 models and texture maps (warning: large pictures)


skwasjer
12-06-07, 09:21 PM
Now that I have had a chance to get good look at the game assets (models/textures), and what techniques the game engine uses to draw models I think we need a dedicated technical thread.

For the time being, I will only focus on ships (but I will add interiors in some time). How to import or export them will also be added later, for now it's just how the game draws them. This info should be useful to those who want to create or modify models.

First, the available textures:

..._T01, RGB channels = Diffuse map
..._T01, Alpha channel = Optional, specular map (see below)
..._O01, RGB channels = Ambient Occlusion & dirt map
..._O01, Alpha channel = Optional, specular map (see below)
..._N01, RGB channels = Normal map (aka bump map)

The specular map is special, as it can be either in the alpha channel of the diffuse texture or the ambient occlusion texture. And it's not a required texture either. The game identifies which texture to use with the UnifiedRenderControler > UseSpecularFromDiffuse. All the other extra maps can also be turned on or off with this controller.

Below are shots with combinations of the maps enabled. The shots are rendered in 3ds Max, so this also shows I got all uv-maps in. Please note that I do not attempt to get the same look as in game, because the game uses shaders and all sorts of other stuff to make it look even better. The shots are made to show the difference.



Diffuse only

The model has only the diffuse map applied. It looks very plain. Shadows are calculated based on vertex normals only. The shadows depend in this case solely on the light sources in the scene. Since I have a big light above the model, there aren't much shadows seen at the top of the deck.

http://sh4.skwas.net/3dsmax/Diffuse.jpg

Close up:

http://sh4.skwas.net/3dsmax/CloseUp_Diffuse.jpg



Diffuse + Specular

Same as previous shot, but with the specular map applied. The specular map is used to determine how much light is reflected. The most obvious highlights are seen at the keel and midsection of the hull. It depends on camera angle and where the light sources are. At different angles the effect can be seen better.

http://sh4.skwas.net/3dsmax/Diffuse+Specular.jpg

Close up:

http://sh4.skwas.net/3dsmax/CloseUp_Diffuse+Specular.jpg



Diffuse + Specular + Ambient Occlusion/dirt map

With the ambient occlusion map applied, the whole ship is now darker. The ambient occlusion map is basically used to apply prerendered shadows to the ship. No light sources have changed!

The game uses a completely different UV-set (texture coordinates) for this texture, which is the most common problem experienced in today's modding, since no tool can export/import the additional set(s), yet!

Occlusion maps are often also combined with a dirt map. A dirt map is a map that has extra detail, dirt, rust, scratches, and what not. When blended with the diffuse map, this will add more variaty to the overal look of the model. The model no longer looks plain, and texture tiling is no longer very apparent. Look just below the turret base, you can see a whole lot of rust/dirt that wasn't in the previous shot...

You can also see the specular highlights better now.

http://sh4.skwas.net/3dsmax/Diffuse+Specular+AmbientOccl.jpg

Close up:

http://sh4.skwas.net/3dsmax/CloseUp_Diffuse+Specular+AmbientOccl.jpg



Diffuse + Specular + Ambient Occlusion/dirt map + Normal map (bump)

Not so apparent from a distance, the bump map provides yet even more detail. Instead of modelling small details like ladders, windows, doors, wires, rivets, etc with polygons, such details can also be faked by your graphics card. The bump map provides info what area 'sticks out' or 'falls into' a surface. In combination with light shining on a surface the graphics card will produce shadows which will give it a raised or lowered look. You can see the bump map in action better below in the close up shot, I overdid the effect a bit so you can see more clearly (compare also with previous closeup).

http://sh4.skwas.net/3dsmax/Diffuse+Specular+AmbientOccl+Bump.jpg

Close up:

http://sh4.skwas.net/3dsmax/CloseUp_Diffuse+Specular+AmbientOccl+Bump.jpg


More to come later.

PS: I am by no means a 3d expert, just for the record :88)

AVGWarhawk
12-06-07, 09:24 PM
Ok man, you talking a foreign language to me! Where are you going with this:hmm:

ReallyDedPoet
12-06-07, 09:27 PM
One part of the game that needs a little work, by the look of things though :roll:,
not for long :up:


RDP

skwasjer
12-06-07, 09:32 PM
Ok man, you talking a foreign language to me! Where are you going with this:hmm:

I want to outline how the game uses models and texture assets, and will add in the future how to get everything in and out of 3d modelling software. Basically, I want this to be a thread where all technical related info is gathered, for those that want to understand. I realise the uber 3d guru's are not impressed by this info, and others could care less about how it's done, but there's a group that wants to know ;)

AVGWarhawk
12-06-07, 09:36 PM
Now I get the picture:up:

Digital_Trucker
12-07-07, 12:04 PM
I realise the uber 3d guru's are not impressed by this info, and others could care less about how it's done, but there's a group that wants to know ;)

To paraphrase the catchline of a popular grocery store gossip mag, "Perspiring minds want to know". And my mind is perspiring, so I guess I fit into that group:lol: .

Thanks for the info:up:

ref
12-07-07, 12:13 PM
Skwasjer, you mentioned in another thread a 3d file format you're using for exporting the objects, do you have the tech specs?, I really wan't to give it a look to see if I can use it in a project I'm working on, and to improve compatibility between tools, when sansal wrote pack3d he choosed the obj file format because he worked with Maya, and also it's a simple format, but it lacks a lot of features (multiple tmaps, hierarchical models, etc).

Ref

DeepIron
12-07-07, 12:21 PM
If your project concerns an SH4 compatible object you should note:
The .obj formt is the original geometry format used in SH4 .dat files... You could use any other geomtry format you wished for development, but would have to convert to .obj to be encapulated in the .dat file. SH4 doesn't read any other geometry format that I know of...

ref
12-07-07, 12:28 PM
If your project concerns an SH4 compatible object you should note:
The .obj formt is the original geometry format used in SH4 .dat files... You could use any other geomtry format you wished for development, but would have to convert to .obj to be encapulated in the .dat file. SH4 doesn't read any other geometry format that I know of...

That's incorrect, the format embedded in the dat files is propietary of SHx series, and doesn't match any comercial 3ds file format, in fact the obj files are ASCII files and the dat files are binary, the obj file format is just used by pack3d to import export from that format, IIRC, the dev team uses 3dsMax for they work so I asume they have import modules for that format.

Ref

DeepIron
12-07-07, 01:00 PM
Well then, I stand corrected... ;)

mrbeast
12-07-07, 01:53 PM
Very interesting thread Skwasjer, this is just the info I needed at the moment as I've been experamenting with some skinning of my own. I had kinda figured out what you put in the first post over the course of a week or so! :lol:

Something that I find a bit of a shortcoming in the process that SH4 uses to skin the ship models is that the O01 files are pretty low res compared to the T01 files.

So if for example you wanted to place some writing on the side of a ship, it comes pretty fuzzy looking.

Is there a way around this?

skwasjer
12-07-07, 02:16 PM
ref, I use Collada. It's xml, open source and most 3d suites support it directly or using a free plugin. It can hold any info we need for SH3/4, including multiple uv-sets, material info, parent-child relationships, named objects/containers etc. S3D will support export in the next release, and import in the subsequent one.

I will post a guideline and tutorial on 3ds max and Collada in the next weeks. The format does have limitations (basically some manual post-processing) but they are discussed in that tutorial and are only minor issues that you deal once with...

skwasjer
12-07-07, 02:26 PM
Very interesting thread Skwasjer, this is just the info I needed at the moment as I've been experamenting with some skinning of my own. I had kinda figured out what you put in the first post over the course of a week or so! :lol:

Something that I find a bit of a shortcoming in the process that SH4 uses to skin the ship models is that the O01 files are pretty low res compared to the T01 files.

So if for example you wanted to place some writing on the side of a ship, it comes pretty fuzzy looking.

Is there a way around this?

When you are able to import/export you can do anything you like. You could break the mesh apart and retexture parts of it with a new material/texture (which includes your text/writing).

Another possibility is to create a higher mip level (2048^2) of that single texture and add your writing.

Which approach is best depends on your own needs. You need to take into account how much extra weight you add to the gpu. Both can work. I'm sure there are other alternatives, but I'd ask a 3ds max guru then :)

kapitan_zur_see
12-07-07, 04:25 PM
Though not a professionnal by any means, i quite know my way around 3dsmax and 3D in general. From what i've read here, you got everything correct Skwas.
The problem we indeed face off while using pack3d is that it can only import one texture channel, which is the diffuse one, alongside only ONE uvw texture coordinate (that's particular to .obj format), hence, occlusion map is bypassed and will be confused while ingame.

For people that are interesting in what occlusion mapping is, it is generally used in the gaming industry and more or so, you made them by using "rendering to texture" function in 3DSmax which is also called "baking texture". It is basically generating a texture containing information on how to render lighting for a rendering engine. The main purpose of occlusion techniques are to mimic the quality of a raytracing or radiosity rendering. Those two are very professionnal rendering method and while they produce very high quality images (they use it for instance in those pixar movies and the like) and precise depicting of real lightning behaviour, they are very processor hungry and therefore, cannot be use for the gaming industry as it is not precalculated animation, but requires of course real time rendering. Not that it couldn't, but you would just end up with something like one frame per MINUTE.

To sum it up for the occlusion lightmap (there are other occlusion type of maps by the way), Typically, 3dsmax will first do a raytrace rendering with complex light sources algorythms ( don't know of...lol) for a high quality depicting of shadows and light behaviour and will then "project it" on a texture. This is why it is called baking texture or "rendering to texture". Another kind of those rendering to texture techniques, is the well known normal map wich is also precalculated into a 3D program in a quite similar way.

As It is with pack3d now, the lack of occlusion channel will produce flickering and stuff typical to bad uvw mapping and the like. That is, unless you create a 3d object specifically "made" in the dat file to be rendered SH3 way (you can actually "clone" a SH3 object like one u-boat and overwrite one US sub or whatever with it and bang, no texture flickering but looks out of place due to rendering engine improvements between SH3 and 4 and therefore, is certainly not a solution to be considered).

Well, i hope i didn't sound all too confusing and "academic" lol

ref
12-07-07, 06:06 PM
ref, I use Collada. It's xml, open source and most 3d suites support it directly or using a free plugin. It can hold any info we need for SH3/4, including multiple uv-sets, material info, parent-child relationships, named objects/containers etc. S3D will support export in the next release, and import in the subsequent one.

I will post a guideline and tutorial on 3ds max and Collada in the next weeks. The format does have limitations (basically some manual post-processing) but they are discussed in that tutorial and are only minor issues that you deal once with...

I'll give it a look, I'll download the specs from their site, never worked with XML before, but it can't be that difficult.

Ref

swdw
12-07-07, 06:27 PM
This sounds like the start of a great technical reference. Thanks skwajer and kapitan zur see.

Keep it coming please, and I'll edit / condense it all into a downloadable technical reference once the thread is pretty well played out

skwasjer
12-07-07, 08:45 PM
Thanks kapitan_zur_see, good info :up:.

ref, if you've never worked with xml before, then you better read up on xml in general first before even touching Collada. I have over 8 years experience with xml and done tons of stuff with it (professionally), and personally I thought Collada was not so simple (it's not hard either, but takes some different approaches of what you expect).

That, and if you don't use standardized coding techniques, you'll be in for some serious mess. That doesn't mean one can't learn and try of course. I don't want to keep you from going at it, I'll even help if you need it.

swdw, thanks, that's a good idea. It'll take a month or more though until we are there (I want to wait for the modders input when they get to play with S3D), so no rush :)

[edit] shall I add pictures to the top thread of the different texture maps? The raw texture so to speak...

tater
12-07-07, 09:03 PM
Can't wait to mess with this stuff in a less tedious way :D

tater

kapitan_zur_see
12-07-07, 10:26 PM
As soon as i fix my main computer power unit issue tomorrow (it's R.I.P lol,or at least, i hope it's just the power unit...:-?), i'll do a rendering to texture in 3Dsmax to illustrate occlusion mapping and shows how you make some. I'll also make an illustration on how normal maps are generated in 3DSmax via another rendering to texture function, because much people still thinks their details are all first "hand" drawn in photoshop like you would make a skin and then using a converter normal map filter plugin like the nvidia one. They first make a hi-polygon model (great number of polygons so it is very hires), then they would make an exact copy of the object,but with desired polygons number so your computer can handle it in real time rendering. After that, you simply move them in 3dsmax so they are exactly on the same place (i.e they overlap) and 3dsmax will compare and then interpolate a normal map so you get some close details of the hi-poly model on the low-poly using the normal map.

I think, this could help to make this thread a valuable resource for people who want to understand/experiment whilst not knowing much things about how 3D models and such are done in the gaming industry

gimpy117
12-08-07, 12:28 AM
Ok man, you talking a foreign language to me! Where are you going with this:hmm:

so when the battleship runs you over you can see the wonderful bumpmapped rivets!!

Latency
08-12-09, 09:30 AM
Ok.. we all have to start somewhere, but I am no stranger to the gaming industry, just the modeling as I usually leave that up to the experts.

With this tool, it is really cool and all, but I have to cut and paste the exports as it does not drop in with any of the other pro tools that I have.

One of the things I wanted to do, was UV unwrapping so I can see what I am working with. While I am able to view the mesh no problem, there is an error that I am receiving.

"One of the polygons has a too small or a too large angle (have a look to more then 4 points polygons)" X,Y,Z: -0.000204 0.000018 -0.000020

Okay, after inspection I guess one of the edges pertrudes one of the outside planes and I guess thats an easy fix. But I am still not sure what I am doing here. In the SD3 editor it asks to specify the texture file.. Do I need to calculate the node positioning in the texture file to where my region will be?

This is what I am TRYING to do...

On the game SH4, I have fixed the v1.5 (latest ver) so that the uniform medals are properly displayed. In the TMO v17/18 the awards were yanked out of the box they reside in since the textures have changed and didn't match.

I have opt'd to put those back in, and have successfully put 5/6 of the stock meshes back in.. but I need to modify these old ones slightly and then apply my NEW texture I have supplied in the mod found in "AwardsItems.dds".

You can find it here (http://www.subsim.com/radioroom/showthread.php?p=1149302#post1149302).

First of all, why doesn't the Bronze Star get displayed anymore, and how do I re-texture these from my new file? Notice that the dimensions of the new texture file have changed and has to be recalculated to get the select region.


The .obj file that the SD3 exports isn't compatible with Maya.. but I guess if I knew how to use it I could cut&paste the specs.

I just got 3D Max 9 now.. and tried to open them there. I can open the .mtl of course but thats nothing, the .obj is what has the main mesh in it and it wont load. So what program is compatible with SD3's export feature? I am sure I can eventually figure it out, but I am throwing in the towel. Nor am I an artist, but you must know more than me since you wrote the utility.


Anybody care to help with what I am trying to do.. I can send you the .dds and the .dat file with the objects in there as template. Maybe we can rebuild the .dat file once we get it to work? I assume that the .dat file is SH4 proprietary hence requires this editor to be used.. since it is the only one in existence available to the public.

If you can get me Kashmir..... &#*$#@**@

keltos01
08-12-09, 10:49 AM
As soon as i fix my main computer power unit issue tomorrow (it's R.I.P lol,or at least, i hope it's just the power unit...:-?), i'll do a rendering to texture in 3Dsmax to illustrate occlusion mapping and shows how you make some. I'll also make an illustration on how normal maps are generated in 3DSmax via another rendering to texture function, because much people still thinks their details are all first "hand" drawn in photoshop like you would make a skin and then using a converter normal map filter plugin like the nvidia one. They first make a hi-polygon model (great number of polygons so it is very hires), then they would make an exact copy of the object,but with desired polygons number so your computer can handle it in real time rendering. After that, you simply move them in 3dsmax so they are exactly on the same place (i.e they overlap) and 3dsmax will compare and then interpolate a normal map so you get some close details of the hi-poly model on the low-poly using the normal map.

I think, this could help to make this thread a valuable resource for people who want to understand/experiment whilst not knowing much things about how 3D models and such are done in the gaming industry

adding playable units by Mikhayl :

http://www.subsim.com/radioroom/showthread.php?t=134575

occlusion map (AO map = .O01 ingame )tutorial by Rodan_54:

http://www.subsim.com/radioroom/showthread.php?t=136354

Bump mapping (normal maps = .N01 ingame) by Danlisa :

http://www.subsim.com/radioroom/showthread.php?t=145555

PDF Version of this - http://files.filefront.com/SH4+Bump+.../fileinfo.html (http://files.filefront.com/SH4+Bump+Mappingpdf/;12672567;/fileinfo.html)



I use them all and this thread here should be a sticky too !

great work Skwasjer !

keltos

sergei
08-13-10, 03:28 PM
This is the one I meant to bump :oops:

HMSBellerophon
06-01-11, 01:37 PM
When I export a 3D model from S3D as a .obj, the .mtl file quotes the map_kd as a specific .dds file in a specific place. This is fine, but when I explore the material chunks of the .dat in S3D, which were assigned to the 3D model no mention of the .dds is made. How can I edit the .dds of a texture chunk within S3D, because whenever I import a model with my own .mtl file and my own texture S3D ignores it and applies the texture assigned to the node I am importing into.

chrysanthos
08-15-16, 05:33 AM
now i have reinstall the silent hunter 4 along with 1.5 version and guess what...the pensylvania and colorado class ships are complete black with white gunn turets....and i have activated any mod left....what do you think it is? oh and i tried that in the museum.....

chrysanthos
08-15-16, 05:43 AM
[QUOTE=chrysanthos;2426725]now i have reinstall the silent hunter 4 along with 1.5 version and guess what...the pensylvania and colorado class ships are complete black with white gunn turets....and i have activated any mod left....what do you think it is? oh and i tried that in the museum.....and i have a photo from this mission


http://i1024.photobucket.com/albums/y310/Chrysanthos_Tsiplidhs/silent%20hunter%201.5%20colorado%20nevada%20pensyl vania%20texture%20errors_zpsyqyt8ld4.png (http://s1024.photobucket.com/user/Chrysanthos_Tsiplidhs/media/silent%20hunter%201.5%20colorado%20nevada%20pensyl vania%20texture%20errors_zpsyqyt8ld4.png.html)