SUBSIM Radio Room Forums
The newest naval sim by Totem Games!

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

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

Reply
 
Thread Tools Display Modes
Old 12-16-2008, 08:25 AM   #1
danlisa
Sea Wolf
 
danlisa's Avatar
 
Join Date: Oct 2005
Location: Cornwall, UK
Posts: 5,503
Downloads: 42
Uploads: 1
Default [TUT] Bump mapping for SH4 in GFX Suites

A parting gift!

PDF Version of this - http://files.filefront.com/SH4+Bump+.../fileinfo.html

This is primarily for Imported items.

For the purpose of this write up:

The Colour Map/Base Texture will be referred to as the Normal,
The Bump/Height map will be called Bump and then,
The Light/Shadow Map will be referred to as the Occlusion.

Primarily this document will tackle the creation & editing of SH4’s Bump maps with a view of allowing porting of SH3 vessels.

Firstly, anyone creating Ships, Aircraft & Subs from scratch will benefit from creating their respective maps from within their 3D modelling suite, if you are proficient enough to create models then you should be able to render a full set of maps.

So we know what we’re all talking about, the Normal map is the .dds file that holds all the colour texture. An example of this is NBB_Yamato_T01.dds:



The Bump map for this vessel is NBB_Yamato_N01.dds:



The Occlusion Map for this vessel is NBB_Yamato_O01.dds



While we have the Occlusion Map in our minds, it is worth noting that it holds an Alpha Channel. This Alpha Channel is a duplication of the Normal Map. As shown below:



We’ll talk about how to add this detail in later. Although, currently I am unsure how SH4 uses this. We’ll add it for completeness.

To generate Bump maps for imported SH3 models, we’ll need a Photoshop Plugin from Nvidia. There are various tools available from other software developers but I work & prefer Photoshop, also dang it, I paid for CS4, I want to use it.

You will need to install this plugin from the Nvidia website : http://developer.nvidia.com/object/photoshop_dds_plugins.html

Once you have done this we can begin.

I’ll continue to work with the file set from the Yamato as we will have SH4 Dev created version to compare our to.

Generating the Bump map from the Normal Map:
Open the NBB_Yamato_T01.dds in Photoshop, using ‘Load Default Sizes’ when the popup prompts you.

With the Normal Map at full resolution you can see that it’s actually very ‘dirty’. This presents us a small problem as the method we are about to use will generate a Bump map from the virtual High & Low points on the Normal Map. These High/Low points are decided by their virtual colour depth.

If you compare the Normal Map with the Dev version of the Bump Map, you can see huge differences. Here’s the Dev Bump Map with the Red & Blue Channel highlighted:



You can clearly see that the Normal Maps have been retouched after the generation of the Bump map.

The easiest way to accomplish this ‘clean’ generation of a Bump map is to recreate your Normal map using only Black & White to allow the generation of High & Low points for the Nvidia plugin to use.

Remember, SH4 uses White as the Low Point and black as the High point. Grey can be used for a Neutral height.

For the purpose of this tutorial, I’m not gong to mess about recreating the Normals in Black & White levels but rather demonstrate a way to ‘muddle’ though using Channel Mixers and Negative Filters. It won’t be perfect but if you want perfection, you need to go the long way and start from scratch.

Ok, using the Yamato Normal Map, we need to edit this texture so that the High/Low points are accented so that the Nvidia Plugin can use that information. Remember we are trying to get Low points as White and High points as Black.

Step 1) Either use the Black/White filter adjustment or use the Channel Mixer in the Layers palette. I assume you know how to do this.



With the Channel Mixer active:



Step 2) Now Merge the Visible Layers. We do this because the Bump Map generation will only work with ‘flat’ images.

Step 3) (Optional) Use the Contrast or Exposure adjustments to further accent your Black & White levels. I did:



Now, if we generated a Bump Map from this image, our High/Low point will be reversed. We need to invert our image, I find using the Negative adjustment to accomplish this works best as it allows more control by using the Curves option:



Step 4) Use the Nvidia Filter to generate the Bump map. Filter > Nvidia Tools > NormalMapFilter.

Use these settings:



If memory serves, you must Invert the Y axis during creation otherwise some very strange lighting/shadows will occur when viewing at angles.

Click OK!

Now, you should notice two things.

Firstly, how ‘dirty’ and undefined the Bump map looks. This is where a ‘clean’ Normal Map comes into it’s own. If you take the time to create one you will get much better results.

Secondly, the more observant of you may have noticed that it looks nothing like a SH4 Dev Normal. Ah you say, mines Bluish Purple but theirs is Green, why’s that? Well, I’m unsure as to the reason but the Sh4 Devs swapped the Blue & Green Channels. You must do this as other wise your in game model will display some very strange colour traits.

For completeness, here’s the method to swap the Channels over.

Arrange your workspace so that you can see the Bump Map and the Channels Palette, like so:



Click on the New Channel button at the base of the Palette. This will create a layer called Alpha Channel.

Now click on the Green Channel, the go Select > All. This creates a selection around the Green Channel. Now go to Edit > Copy. The Green Channel is now copied.

Click on the Alpha Channel to make it the active layer and then go Edit > Paste.

Your Bump Map & Channel Palette should now look like this:



Now click on the Blue Channel to make it the Active Layer.

Go Edit > Copy. Then Click the Green Channel and go Edit > Paste.

Your workspace should now look like this:



Now, click on the Alpha Channel to make it the Active layer. Go Edit > Copy.

Click on the Blue Channel and go Edit > Paste.

Now, drag and drop the Alpha Channel to the Bin at the bottom of the Palette.



Your Bump map now resembles the Sh4 Dev version. Well Done! (You may notice that Port Holes are reversed in relation to the Dev versions but this makes little difference ingame. You can achieve the same result if making your Normal Map for Bump generation by hand.

To save your new Bump Map, use these settings:



Using the shown format will result in a more accurate and better defined .dds file after the tool has compressed your finished file.

This ends the Bump Map creation tutorial. You may have to enable the vessels dat & roster cfg files to accept the additional files but I’ll leave that to your or others.

Finally, do you remember that at the beginning of this tutorial I mentioned the Alpha Channel that was embedded within the Occlusion Map. We’ll now discuss how to achieve those results. It’s rather easy as you have already done the basics by doing the Bump Creations.

Open NBB_Yamato_O01.dds & NBB_Yamato_T01.dds in Photoshop. For the purpose of this tutorial I have deleted the Alpha Channel in the Occlusion Map already.

Step 1) On the Yamato Normal map ensure that you have the Channels Palette open.

Step 2) Hold down CTRL and click on the Blue Channel. This creates a selection on the blue channel as so:



Step 3) Go Edit > Copy

Step 4) Make the Occlusion Map the active workspace. If you deleted the existing Alpha Channel as I did, create a new Channel, make it the active channel by clicking on it and then go Edit Paste. Enable all the Channels by clicking on the RGB channel. You should see this:



The same as the one first shown at the beginning of this document.

Step 5) Saving! As this .dds has an Alpha Channel we need to use a different format to save this and retain the information we just added to the Occlusion Map.



Using this format allows for both greater clarity/detail while retaining the Alpha information. Please note that you could use any of the Channels from the Normal map within the Occlusion map, I have noticed no difference ingame.

I hope this helps.

This is a quick and dirty way to generate these files for imported vessels. I don’t propose that this is the best way but it works.

The terminology I have used may not be industry correct but I hope it was easy to understand for everyone.

This document was produced for the betterment of the Sub Sim community. Take it as it was meant.

Goodbye.
__________________
danlisa is offline   Reply With Quote
Old 12-16-2008, 09:57 AM   #2
skwasjer
The Old Man
 
Join Date: Apr 2007
Location: Netherlands
Posts: 1,545
Downloads: 25
Uploads: 3
Default

Hi Danlisa, thanks for the tutorial, good job.

Some remarks:
- the alpha channel of the AO texture is actually a 'specular mask'. You can see evidence of this in the SH4-shaders (I've investigated this for the upcoming S3D icw. texture support). The specular mask however can also be in the alpha channel of the base texture (if this doesn't need the alpha channel!), and this difference is indicated in the UnifiedRenderControler where you have the option UseSpecularFromDiffuse (yes/no), where no implies to use it from the AO-map.

Here's another good specular map tutorial: http://www.wonderhowto.com/how-to/vi...-max-8-196435/

- the green/blue channels are swapped because the game also has two axis swapped (YZ), or at least, that's what I guess. It makes more sense to swap the values in the textures, then do it in the shader at the expense of cpu-cycles.

I think it's a decent way to get bumpmaps for low poly models, but it is not as good as generated normal maps from high poly models (although this may not give the desired result from the get-go either). That said, we don't have access to alot of older (SH3?) high poly models, so it's good to know this method.


[edit] As an aside to those interested in this subject, take a look at this thread I made a year ago:

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

It's not a tutorial, but does describe all the different maps and shows them applied to the Yamato in different stages.

Last edited by skwasjer; 12-16-2008 at 10:16 AM.
skwasjer is offline   Reply With Quote
Old 12-17-2008, 03:31 AM   #3
Anvart
Admiral
 
Join Date: Jan 2006
Location: Russia ®, E-burg
Posts: 2,354
Downloads: 65
Uploads: 1
Default

Quote:
Originally Posted by skwasjer
...
Some remarks:
- the alpha channel of the AO texture is actually a 'specular mask'. You can see evidence of this in the SH4-shaders (I've investigated this for the upcoming S3D icw. texture support). The specular mask however can also be in the alpha channel of the base texture (if this doesn't need the alpha channel!), and this difference is indicated in the UnifiedRenderControler where you have the option UseSpecularFromDiffuse (yes/no), where no implies to use it from the AO-map.
...

...
and skilled modders can create bump map manually (as variant withoit Hi-Low poly) ...
using Photoshop and Emboss filter ... you can create two images with different corners (one of variants!!! ... differ. = 100° (80° ... 100°))
and other parametres of the filter and then copy these two images into Red and Blue channels or in others ...
__________________
Alex ®

Last edited by Anvart; 12-18-2008 at 06:22 AM.
Anvart is offline   Reply With Quote
Old 12-17-2008, 05:02 AM   #4
kriller2
Ace of the Deep
 
Join Date: Apr 2005
Posts: 1,227
Downloads: 19
Uploads: 0
Default

Quote:
Originally Posted by Anvart
Quote:
Originally Posted by skwasjer
...
Some remarks:
- the alpha channel of the AO texture is actually a 'specular mask'. You can see evidence of this in the SH4-shaders (I've investigated this for the upcoming S3D icw. texture support). The specular mask however can also be in the alpha channel of the base texture (if this doesn't need the alpha channel!), and this difference is indicated in the UnifiedRenderControler where you have the option UseSpecularFromDiffuse (yes/no), where no implies to use it from the AO-map.
...

...
and skilled modders can create bump map manually (as variant withoit Hi-Low poly) ...
using Photoshop and Emboss filter ... you can create two images with different corners (one of variants ... differ. = 100°)
and other parametres of the filter and then copy these two images into Red and Blue channels or in others ...
Yep! that was how I made the bumpmaps for the "Warships retextured" and the PE project, it may not be 100% correct but it does the job.

Thanks for the tutorial Danlisa It's nice to see you care about the community and are trying to help the modders in the right direction.

..And Skwasjer your wisdom about these things never stops to amaze me
__________________
Kriller2.
[MODs]

Real Environment mod

and Pacific Enviroments 4 mod

Last edited by kriller2; 12-17-2008 at 05:05 AM.
kriller2 is offline   Reply With Quote
Old 12-17-2008, 06:14 AM   #5
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: piétrebais belgium
Posts: 4,986
Downloads: 109
Uploads: 18
Default

thanks a bunch ! I will now try and make one for my Jyunsen B for starters



Keltos
__________________
"Honorable Builder of Sinking Ships"

keltos01 is offline   Reply With Quote
Old 12-18-2008, 06:26 AM   #6
Anvart
Admiral
 
Join Date: Jan 2006
Location: Russia ®, E-burg
Posts: 2,354
Downloads: 65
Uploads: 1
Default

...
and can try: http://shadermap.renderingsystems.com/
http://crazybump.com/forum/index.php
__________________
Alex ®

Last edited by Anvart; 12-18-2008 at 06:37 AM.
Anvart is offline   Reply With Quote
Old 12-18-2008, 09:08 AM   #7
Rockin Robbins
Ubuntu Linux for the Win!
 
Join Date: Mar 2007
Location: DeLand, FL
Posts: 8,522
Downloads: 126
Uploads: 53


Default

I hear scurrying sounds everywhere as modders rush to check their work and update it thanks to danlisa's contribution.
Rockin Robbins is offline   Reply With Quote
Old 12-18-2008, 09:49 AM   #8
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: piétrebais belgium
Posts: 4,986
Downloads: 109
Uploads: 18
Default

but submarines don't use those n01 files now do they ???

keltos
__________________
"Honorable Builder of Sinking Ships"

keltos01 is offline   Reply With Quote
Old 12-18-2008, 10:01 AM   #9
tater
Navy Seal
 
Join Date: Mar 2007
Location: New Mexico, USA
Posts: 9,058
Downloads: 8
Uploads: 2
Default

Thanks for this tutorial.
tater is offline   Reply With Quote
Old 12-18-2008, 10:02 AM   #10
danlisa
Sea Wolf
 
danlisa's Avatar
 
Join Date: Oct 2005
Location: Cornwall, UK
Posts: 5,503
Downloads: 42
Uploads: 1
Default

Quote:
Originally Posted by keltos01
but submarines don't use those n01 files now do they ???

keltos
Why? Because they don't have them in their folder?

Check the Dats, Roster & Folders of vessels that do, compare the differences and ask yourself "Why shouldn't a Sub have a bump map?", in fact, why can't any object in Sh4 have a Light & Bump map.
__________________
danlisa is offline   Reply With Quote
Old 12-18-2008, 10:23 AM   #11
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: piétrebais belgium
Posts: 4,986
Downloads: 109
Uploads: 18
Default

I've made two, one for the Jyunsen B and one for the Type AM submarine.

I've uploaded them on my main FF page, for those who have my mod and wanna try to get them working

I've changed this in the NSS_Jyunsen_B.upcge :

[UserPlayerUnit 1]
ID=Jyunsen_B
NameDisplayable=Jyunsen B
UnitName= SS-I 25
Type=Jyunsen_B
UpgradeClass=2
UnitInterval= 1941-10-01, 1945-12-31
ExternalClassName=SSJyunsen_B
Nationality=German
CrewRanks=15
Evolution= Normal
Damage= 0
TextureName=data/Submarine/NSS_Jyunsen_B/NSS_Jyunsen_B_T01.tga
LightmapTextureName=NULL; data/Submarine/Nss_Jyunsen_B/NSS_Jyunsen_B_001.tga
NormalmapTextureName= data/Submarine/Nss_Jyunsen_B/NSS_Jyunsen_B_N01.tga
MenuSilhouetteTextureName= Jyunsen_B_1.tga
MaxPettyOfficers=32 ; max number of crewmembers over rank 4
MaxOfficers=6 ; max number of crewmembers over rank 7


no bump :



bump :



A picture is worth a 1000 words....





so all we have to do is activate the bump map ! good idea Skwasjer !!!

And thanks to Danlisa for this superb tutorial, now we see what we missed !!!!


Keltos
__________________
"Honorable Builder of Sinking Ships"


Last edited by keltos01; 12-18-2008 at 03:04 PM.
keltos01 is offline   Reply With Quote
Old 12-18-2008, 05:50 PM   #12
cheese123
Gunner
 
Join Date: Dec 2007
Location: on some striat
Posts: 96
Downloads: 1
Uploads: 0
Default

I don't understand, I followed the tutorial and I still get this weird result, one side of the ship is normal with bump maps:


And the other side looks like this:

Might be the lightmap.

Any tips appreciated.

Last edited by cheese123; 12-18-2008 at 08:18 PM.
cheese123 is offline   Reply With Quote
Old 12-19-2008, 02:13 AM   #13
danlisa
Sea Wolf
 
danlisa's Avatar
 
Join Date: Oct 2005
Location: Cornwall, UK
Posts: 5,503
Downloads: 42
Uploads: 1
Default

@ Cheese123

Let's see your 3 texture files. You are probably right, the Occlusion map maybe at fault. How did you generate it? 3ds Max? or similar?

The first thing that stands out (and this will be unique to all imported vessels & skins) is that the camo scheme, which is applied to the Normal/Colour map in SH3 is NOT implemented in the same way in SH4. Camo & Colouring must be applied to the Occlusion (light) map, otherwise, as with your screengrab, you'll see that the hull stripe has been bumped. Alternatively, is you think about it before, generating the Bump map from the Normal before a camo/colour scheme is added might also work.

To correctly import SH3 models into SH4 (to an SH4 standard) requires knowledge of either Photoshop texture creation or Max/Maya Bump/Occlusion rendering (to texture) from a lit model. However, in this instance, the only way to create an Occlusion map is to render one from a 3D Suite. Once you nail the process down it's quite easy. For additional added effect, render a Light & Shadow map and then merge them, the final result will be better than each individually.
__________________
danlisa is offline   Reply With Quote
Old 12-19-2008, 02:59 AM   #14
keltos01
Silent Hunter
 
Join Date: Feb 2008
Location: piétrebais belgium
Posts: 4,986
Downloads: 109
Uploads: 18
Default

Quote:
Originally Posted by danlisa
@ Cheese123

Let's see your 3 texture files. You are probably right, the Occlusion map maybe at fault. How did you generate it? 3ds Max? or similar?

The first thing that stands out (and this will be unique to all imported vessels & skins) is that the camo scheme, which is applied to the Normal/Colour map in SH3 is NOT implemented in the same way in SH4. Camo & Colouring must be applied to the Occlusion (light) map, otherwise, as with your screengrab, you'll see that the hull stripe has been bumped. Alternatively, is you think about it before, generating the Bump map from the Normal before a camo/colour scheme is added might also work.

To correctly import SH3 models into SH4 (to an SH4 standard) requires knowledge of either Photoshop texture creation or Max/Maya Bump/Occlusion rendering (to texture) from a lit model. However, in this instance, the only way to create an Occlusion map is to render one from a 3D Suite. Once you nail the process down it's quite easy. For additional added effect, render a Light & Shadow map and then merge them, the final result will be better than each individually.

occlusion map tutorial (requires 3D Studio) :

http://www.subsim.com/radioroom/showthread.php?t=136354
__________________
"Honorable Builder of Sinking Ships"

keltos01 is offline   Reply With Quote
Old 12-19-2008, 05:34 AM   #15
Anvart
Admiral
 
Join Date: Jan 2006
Location: Russia ®, E-burg
Posts: 2,354
Downloads: 65
Uploads: 1
Default

Quote:
Originally Posted by Rockin Robbins
I hear scurrying sounds everywhere ...
Sorry ...

May be you hear sounds of your own gases ... ?
__________________
Alex ®

Last edited by Anvart; 12-20-2008 at 02:03 AM.
Anvart 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 03:41 AM.


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