Page 1 of 1

RAW File Structure

PostPosted: Tue Dec 13, 2011 10:02 am
by Ludo26
Hello !

I am kind of new at L3DT and i would like to thank you very much for your software ! :D
I just have a quick question about RAW file format exported by L3DT.

Do you have any information about the file structure of RAW files? Especially 16-bit unsigned (full range) files.
here is an exemple of a RAW file in hexadecimal (just the header part).
The part with all the 00 are the black pixel of my heightmap on the corner.

Image

Many thanks !! :mrgreen:

Re: RAW File Structure

PostPosted: Tue Dec 13, 2011 12:40 pm
by Aaron
Hi Ludo26,

The 16-bit raw files have no header, and have row-first ordering going from west to east, with the rows themselves ordered south to north. The 'unsigned full range' mode means that the 16-bit values are scaled such that the lowest point in the heightfield has a file value of 0, and the highest point has a value of 65535, with all other values in between scaled accordingly. This mode gives the maximum height precision possible with 16 bit pixels, since the stored height values span the entire range of 16 bit values.

I hope this helps. Please let me know if you require any additional information.

Best regards,
Aaron.

Re: RAW File Structure

PostPosted: Tue Dec 13, 2011 1:04 pm
by Ludo26
Hi Aaron,

Many thanks for your answer. :D
So if I understand correctly on my RAW file 16bits, if there is no header, every couple of bytes (so every 2bytes) represents a pixel color, starting from the lower bottom corner.

In the case of my RAW file for instance, the 14th pixel (2nd line of the hexadecimal file column "0a") is defined by 5b00 in hexa which means 23296 in decimal so 35.54% grayscale (if deivided by 65335).
Am I correct on that one ?

Re: RAW File Structure

PostPosted: Thu Dec 15, 2011 11:46 am
by Aaron
Hi Ludo26,

So if I understand correctly on my RAW file 16bits, if there is no header, every couple of bytes (so every 2bytes) represents a pixel color, starting from the lower bottom corner.


Yep. That's right.

In the case of my RAW file for instance, the 14th pixel (2nd line of the hexadecimal file column "0a") is defined by 5b00 in hexa which means 23296 in decimal so 35.54% grayscale (if deivided by 65335). Am I correct on that one ?


Mostly, but I forgot to mention it's Intel byte ordering (little endian), so the 14th pixel is actually 0x005b = 91 decimal = 0.14% greyscale.

Cheers,
Aaron.