fogleman / hmm

Heightmap meshing utility.
MIT License
571 stars 50 forks source link

support float32 images #11

Open AndrewAnnex opened 4 years ago

AndrewAnnex commented 4 years ago

would it be possible to support float32 input files, like geotiffs, without conversion into a 8bit image format first? Totally understandable if additional dependencies are not desired. I am sure a short python/bash script could automate the conversion and correct zscale...

fogleman commented 4 years ago

hmm does load as 16-bit, not 8-bit: https://github.com/fogleman/hmm/blob/master/src/heightmap.cpp#L19

To get 32-bits would require extra effort.

fogleman commented 4 years ago

You might need to convert to a 16-bit PNG first, not sure.

https://github.com/fogleman/hmm/blob/master/src/stb_image.h#L7356

fogleman commented 4 years ago

Yeah looks like the image loader I'm using supports 16-bit PNGs and PSDs:

https://github.com/fogleman/hmm/blob/master/src/stb_image.h#L7248-L7259

tplc10 commented 4 years ago

Could you point me towards a similar solution that supports 32-bit images? I've been looking for one, but I can't seem to find one that both supports high resolution heightmaps (8192x8192 is what I've been using) and 32 bit.

kylebarron commented 3 years ago

@tplc10 If you're ok with Python, I wrote Python bindings to hmm, and it accepts Numpy arrays of type float32 as input.