Jump to content
  • Advertisement

Archived

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

AndreTheGiant

Height map - file format ?

This topic is 5225 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

Im thinking of making a simple height map demo. What is the most popular (ie best) file format to work with? Should I make it so that it will read in a greyscale bitmap? or something else? I noticed that NeHe''s heightmap demo uses .RAW files. Any idea why?

Share this post


Link to post
Share on other sites
Advertisement
A popular one is to use truecolour images with the red field as a height indicator.

If you need more resolution, just use the red & green channels (Fractint supports exporting tgas in this format)

Mark

Share this post


Link to post
Share on other sites
i would go with an 8-bit gray scale image

i like it RAW

"A soldier is a part of the 1% of the population that keeps the other 99% free" - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA

Share this post


Link to post
Share on other sites
Hmm, apparently RAW format doesnt store the dimensions of the image. I would like to be able to use arbitrarily sized images. Any workarounds? Or do I have to hard code the size in the program and enforce that they always use the right dimensions for the images?

Share this post


Link to post
Share on other sites
You are right, raw files are just the data.

Raw files can be opened in paint shop pro, when you do it will ask you the dimensions and bits per pixel. The advantage is that a 256x256 raw file will be 65536 bytes big and can be read in to a block of memory and used straight away.

Share this post


Link to post
Share on other sites
You could create your own format. Or simply alter RAW a little by adding the size at the beginning of the file (as a mini-header).

It would take, maybe... 5 minutes to write a program to accept the image size as input, add a mini header to the file, and have an option to convert it back to RAW by removing the header so that the heightmap can be modified by an other program (like psp or photoshop).

Share this post


Link to post
Share on other sites
Yea your right. Its just that I wanted to let users of my program make their own images and use them, so I want to submit them to as little hassle as possible. Of course, I could use a different image format, but I also want to submit me to as little hassle as possible, and I like the simplicity of the RAW format

Share this post


Link to post
Share on other sites
Nice; what technique did you use to generate the heightmap?

It''s pretty hard to give users a simple means of using your program while making things easy on you as well; you''ll have to find a trade-off at some point. Just remember that you only have to code the hard stuff once; users have to deal with the complex get-it-working procedures every time they use it.

Share this post


Link to post
Share on other sites
Thanks
Ive never done something like that before, and although I had some problems, it was a lot easier than I expected.

I ended up using the RAW data file format, using greyscale images. Currently I have the values hard coded into the program, so I have to put in an image of the correct size (200 by 200). Im still working on making this better so that you can pass in any image size and still have it work.

I used photoshop and basically just scribbled around until I had a nice bloby picture, without too much contrast from one area to the other (for eg black next to white with no grey in the middle), becuase this would cause super steep, unrealistic looking peaks in the mountains.

My main concern now is that end users may not have a program that creates RAW images. I dont think paint can do it. I cant expect everyone to have photoshop. I could change it to use bitmaps instead, but Im not sure I WANT people using paint anyway. It doesnt have the nice blurring capabilities that photoshop does, so the images will invariably end up with lots of black-next-to-white-with-no-grey-in-the-middle.

Still thinking about stuff I guess. Input is appreciated!

[edited by - AndreTheGiant on March 24, 2004 4:09:22 PM]

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!