Download

Storing a heightmap in Normal Map B Channel?

I am trying to save a texture by storing the heightmap into my normal map blue channel, I just can’t figure out how to set it up, I have seen people do it in videos before, but I can’t remember the names of those videos, so I thought I would ask you guys, any ideas?

Thanks!

Edit: I figured part of it out by doing this

Now I just need to find out how apply the bump offset coordinates to the reconstructed normal map, any body know a way?

I’m not sure you can do it that way, there’s some different compression that’s applied to normal maps that could change the results of your texture by including it there. You can try saving it to the alpha channel of the normal map though, and still save textures.

I actually found a tutorial doing it this way, I changed the compression to TC_Default, instead of normal map. The problem with using an alpha channel is it doubles the memory, so you might as well use another texture. These results look good right now, I just need to find a way to plug the Bump Offset coordinates back into the reconstructed normal map so its applied to the normal map.

There’s a node which calculates the Blue for you, DeriveNormalZ or something. You just plug your R & G channels into it and you’re free to do whatever you want with the blue channel. The Blue does get heavily compressed in BC5 (default for normal maps) compression though, so although you use less memory and texture samplers, you won’t get amazing results.

In your example above, you’ll need another texture sampler that uses the same texture, THEN plug the blue into normal map. You can’t do it on the same Texture Sampler. (Additional Sampler nodes of the same texture have no extra cost).

EDIT: Coming back to this years later I was wrong, BC5 drops the Blue Channel altogether I believe.

You’re on the right track. To use the blue channel you’ll need to use DXT1/5 compression instead of BC5. TC_Default does this but you’ll also need to convert your normals from [0…1] range to -1…1] range. Also make sure sRGB is disabled.

With BC5 there is no blue channel stored at all. It’s being reconstructed from the red+green channel in the normalmap sampler node.

Nothing special about that, you can use bumpoffset as usual: http://abload.de/img/normalmapblue_00117j0r.png

Hey guys thanks a lot for the help!

TheJamsh, ok awesome, I was worried another texture sampler would cost more, good to know it won’t. Thanks.

MAlkAv!An, does the multiply by 2 and add -1 convert my normals from -1 to 1? If not how can I do that?

Yes, the math is x2-1* or *(x-0.5)2. Note the different shade of blue when converting to the proper range.

Yeah that definitely made a visible change, thanks again for the help.