SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH4 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=219)
-   -   [TUT] Bump mapping for SH4 in GFX Suites (https://www.subsim.com/radioroom/showthread.php?t=145555)

danlisa 12-16-08 09:25 AM

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

http://i149.photobucket.com/albums/s...Yamato_T01.jpg

The Bump map for this vessel is NBB_Yamato_N01.dds:

http://i149.photobucket.com/albums/s...Yamato_N01.jpg

The Occlusion Map for this vessel is NBB_Yamato_O01.dds

http://i149.photobucket.com/albums/s...Yamato_O01.jpg

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:

http://i149.photobucket.com/albums/s...usionAlpha.jpg

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:

http://i149.photobucket.com/albums/s...leanNormal.jpg

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.

http://i149.photobucket.com/albums/s...hannelMix1.jpg

With the Channel Mixer active:

http://i149.photobucket.com/albums/s...hannelMix2.jpg

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:

http://i149.photobucket.com/albums/s...hannelMix3.jpg

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:

http://i149.photobucket.com/albums/s...hannelMix4.jpg

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

Use these settings:

http://i149.photobucket.com/albums/s...hannelMix5.jpg

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:

http://i149.photobucket.com/albums/s...hannelMix6.jpg

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:

http://i149.photobucket.com/albums/s...hannelMix7.jpg

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:

http://i149.photobucket.com/albums/s...hannelMix8.jpg

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.

http://i149.photobucket.com/albums/s...hannelMix9.jpg

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:

http://i149.photobucket.com/albums/s...annelMix9b.jpg

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:

http://i149.photobucket.com/albums/s...sionAlpha2.jpg

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:

http://i149.photobucket.com/albums/s...sionAlpha3.jpg

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.

http://i149.photobucket.com/albums/s...sionAlpha4.jpg

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.

skwasjer 12-16-08 10:57 AM

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. :up:


[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.

Anvart 12-17-08 04:31 AM

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.
...

http://img172.imageshack.us/img172/237/okyn8.gif
...
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 ...

kriller2 12-17-08 06:02 AM

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.
...

http://img172.imageshack.us/img172/237/okyn8.gif
...
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 :up: 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 ;)

keltos01 12-17-08 07:14 AM

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

:up::up::up::up::up::up:

Keltos

Anvart 12-18-08 07:26 AM

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

Rockin Robbins 12-18-08 10:08 AM

I hear scurrying sounds everywhere as modders rush to check their work and update it thanks to danlisa's contribution.:up:

keltos01 12-18-08 10:49 AM

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

keltos

tater 12-18-08 11:01 AM

Thanks for this tutorial.
:up:

danlisa 12-18-08 11:02 AM

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.

keltos01 12-18-08 11:23 AM

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 :

http://img116.imageshack.us/img116/9422/nobump3qg5.jpg

bump :

http://img356.imageshack.us/img356/7186/bump3iw1.jpg

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 :up: for this superb tutorial, now we see what we missed !!!! :yep:


Keltos

cheese123 12-18-08 06:50 PM

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:
http://img216.imageshack.us/img216/6...5522694ro1.png

And the other side looks like this:
http://img216.imageshack.us/img216/3...5515538ni1.jpg
Might be the lightmap.

Any tips appreciated.

danlisa 12-19-08 03:13 AM

@ 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.;)

keltos01 12-19-08 03:59 AM

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

Anvart 12-19-08 06:34 AM

Quote:

Originally Posted by Rockin Robbins
I hear scurrying sounds everywhere ...

Sorry ...
:lol:
May be you hear sounds of your own gases ... ?


All times are GMT -5. The time now is 11:55 PM.

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.