Old school bump map (height map) not supported?

Am I correct in understanding that old school bump maps (grayscale images, basically height maps) are not supported by babylon.js?

If so, is there any bundled converted to transform a height map into a normal map in a fast, possibly GPU-assisted, way or should I write my own code for that?

I found very little to document this, but at least one mention where it was stated that height-map bump maps was not supported since they are slower than normal maps and that you should transform them in advance offline. I fully agree on this in general, but in my case the height-map based bump maps comes from legacy data not easily transformed on server side.

As a reference, Three.js supports both height-maps (called bump maps) in conjunction with the normal normal maps, pun intended. =)

For the uninitiated, here is some explanation of the two type of bump maps:

To my knowledge there’s no tool in Babylon.js to convert a height map to a normal map, but contributions are always welcome!

…and welcome aboard!

Thanks for the quick reply @Evgeni_Popov.

If the conversion code is generic enough then I will try and contribute back. Might turn out too messy though depending on where in our pipeline it ends up.

This site might not be suitable for your needs or files but does converts height-maps to bump-maps online NormalMap-Online

This is the result of dragging the ‘worldHeightMap.jpg’ into the app

1 Like

Thanks. I have actually using that to provide some test files and as a “ground truth”. Looking at the source it is actually a MIT license, so perhaps I could use some of the logic from it.

That said, I read somewhere that it is using shaders to do the conversion (which is actually not that hard math wise) which is still outside of my comfort zone.

Also for the sake of performance you should not do offline work at runtime because you will pay the cost of conversion on each launch when it could be done once and for all

Yeah, but as I mentioned in the first post one might not have a choice in the matter when consuming legacy online data.

In cases like that it would be good with a well optimized utility method rather than each developer rolling their own solution.