What is the conversion of R16 values during world composition import

Along the lines of other issues with World Machine and World Composition tiled import - what is the value conversion methodology for R16 files?

R16 are 2 byte short ints, 0 to 65535. I’m assuming they are interpreted as unsigned based on various posts.

So what does 0 mean? What does 32767 mean? etc? What is the conversion from the R16 value to an actual Z value in the heightfield assuming 100% zoom level on import.

Ok I’m going to answer my own question as it appears that UE4 is doing something very annoying. I think this should be able to be dealt with more elegantly.

It appears that the R16 file is being treated as a -signed- 16 bit value. This is silly because you are limited to essentially half the full range of values.

So the large negative value translation comes from UE4 apparently moving everything down to account for the negative wrap when the MSB gets set.

As a test I added 32768 to all values in a sample tiled landscape. The landscape started at 0 - good - but larger values munged due to what appears to be the negative wrap. Still not entirely clear what it’s doing but this really should be documented somewhere so people can make their own R16 files or at least fix up broken ones as in my case.

Ideally the editor would allow Z translation of World Composition landscapes.