0

I have the same initial problem as the links below, but I cannot change to using float32 as I am not using Blender.

Terracing / stepping artefacts after converting lidar DTM from float32 to uint16

Terracing and data format issues when converting DEM from float32 to UInt16

This command works, but is still in float32 so can't be used in Unity:

"gdal_translate.exe" –of ENVI –outsize 4096 4096 -r lanczos "DTM_SU9075_P_10735_20210218_20210418.tif" "For_UnityNo16conv.raw"

When I change to UInt16 the terracing occurs:

"gdal_translate.exe" –ot UInt16 –scale –of ENVI –outsize 4096 4096 -r lanczos "DTM_SU9075_P_10735_20210218_20210418.tif" "For_UnityScaleAttempt.raw"

So I tried adding values to the scale, but I think the input are whole numbers so whole meters without centimetres? The minimum and maximum elevations are: STATISTICS_MAXIMUM=90.249000549316 STATISTICS_MINIMUM=13.739999771118

So surely there are enough values in 65,536 to create a smooth height model. I just can't seem to scale it correctly.

This is clearly wrong [edit:actually what is clearly wrong is just providing scale without the units] and results in stepping artefact/terracing:

"gdal_translate.exe" –ot UInt16 –scale 13 97 0 65535 –of ENVI –outsize 4096 4096 -r lanczos "DTM_SU9075_P_10735_20210218_20210418.tif" "For_UnityScaleAttempt.raw"

Can anyone point me in the right direction please?

(As an aside I'm no longer resizing as I am cropping first)

3
  • 2
    How is this a different issue from gis.stackexchange.com/questions/440874/… ? Sep 24, 2022 at 7:09
  • 1
    I guess it isn't, but that question is essentially solved (but with a solution not relevant here) - the link within one of the answers shows someone importing into Blender with no conversion and the other question I linked to says that Blender supports float32 so no conversion is needed. Unity doesn't support float32 so this would need solving at the gdal stage if possible.
    – jonathanc
    Sep 25, 2022 at 3:49
  • 1
    It is also a different workflow as they are not using the scale function of gdal_translate.
    – jonathanc
    Sep 25, 2022 at 4:47

1 Answer 1

1

Providing the scale parameters as in my third code example works. I was expecting the gdal_translate to preserve units but change potential precision. It doesn't. The scale can be assigned to elevation in Unity.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.