L3DT users' community
Large 3D terrain generator

RAW File Structure

Any and all chit-chat regarding L3DT.

RAW File Structure

Postby Ludo26 » Tue Dec 13, 2011 10:02 am

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:
Ludo26
New member
 
Posts: 2
Joined: Tue Dec 13, 2011 9:43 am

Re: RAW File Structure

Postby Aaron » Tue Dec 13, 2011 12:40 pm

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.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: RAW File Structure

Postby Ludo26 » Tue Dec 13, 2011 1:04 pm

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 ?
Ludo26
New member
 
Posts: 2
Joined: Tue Dec 13, 2011 9:43 am

Re: RAW File Structure

Postby Aaron » Thu Dec 15, 2011 11:46 am

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.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia


Return to General discussion

Who is online

Users browsing this forum: No registered users and 2 guests