Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Etus

.RAW format questions

This topic is 5320 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have several questions regarding the heightmap .RAW file format. I'm writing a terrain editor and I have 2 problems with this format. 1. I'm working with 16bit .RAW files. If I understand correctly, 16bit .RAW format means that the colors value varies between 0-65025. This means I can store any Y value between these values. The problem is that if I pass a value higher than 255, it gets clamped to 255 automatically when storing the value. I have no idea why it happens - I thought I could store values up to 65025, no? 2. I'm using Photoshop to read the .RAW files in order to view them in 2D mode. When openning the file in Photoshop, I can select between two Byte Orders: Mac or IBM. What are these? It appears than when I save the map I save it in Mac Byte Order, but when I open it, I open an IBM Byte Ordered map. This means I have to convert the file manually to IBM Byte Order before openning it with my engine. How can I fix this? Many Thanks, Etus P.S. Please forgive any English grammer mistakes I might have made. English is not my native language. [edited by - Etus on February 28, 2004 6:08:16 AM]

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Etus
1. I''m working with 16bit .RAW files. If I understand correctly, 16bit .RAW format means that the colors value varies between 0-65025. This means I can store any Y value between these values. The problem is that if I pass a value higher than 255, it gets clamped to 255 automatically when storing the value. I have no idea why it happens - I thought I could store values up to 65025, no?


Do you absolutely need 32,767 different height values? An 8-bit grayscale .raw file should work just fine.

quote:

2. I''m using Photoshop to read the .RAW files in order to view them in 2D mode. When openning the file in Photoshop, I can select between two Byte Orders: Mac or IBM. What are these? It appears than when I save the map I save it in Mac Byte Order, but when I open it, I open an IBM Byte Ordered map. This means I have to convert the file manually to IBM Byte Order before openning it with my engine. How can I fix this?


I''m 99% certain that Photoshop is referring to big-endian and little-endian. If you''re working on a PC then you should save it in IBM byte order. If you use 8-bit .RAWs instead, then you don''t have to worry about byte order at all.

Share this post


Link to post
Share on other sites
Yes, I need 32,767 different height values
Moreover, using 16bit RAW file gives better result in rendering(the terrain looks more smooth).

- Etus

Share this post


Link to post
Share on other sites
quote:
Original post by Etus
1. I''m working with 16bit .RAW files. If I understand correctly, 16bit .RAW format means that the colors value varies between 0-65025. This means I can store any Y value between these values. The problem is that if I pass a value higher than 255, it gets clamped to 255 automatically when storing the value. I have no idea why it happens - I thought I could store values up to 65025, no?


Bear in mind that RAW isn''t really a format; it''s more an absence of a format. Therefore there isn''t exactly a standard on what it means. It could be:

16 bits per colour = 48bits per pixel, values of 0-65535/0-65535/0-65535
16 bit greyscale = 16bits per pixel, values of 0-65535
16 bits of colour = 16bits per pixel, values of 0-32/0-32/0-32 (or maybe even 64 in one case, usually green)

Which one are you using?

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Share this post


Link to post
Share on other sites
I think I''m using 16 bit greyscale - I used Photoshop to convert my 8bit RAW files to 16bit. When I load the file, I load the values into an "unsigned short" instead of "BYTE". I need the values to be from 0-65535.

- Etus

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!