normalmap to heightmap

Started by
1 comment, last by DonnieDarko 18 years, 3 months ago
Hey guys, I've been playing with trying to convert a dot3 bumpmap to it's heightmap format. I ended up with something that looks like (for instance, on the x axis) (currently in Visual Basic) height = height - normalmap(x,y).x / (1-normalmap(x,y).x^2) My brain is fried - are my calculations wrong? I'd like to find the slope along the x axis of the line parallel to the surface (perpendicular to the vector in the normalmap) Currently it looks correct... except I would expect (for a tiling normalmap) that the height at each endpoint should be almost equal... I'm getting an increasing gradient... Thanks for any help! -Michael g.
Advertisement
Update:
After looking at this post I converted everything over to tangent vectors and taking the cross product. I then got this

sort of output (sometimes it seemed to work... sometimes it didn't at all.)

I then noticed I'd neglected to flip the .y component when adding y pieces... after which, everything is hunky dorey.
I've enabled an "enhancement" which cleans up the image nicely... but only applies to tiling bumpmaps.

My only source data (for normalmaps) has been jpgs... which have artifacts, but even these seem to do a pretty good job.
I'm sure some sort of more advanced filtering could help clean them up, but as it is the tool works great (yay!)

The whole thing was a rather nice exercise... plus it seems there are so many bump maps floating around without related height/depth maps.
I'd like to setup parallax mapping in my engine, and being able to create heightmaps from bumpmaps on the fly will work out wonderfully.

I hadn't noticed any dot3->heightmap tools out there before (just a bunch of heightmap->dot3 tools/plugins)

Are there any out there that you're aware of?

Thanks,
-Michael
There's a tool for doing this in the DOOM 3 Relief Mapping modification.

This topic is closed to new replies.

Advertisement