Author Topic: Back-converting normal maps to height maps  (Read 6409 times)

0 Members and 1 Guest are viewing this topic.

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Back-converting normal maps to height maps
Does anyone know of a method to take DDS DXT5 normal maps, and convert them back to grayscale height maps?

I found a way to do it with DXT1 settings (the blue-ish ones) but I haven't found a way to convert DXT5 (the greenish ones). Even being able to convert from DXT5 to DXT1 would help. I have Photoshop and the NVidia plugins if that helps.

On a side note if anyone has the original height maps used to generate the textures for the SG Rahu this would be a moot point. Thanks.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Back-converting normal maps to height maps
Okay, first of all, a point of terminology: DXT1, 3 and 5 are texture compression formats, they have nothing to do with the format of normal map used. The correct way to refer to the blue ones is "standard" normal maps, what FSO is using are "those damn special things taylor invented back in the dark ages for inadequately explained reasons".

Now, if you have a green normal map, you can convert it back to a standard normal map by copying the Alpha channel to the Red channel, then blanking or removing the Alpha channel, you can then feed this back into whatever method you use to reconstruct the height map (You may also need to flood the Blue channel with full color value, you'll have to experiment with this).
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Kobrar44

  • On Suspended Sentence
  • 29
  • Let me tilerape it for you!
    • Steam
Re: Back-converting normal maps to height maps
I recall there was a gimp script soooomewhere on the forums which calulated a proper blue value for the blue channel.
http://www.hard-light.net/forums/index.php?topic=69064.0
Oh guys, use that [ url ][ img ][ /img ][ /url ] :/

 

Offline fightermedic

  • 29
  • quite a nice guy, no really, i am
Re: Back-converting normal maps to height maps
I recall there was a gimp script soooomewhere on the forums which calulated a proper blue value for the blue channel.
http://www.hard-light.net/forums/index.php?topic=69064.0
oohh, usefull, thanks!
>>Fully functional cockpits for Freespace<<
>>Ships created by me<<
Campaigns revised/voice-acted by me:
Lightning Marshal 1-4, The Regulus Campaign, Operation: Savior, Operation: Crucible, Titan Rebellion, Fall of Epsilon Pegasi 1.1Aftermath 2.1,
Pandora's Box 2.2, Deep Blood

Other Campaigns I have participated in:
The Antagonist, Warzone, Phantoms & Echo-Gate

All the stuff I release is free to use or change in any way for everybody who likes to do so; take whatever you need

 

Offline Raven2001

  • Machina Terra Reborn
  • 211
  • Im not the droid your looking for, move along
Re: Back-converting normal maps to height maps
There's a free tool called xNormal for map baking and etc. It  also has some good editing tools (height to normal, etc), but I don't recall if it has a normal to height map tool.
In any case, it's worth taking a look because IMO the height to normal map tool is better than the Nvidia one :)
Yeah, I know you were waiting for a very nice sig, in which I was quoting some very famous scientist or philosopher... guess what?!? I wont indulge you...

Why, you ask? What, do I look like a Shivan to you?!?


Raven is a god.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Back-converting normal maps to height maps
In all my research going from Normal to Height is often not recommended from a quality perspective. You can do it, but it's a little like turning a jpg into a png. Sure, it'll work... but signs of the compression remain.

In my needs, it's worked best to do this with any of the automated tools out there and then spending some time fixing it by hand.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Re: Back-converting normal maps to height maps
Alright, I found a way to convert from DXT5 to standard normal maps in GIMP.

Colors > Components > Decompose, change mode to RGBA. This will open a new image with one layer for each channel.

Flood the Blue channel with White and delete the Red channel.

Then go to Colors > Components > Compose with the mode set to RGB and you can generate a new image reassigning channels. Green stays green, Blue is the new Blue, old Alpha is the new Red. Use the normal map plugin for GIMP to "normalize" the output, i.e. ensure each pixel has a vector length of 1.

Good news, the filter will also let you convert a normal map to a height map. Now for the bad news: the results are fairly poor, borderline unusable.

In all my research going from Normal to Height is often not recommended from a quality perspective. You can do it, but it's a little like turning a jpg into a png. Sure, it'll work... but signs of the compression remain.

In my needs, it's worked best to do this with any of the automated tools out there and then spending some time fixing it by hand.

This does seem to be the way to go.

[attachment DELETED!! by Strong Bad]
« Last Edit: November 19, 2015, 12:07:30 pm by Galemp »
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline The Dagger

  • 29
  • I like zod ships
Re: Back-converting normal maps to height maps
That map was surely made directly from the diffuse. I mean, I get a map that looks the same as what we have by applying the normal-map filter to the diffuse.
« Last Edit: November 20, 2015, 03:56:33 pm by The Dagger »