Author Topic: photoshop cs2 and normal map plugin  (Read 17700 times)

0 Members and 1 Guest are viewing this topic.

photoshop cs2 and normal map plugin
I've got a Hecate mk 2 (i forget who made it, please forgive meh) I decided to try my hand at this normal map thing again. I *think* i have the idea down but once ive saved the map, i'm not seeing that its doin anything. I'm only doing it on 1 texture the ship is using but its all over it (helheim01a fyi) I'm not sure if I'm saving it in the right format.

i created a gray scale outline from the diffuse map of what i wanted to give some depth to, and i only used 2 shades darker than my neutral background. i then combined the outline with the background and tried a few diff things but nothing seems to wanna carry over to the game  :hopping:

Firstly, do i need to apply the normal map filter before I save it or do i do that through the plugin pop up when you go to save it and set the normal map settings and format through there?

Secondly I'm a bit confused as to what I need to set in the filter... Right now im using min 0 scale 7 7x7 sample Average RGB and Invert Y... the 3d preview shows the depth I'm looking for fairly well... but like it doesn't seem to be showing any depth in game.

the ship is in a vp i slapped together a few months ago and i have the map sitting all by itself in the mod's data/maps dir

And yes im saving it as a DDS, in the 3Dc 8bpp xy normal map format.
« Last Edit: November 26, 2008, 11:51:59 pm by Vertigo 7 »

 

Offline Colonol Dekker

  • HLP is my mistress
  • 213
  • Aken Tigh Dekker- you've probably heard me
    • My old squad sub-domain
Re: photoshop cs2 and normal map plugin
There's a normal map tutorial in FreeSpace modding somewhere. Bear with me, once i get to a standard connection i'll post a link. . .
Campaigns I've added my distinctiveness to-
- Blue Planet: Battle Captains
-Battle of Neptune
-Between the Ashes 2
-Blue planet: Age of Aquarius
-FOTG?
-Inferno R1
-Ribos: The aftermath / -Retreat from Deneb
-Sol: A History
-TBP EACW teaser
-Earth Brakiri war
-TBP Fortune Hunters (I think?)
-TBP Relic
-Trancsend (Possibly?)
-Uncharted Territory
-Vassagos Dirge
-War Machine
(Others lost to the mists of time and no discernible audit trail)

Your friendly Orestes tactical controller.

Secret bomb God.
That one time I got permabanned and got to read who was being bitxhy about me :p....
GO GO DEKKER RANGERSSSS!!!!!!!!!!!!!!!!!
President of the Scooby Doo Model Appreciation Society
The only good Zod is a dead Zod
NEWGROUNDS COMEDY GOLD, UPDATED DAILY
http://badges.steamprofile.com/profile/default/steam/76561198011784807.png

 
Re: photoshop cs2 and normal map plugin
The about normal maps post? I think that may be the post you're talkin about. If so I've been all over it like a sponge just a couple of things aren't adding up to me

 
Re: photoshop cs2 and normal map plugin
ok so I just discovered F3 from the main menu... the normal maps are working, i guess i just wasn't far enough away to be able to tell? That being the case how far away from a surface should I be to see the detail from a normal map?

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: photoshop cs2 and normal map plugin
ok so I just discovered F3 from the main menu... the normal maps are working, i guess i just wasn't far enough away to be able to tell? That being the case how far away from a surface should I be to see the detail from a normal map?


The closer you are, the better you should see the normal mapping detail, because in mip maps the reducing resolution tends to often blur the normal detail a bit.

Which points did you need help with?
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 
Re: photoshop cs2 and normal map plugin
Well then I guess my normal map isn't working right. I can't tell they are on when i'm close to the object. I'll post some screens in a sec...


first 2 screens are taken from the F3 area. The only texture i created a normal map for is the main hull texture. If the rest of them have a normal map its included in the mediavp's


normal maps on



normal maps off


and these 2 are taken in game






i donno if its just me or what but i can't tell the normal maps are working up close, from far away i can see the detail in the large areas on the texture that are noticeably depressed.

« Last Edit: November 27, 2008, 05:22:40 pm by Vertigo 7 »

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: photoshop cs2 and normal map plugin
Could you post images of your heightmap (greyscale) and the normalmap (purple) generated of the heightmap plox?

Also, describe what you do to the purple normal map to get it into the game.
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 
Re: photoshop cs2 and normal map plugin
sure...

simply with photoshop i stroked and filled the areas i wanted to give some depression to



then i used color replacement tool, the darker blue areas became the almost black areas while the lighter blues became the slightly darker gray areas. The tool didn't quite work the way I wanted for it to. I wanted the edges to be a bit darker than they came out and the bigger areas to be not quite as dark but i figured just to get this to work (so i can see the results first hand) it was sufficient




as the map stands right now i ran the filter before saving, i used 9x9 filter, scale 15 (i was using 7 but i stepped it up to see if that was why) average RGB and invert Y. Saved as .DDS DXT5_NM


*edit
ehh the purple picture when I opened it back up in photoshop is grayscale (is it sposed to be after saving it?) it was purpleish pre saving... i'll run a filter again and show yas...


« Last Edit: November 27, 2008, 06:07:08 pm by Vertigo 7 »

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: photoshop cs2 and normal map plugin
Well, first of all you should - in my opinion - use a bit stronger seam lines. Remember that the absolute depth is not saved to the normal map, but rather change of depth - which means that width of a transition from low to high (or gradient) can mean as much - or more - to the profile of the normal map detail, as the actual apparent height difference between high ground and low ground.

So basically a sharp edge between black and white will translate to as narrow and steep change from low to high, while blurred edges will end up rounded and low-sloped transitions that might look good with organic models, landscapes and stuff like that, but rarely cut it for ship textures. Also, FS2_Open tends to require rather strong normal maps for them to look good (and be worth using). Too subtle, and you might as well not use them and save the performance for something else.

Another thing that I personally have noticed while using a normal map plugin to generate normal maps - working on higher resolution makes a big difference in the end result.



As an example, I resized your texture to 2048^2, applied some filters to make the seam lines a bit stronger and sharper (see above) (Selective Gaussian Blur is awesome), then applied normal map at 9x9, scale 30, applied still some filters to get rid of jpeg artefacts (Selective Gaussian Blur is awesome) which won't be a problem for you since you have the originals, then resized it to 512 and ended up with this:



FS2_Open shader system uses a set-up where it reads the green channel and alpha channel of an image for u/v co-ordinate normals data. Red and blue channels are completely ignored. This is called normal map-style DDS file, and the most common format is dxt5nm since it takes advantage of the awesome dxt5 compression. However you shouldn't be too confused by the -nm suffix in the file type; the file is a normal dxt5 file with some channel management to take care of the normals information being in the correct channels.

When you save into FS2_Open-usable normal map, you have two options. One way is to save the purplish normalmap into dxt5nm compressed file with a DDS plugin, which does the trick in the sense that FS2_Open should be able to read the file. This file will indeed look like a grayscale (with some transparency) since most dxt5nm saving procedures move the red channel into alpha  channel and copy green channel to red and blue channels to make an uniform RGB image. If you're just starting, it might be easiest to just use this method at least while you're getting your normalmapping technique itself sorted out.


However, the other option seems to offer slightly better compression quality in some cases, and that is to:

step 1 - manually copy red channel to alpha channel

step 2 - manually fill red and blue channels with black, which reduces the amount of information that the DXT compression needs to store, to some extent.

step 3 - save as any DDS file that has full alpha channel, but not dxt5nm since it will just ruin your channel management with it's own and you end up with bad file. Basically, you have two options - if you want a compressed normalmap, use dxt5 compression; if you want superior quality (and superior memory usage) or the map simply doesn't compress properly (can sometimes happen) - use uncompressed u8888 DDS file.

The resulting file will look green with some transparency instead of gray with some transparency, since it has black in red and blue, information in green and alpha channels. Don't be troubled with the green-ness. This dickery with channels sometimes makes a difference to how well the image is compressed by the dds utilities - and anyway, it's good practice to just keep the necessary information in the image. At least in my opinion. This file with correctly managed channels looks like this:



You could copy that png file, save it into texturename-normal.dds with dxt5 compression and it would work - although due to remnants of jpg compression it would look rather lumpy and bad most likely, so you shouldn't do this but rather try doing something like this with your source files. This isn't a standard set in stone, though, I would need to test the normalmap with the model in-game to perform adjustments, but I hope you get at least something out of this message.

Oh, and by the way you should invert y normals in your plugin to get correctly aligned normals on vertical axis. The Photoshop normalmap plugin defaults it into wrong direction considering FS2_Open usage (or FS2_Open shaders use a backwards setting, I dunno which option actually is more descriptive). Interestingly, GIMP normalmap plugin produces correctly aligned normal maps right off the bat. In a nutshell, if you have an extrusion (bright) on the height map, cyan should be on it's lower edge. If you have a recession, cyan should be on the upper edge. Most people tend to interpret cyan as the brightest colour in a normal map so it might look a tad weird for a while, but that's just how the shader system is set up to work.
« Last Edit: November 27, 2008, 06:53:58 pm by Herra Tohtori »
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 
Re: photoshop cs2 and normal map plugin
i did read the thing about copying the red channel to alpha etc etc but I'm not seeing how to do that in CS2. On the channels tab really all i can do is turn the channels on and off (fyi i do not have alot of experience with photoshop, just some small things i've picked up here and there.

Resizing the thing shouldn't be an issue for me. Should I do that from the pre-filtered image (gray scale) or start over completely? the original texture I created the normal map from is a 512x512. Also what exactly do i need to do to make the seem lines more better (as in your example)?

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: photoshop cs2 and normal map plugin
Well, for Photoshop-specific help, I'm not worth much since I use GIMP (all hail Open Source), but you should be able to do the channel management there too... look for tutorials with google or wait for some Photoshopper to appear to help. Mind you, I can't really do the channel management in GIMP's channel window either - instead I need to Decompose the image into four grayscale layers - one for each channel - then move the red layer to alpha layer, and fill red and blue with black, then recompose the image to RGBA sincle layer, which takes care of that rather nicely.

And what comes to the lines... well, working on higher resolution to begin with is something that I like. Others, like Vasudan Admiral, work on the final resolution from start, and produce magnificent results, so it's mostly just a matter of preference. The biggest reason why I like high resolution is that it makes it easier to deal with aliasing effects without resorting to blurring the lines, so it's easier to draw thin lines. Another is that the normal map plugin seems to behave better on higher resolutions, don't ask me why but it's just empirical data speaking for me... :p

As to whether you should start over, that's something only you can decide. I would, but you probably could just resize your current grayscale image to higher resolution, then apply normalmap, and resize back to 512^2 and no one would be any wiser. Also... don't let me be the highest authority here. I'm just passing suggestions here. It isn't necessary to work in higher resolution than the end result to make the end result look good, it's just something I prefer doing.

What you "need" to do is experiment, but I would suggest using a bit darker gray for seam lines, and making sure that the edge lines are sharp in a texture like this before applying the normalmap filter. The width of the lines seems to be pretty good as far as I'm concerned, but use your own judgement. In general, I tend to prefer thinner and sharper normal map details compared to wider, and deeper but slightly rounded details, but it's largely map-specific as well.


When you get better at this, you'll probably start making multi-layered height maps, converting each separately into normals and combining them to make it easier to make different elements have different "depth", so to speak. For example it would be possible to have all the seam lines in one layer and all the deeper recessions on another, then combine the layers into one final normalmap. By same method you could also add a surface structure normals which would be a lot weaker than seamlines, but from a different layer it would be easy to control their intensity (or depth) in the final combination normalmap.
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 
Re: photoshop cs2 and normal map plugin
well i think you've done a wonderful job of explaining things =D just gotta figure out how to make photoshop cooperate with me. I'm wondering if i should try to duplicate the base channels and mess with them... i may beable to make that work.. i donno, but anyways thanks for all the help =)

 
Re: photoshop cs2 and normal map plugin
hrmz.... I created an alpha channel from the red channel (if anyone does normal mapping with photoshop lemme know if thats the way im sposed ta do it) then i went nuts in the red and blue channel with the ol' paint bucket. If i turn off my alpha channel (the one i made) the pic is green like the one you exampled, but some of my edges vanish, in particularly, the vertical ones. If i turn on the created alpha channel, the image turns this puke green/brownish color but the vertical edges are there.  Actually they are there with the alpha turned off but no where as nearly pronounced as the others.

 
Re: photoshop cs2 and normal map plugin
ok tell meh if i did this right *crosses fingers*



normal maps off


normal maps on


2nd attempt at the normal map

I started completely over and upscaled the texture to 2048^2 and did my outlines from there. I was having some issues getting the color replacement to work, i think because i used 3 different shades of blues to get my gray scale but meh... anyways, i started a new grayscale img and just copied my layer over and converted it back to rgb... i went with 50 on the filter scale and just saved as the dxt5_nm format for simplicity sakes cuz this channel management thing aint workin for me i think. But i still have the original png's to work with if i needa go back and do it again. afterwards resized to 512^2 and above is the result

 
Re: photoshop cs2 and normal map plugin
lemme ask this too... if i take a texture thats already a gray scaleish type, would it be bad form to just make a normal map out of the whole texture with out doing any kind of edge tracing? like say for example if you took a black and white photo of a brick wall and just make a normal map out of that with out doing anything extra to it

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: photoshop cs2 and normal map plugin
Otherwise it looks excellent, but you need to swap the Y axis "light direction" or whatever defines it in the Photoshop plugin. Observe:


Correct Y-axis




inverted Y-axis





See how the vertical lines need to be the other way round? You can achieve this either by changing some setting in the normalmap plugin (PS specific help ain't my forte like I said, but I can cast Summoning or Rites of Ashk Ente to get someone who knows the plugin to tell you how it's done)... or, you can isolate and invert the Green channel, which stores the vertical normals information. Same effect, but I prefer the former (might be because my plugin works as I need it right off the installation so I never needed to care about this beyond initially checking that the directions are correct).


About the question on direct texture->heightmap - it's VEEERY largely texture-specific. Sometimes it works, more often than not, it doesn't. Most likely you'll need to apply some creative use of other filters than edge detections like noise reduction, brightness/conterast and Selective Gaussian blur [this filter is one of my most used filters on GIMP due to awesomeness] which, with correct settings, actually sharpens similarly coloured areas of images and blurs details within them rather tahn blurs the image as a whole.

Best results can be achieved if the following conditions are met:

1. The diffuse or shinemap you consider using is of good quality (means minimal compression artefacts. Compression artefacts show up in normal maps way more drastically than they do from diffuse or shinemaps.

2. The diffuse/shine has minimal baked-in lighting. For example, a lot of maps have baked-in "glints" or brighter spots on some edges, and the normalmap plugin will interpret them as high ground because it just looks for RGB intensity.

Like said, it's largely texture specific and you need to decide if it works well enough for yourself...

* Herra Tohtori casts Rites of Ashk Ente

may the Lords of Photoshop have mercy on our souls... ;7
« Last Edit: November 28, 2008, 02:28:49 am by Herra Tohtori »
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 
Re: photoshop cs2 and normal map plugin
I have invert Y axis on in the photoshop plugin. I tried it with it turned off and to me it looked like the panels were elevated instead of depressed (rendered in game). Maybe i'm just looking at things wrong but if i make it with your top example, won't that cause the panels to appear to be elevated?

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
Re: photoshop cs2 and normal map plugin
Heh. The "Rites of Ashk Ente" eh? Or, you can holler at me on IRC. :grin:

I am using CS3, but the changes are minor enough to grasp.

In your "Layers/Channels/Paths" box on the Channels tab at the bottom is a Square-in-a-Square at the bottom that on hover says "Create New Channel". On an RGB image, this means creating an alpha channel. I'm sure you have that now, but I am posting this for anyone else to read. I create it and then floodfill it with #8080FF, or whatever color is going to be the base "this is a flat non-raised surface color" according to the map. Don't worry about it only being a shade of grey, alpha channel is greyscale. I just set this value for habit and consistancy.

What I do: when I am ready to normal map, I go to "Filter| NVIDIA Tools| NormalmapFilter...". I get this by having installed the nVidia Photoshop Filter, which they have recently updated thanks to CUDA support and new drivers, but that is neither here nor there. I vastly preffer this over the "Save As: DXT5NM" because I can go back in the history easier if I find I need to correct a line or something and re-filter it instead of having to make sure I progressively save multiple images or start over if I screw up.

I generally like "Height Generation" to be 3x3. Scale defines how bold and deep things are, default is 2.2, feel free to play with that value as much as you like. I then select in "Alternate Conversions" the Colorspace option with "Alpha Field" set to "Set to 0.0".

Once you are done, your Alpha will still be whatever it was before. Blue will have a height map. CTRL-A+CTRL-C and paste that in to a new image and save that as -Height for reference or distribution later, we won't be using it in game anyway. Paint fill Blue channel Black (#000000). Leave green channel alone. Select Red channel. CTRL-A+CTRL-C and then select the Alpha channel. Paste. Go back to Red channel and Paint it Black (#000000). Save as DXT5 with mip maps as all.

If your results prior to this manipulation look like the Inverted shot Herra has above, before you save (but after you have gone through said manipulations) you can go to Green and Invert it via CTRL-I. Do the same in the Alpha channel.

Under default view of just the RGB channels, you are going to loose viewing the vertical lines on the green image. That is fine. Hit the little square next to the channel selector (to put the Eye in it) and youl have a strange clay/mustard tone looking image that shows all the lines.

Also: If it looks like it is indented, in Game it will be protruded. If it looks protuded in CS, in game it will be indented. I see them backwards too and it does take getting used to. VA explained this as how the eye has a natural tendancy of viewing things and the way "light" interacts with them. In the "Correct" axis image, default eye-brain behavior is to see the lines and "boxes" as raised from the surface. But if you look at it just right, you can over ride your visual interpretation and actually see the image as being recessed instead. But if you have problems seeing Sailboats in those "Magic Picture" deals, you may not be able to pull that trick off.
« Last Edit: November 28, 2008, 03:11:03 am by Zacam »
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: photoshop cs2 and normal map plugin
If your results prior to this manipulation look like the Inverted shot herra has above, before you save you can go to Green and Invert it via CTRL-I. Do the same in the Alpha channel.

Actually, you don't need to worry about the Alpha channel (or red channel, as it actually is). The vertical normals channel is the only one inverted in that image, the horizontal normals (vertical lines on red/alpha channel) are all right as it is.

Oh, and this might be confusing, but the channel where you see horizontal lines is the one that stores vertical normals information, and the channel where you see vertical lines is the one that stores horizontal normals.

So only invert the offending channel, otherwise you're just gonna switch the issue from vertical normals to horizontal normals...

Refer to this pair of images if you need help on telling what colour should be on which side of a recessed detail:






As a rule of thumb, for a recessed detail Cyan goes left and down, Magenta goes right and up. Like I said before, it does look inverted, but that's what FS2_Open eats.
« Last Edit: November 28, 2008, 03:09:34 am by Herra Tohtori »
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
Re: photoshop cs2 and normal map plugin
In short, a surface in one channel should match in the other channel. Typically, if you have to Invert (photo invert, not normal map inversion function) then it will most likely need to be applied to both Green and Red/Alpha (depending on if you copy/pasted the Red channel map data to the Alpha channel or not).

Basically, if it looks like a light is at the top of the image and it's protruding at you when it should be recessed, you have it right.
Or if you think of it as the light being on the bottom and it then looks recessed, then you have it.
If either case is wrong, you don't have it.

It is usally a lot easier on the eye/brain translation I mentioned earlier to just asseme the light is at top and that recesses will look like protrusions and protrusions will look like recesses. Or you can pretend that you are looking at the underside of the map from inside the ship. Or whatever.
« Last Edit: November 28, 2008, 03:17:00 am by Zacam »
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys