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 05-06-08, 04:15 AM   #1
rodan54
Navy Dude
 
Join Date: Oct 2006
Location: California, USA
Posts: 176
Downloads: 4
Uploads: 0
Default [TEC] Ambient Occlusion Tutorial

This, hopefully easy to understand, tutorial is meant to allow prospective and current SH4 modelers a means to create those tricky Ambient Occlusion texture maps for their future shipping releases.

Anyhoo, before getting started I just want to make a few notes.

1. This was all done in 3dsmax 9, so methods in other modeling suites may vary.
2. This is done using a completely original Mesh, so don't assume that it works in the same way for modded/kitbashed stock ships although I'd imagine it'd be pretty similar.
3. I haven't spent too much time adjusting the various parameters mentioned throughout this tutorial, so feel free to experiment.
4. Finally, I don't claim to be literate with 3dsmax in anyway shape or form, and am still slowly learning; therefore, if there are any errors, ommissions, or perhaps better methods than what is desribed here, then please do say so.

----------

Lets begin.

1. First of course you'll need to load up your model into max. Once that is done then navigate along the top menu bar to 'Rendering', and click on 'Render' in the roll down menu. This will bring up the 'Render Scene Dialog'. Now under the 'Common' tab navigate all the way down to the bottom and expand out the menu with the header 'Assign Renderer', click on the box next to 'Production' and select Mental Ray as the rederer. Click "Ok" and close out the 'Render Scene Dialog'.



2. Alright now with your ship selected, go back to the 'Rendering' menu list and select 'Render to Texture' which will open a new menu. For this perticular example my Tone model was not uv mapped, so in the 'Mapping Coordinates' section I have 'use automatic unwrap' checked which will generate new uv coordinates to be used by the Ambient occlusion map.



3. Just below the 'Mapping Coordinates' section is the 'Output' roll out in which you'll want to add an 'Ambient Occlusion (MR)' from the list of available options that opens up.



4. Once that's done then scroll down a bit more, and set the maps size for 1024x1024. In addition set the number of samples to 80 and spread to 1.0 in the 'Selected Element Unique Settings' section. Also under 'Automatic Unwrap Mapping' set the spacing to 0. Leave everything else as is and click 'Render'.



5. It might take a little while for max to compute all the numbers, so go get a cup of coffee while you wait. Once max is done rendering, and if you followed the tutorial properly then there will be a texture at the location specified previously under 'General Settings' in the 'Render to Texture' menu that should look something similar to this.



Hmm, not too bad.
Here's the Tone with ^ applied. And yes she is a WIP just in case anyone felt like pointing out her missing anchors.



----------

Last edited by rodan54; 05-06-08 at 03:36 PM.
rodan54 is offline   Reply With Quote
Old 05-06-08, 04:33 AM   #2
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: Milan Italy
Posts: 4,999
Downloads: 114
Uploads: 18
Default waow

just what I was missing ! will post image when my Jyunsen B is rendered

damn ! I have to redo the conning tower now

thanks a lot

there goes what I've done :


is it normal that the option "ambiant occlusion mR" disappears from the menu when it's rendered to file ?

here applied to the mesh :

[url=http://imageshack.us]
__________________
"Honorable Builder of Sinking Ships"


Last edited by keltos01; 05-06-08 at 08:56 AM.
keltos01 is offline   Reply With Quote
Old 05-06-08, 04:54 PM   #3
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

Does the 2nd map channel in S3D show you the correct uv map in the preview window? It sounds like the uv coordinates aren't right. If they are right though, then I'd like to have a look at the .dat.

Oh, and you may want to check if SelfOccEnable is true in the UnifiedRenderControler.
skwasjer is offline   Reply With Quote
Old 05-06-08, 06:40 PM   #4
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

The model is fine. But the problem you are having may be the key to some hidden data in the material chunk. I will want to investigate this further, but to do this I will need a ready to use mod with this dat-file. Do you have a testmod available for me, or can I just pick your current public release with this dat? I have been guessing for a long time about the remaining few bytes of materials (and am almost sure about some, just not 100%), and would like to find out.

One other thing I do notice is the node order. The 2nd material splits the first material. You may want to first try if moving the label and illum chunk directly after the parent material does anything.
skwasjer is offline   Reply With Quote
Old 05-07-08, 11:05 AM   #5
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

Hi Mikhayl, I've taken a look, and it's not a problem at all in the .dat. It's a problem with the texture. The artifacts you see in game are in fact not the ambient occlusion map itself (the AO map is rendered OK!), but the specular map that is rendered. I noticed this immediately because I only saw the artifacts when I moved the cam (iow. the angle vs the sun changed).

Then I looked at the O01 DDS, and there I saw indeed the AO map was also in the alpha channel of the texture, which is wrong. The alpha channel is reserved for the specular map. So, I copied a grayscale version of the T01 map (which is quick-n-dirty, you'd want to make a true specular map) into the alpha channel, and she rendered fine. This is the texture I used:

http://sh4.skwas.net/temp/NSS_Uboat2b_O01.rar

PS: You should also provide the extra mipmaps. You can choose this as an option when saving to DDS.
PS2: The AO map could use a little more detail.
PS3: The specmap uses the same uv-data as the diffuse map.

Last edited by skwasjer; 05-07-08 at 12:58 PM.
skwasjer is offline   Reply With Quote
Old 12-11-08, 02:50 PM   #6
tater
Navy Seal
 
Join Date: Mar 2007
Location: New Mexico, USA
Posts: 9,023
Downloads: 8
Uploads: 2
Default

Punt for info.

Let's say you take an object from one ship (a carried boat, for example) and put it on another.

The occlusion map fouls up the way it looks where it is now. Do you need to export the ship plus the boat, then make a new o-map?
tater is offline   Reply With Quote
Old 12-11-08, 03:41 PM   #7
rodan54
Navy Dude
 
Join Date: Oct 2006
Location: California, USA
Posts: 176
Downloads: 4
Uploads: 0
Default

I'm pretty sure you'd just export your ship plus any new parts, position them accordingly in max and create the new AO map. Then import the separate objects back into the .dat and replace the existing AO map with the newly created one.

I think that's about what you were getting at.

Last edited by rodan54; 12-11-08 at 03:42 PM.
rodan54 is offline   Reply With Quote
Old 12-11-08, 04:23 PM   #8
miner1436
Grey Wolf
 
Join Date: Jul 2007
Posts: 808
Downloads: 107
Uploads: 3
Default

How is the Tone coming along anyway?
miner1436 is offline   Reply With Quote
Old 01-05-09, 09:23 AM   #9
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: Milan Italy
Posts: 4,999
Downloads: 114
Uploads: 18
Default copy of texture in alpha channel of _001.dds file




I noticed a thing in the game's yourbeautifulsub_001.dds which I didn't do on mine :
there is an alpha channel under the 3 channels of the occlusion map image, but it has
not the occlusion map itself but a copy in B/W and positive of the
yourbeautifulsub_T01.dds file
with a higher ratio of contrast/brightness !

This is why my models were always so shiny : they were lacking that level of details in the alpha channel !

I will try and remedy to that.

I found it editing the UbootIXD2_001 file...

So much to find out still...

Keltos
__________________
"Honorable Builder of Sinking Ships"


Last edited by keltos01; 06-06-09 at 01:39 AM.
keltos01 is offline   Reply With Quote
Old 06-04-09, 03:56 PM   #10
runningdeer
Frogman
 
Join Date: Mar 2008
Location: Huntley, IL
Posts: 305
Downloads: 142
Uploads: 1
Default

Thank you vm for this incredible tool. I cannot afford a 3D program.

I am new to skinning boats. But I am learning quickly. I have been using my photoshop CS3 to create and apply my skins.

One thing that I would like to be able to do is to place numbers or images on the left side of the boat, but have them going the right direction. I have worked with the occlusion maps to get the effect, but I understand that trying to edit the occlusion files with my photoshop is merely casting a shadow...and so I get that blurred look as well as only being able to use a black color against a lighter colored skin.

I was wondering if this tutorial would be the one to follow in order to learn how to apply actual font/image, and in any color.

Could someone please put me on the right track, so that I can learn this?

I did try googling 'occlusion mapping' and such like that, but found myself in a sea of confusion.

Thanx all for your time & help.
__________________



Last edited by runningdeer; 06-04-09 at 04:14 PM.
runningdeer is offline   Reply With Quote
Old 06-04-09, 04:13 PM   #11
ichso
Ace of the Deep
 
Join Date: Jul 2005
Location: Germany's oldest city alive
Posts: 1,066
Downloads: 57
Uploads: 0
Default

I think I have to disappoint you there. As you know, you can't just paint some font onto your sub because there is only the right side of it used from a texture file and the left side is just a mirrored version of the right one.

The occlusion map however shows both sides individually but as I understand it, has nothing to do with coloring, just with lighting. It is one of those cheaper tricks to create shadowy effects on 3D objects without calculating actual shadow/lighting values (as would be done in ray traying for example).
So if you draw something on this occlusion map the particular spot will just be left out for shadowing/lighting. I don't understand this to it's fullest effect but it seems as if an area on the occlusion map that you change from this light grey color to something else is just not lighted at all when the texture is mapped onto the 3D object. And not being lighted means that is appears all black in the game.
This side effect can be used to display forms like fonts but no varying colors, I'm afraid.

What we would need would be that the game engine uses different texture information for both sides of the sub, which it simply doesn't do (was that different in SH3 btw ?).
ichso is offline   Reply With Quote
Old 06-04-09, 04:20 PM   #12
runningdeer
Frogman
 
Join Date: Mar 2008
Location: Huntley, IL
Posts: 305
Downloads: 142
Uploads: 1
Default

Ok...I suppose then that I need to learn how to create a new occlusion map.

Its either the Skipjack or Ohio SSBN sub mods that have the numbers on the tower.

Hmmmmm....
__________________


runningdeer is offline   Reply With Quote
Old 06-04-09, 04:39 PM   #13
ichso
Ace of the Deep
 
Join Date: Jul 2005
Location: Germany's oldest city alive
Posts: 1,066
Downloads: 57
Uploads: 0
Default

Occlusion maps won't help you much, I think.

But what just came to my mind is that in S3D you can set an id for the texture file being used and probably also change the uv map.

So, if you create a new, larger texture file (the ...T0x.dds ones) and give the 3d model a new uv map that referres correctly to this larger texture you might be able to make the game using different areas of the texture file for each side of the sub.
Just a thought.
ichso is offline   Reply With Quote
Old 06-04-09, 04:41 PM   #14
runningdeer
Frogman
 
Join Date: Mar 2008
Location: Huntley, IL
Posts: 305
Downloads: 142
Uploads: 1
Default

...man, I hope so ichso (that rhythms).
__________________


runningdeer is offline   Reply With Quote
Old 06-05-09, 06:16 PM   #15
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,547
Downloads: 26
Uploads: 3
Default

You can use color in an AO-texture. Just understand that full white allows the original underlying color to pass through fully, where black fully blocks it. So when having some pixels as 'red' in an AO map, it will essentially only allow the red channel of the texture underneath to pass through. The technique can be used in a limited way though, since you can't paint/overlay white colors this way. It is however perfect for darkening areas of a model, or even tuning the colors a bit (due to light sources or whatever).

For adding text to a specific place on a ship, I recommend using decals. This is a simply geometric flat mesh, positioned close to the side of a wall for instance, and then you put a (transparent) texture on it. But you'll need a 3D program to create that mesh though.
skwasjer is offline   Reply With Quote
Reply


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 07:25 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.