Jump to content
  • Advertisement
Sign in to follow this  
ultimastrike

raw file problems

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

I've been following two main tutorials in the creation of my terrain generator: http://www.riemers.net/eng/Tutorials/DirectX/C++/Series1/tut11.php http://www.chadvernon.com/blog/tutorials/managed-directx-2/terrain-generation-with-a-heightmap/ Using a little of both, I managed to complete my generator to the basic level - or so I thought. When I run my engine and load the raw file listed at the top of the reimers tutorial, I get the following (correct) behavior: Screenshot It says Direct X, in case you were wondering. However, when I load any other raw file - either ones generated in Terragen, or the one from Chad Vernon's project (tutorial 2 above) I get behavior similar to this: Screenshot That's supposed to be a raw file containing a realistic looking terrain, and all it generates are straight lines across the map. So I'm a little perplexed. Obviously my generator works with at least some raw files, and I want to figure out what makes the first raw file so special that it works correctly (so that I can make my maps in that format). Can anyone help me solve this mystery? Oh, and the brownish thing is a flying ship model. Looks much better outside wireframe mode.

Share this post


Link to post
Share on other sites
Advertisement
As an update: Someone suggested that maybe one of these files has header information and the other does not, which might account for the difference between the two. However I'm at a loss as to how to investigate further, because so far none of the programs that view RAW files seem to allow you to see such things. Might this be the issue?

Share this post


Link to post
Share on other sites
Quote:
Original post by ultimastrike
As an update: Someone suggested that maybe one of these files has header information and the other does not, which might account for the difference between the two. However I'm at a loss as to how to investigate further, because so far none of the programs that view RAW files seem to allow you to see such things. Might this be the issue?


The file size will be w * h * bpp. bpp is bytes-per-pixel.

If your file size is exactly that, then there's no header. If it's slightly more, then there's header.

Since RAW format by definition has no pre-defined structure, there's no viewers for them. Image editing software should generally include importers though. You can also use hex editor to view them, contents should be pretty obvious.

Share this post


Link to post
Share on other sites
Excellent advice! I am one step closer. After comparing my working raw file against ones created by terragen, it is fairly obvious that the terragen files (even the 8 bit ones) contain a lot more information. Looking at the working file, I can see a direct correlation between each value and the height it creates in my program, so you were right when you said the contents are obvious. The non-working files aren't recognizable in this manner at all.

So now I need to find a way to create RAW files without headers in a 1 byte per pixel format. Do you happen to have any leads on that?

Share this post


Link to post
Share on other sites
Many drawing packages can output a RAW file (I use paint shop pro) you need to set up your image as 8 bit greyscale and draw your height map to your hearts content (black is low and white is high). Then save your file as RAW and all should be fine. I like this method during testing as you have great control on what is in the terrain and can test scenarios like very steep changes etc.

For more realistic terrains use the "noise" command in the drawing package and applying smoothing filters. Then use the effects brushes to darken or ligten areas.

Share this post


Link to post
Share on other sites
Quote:

it is fairly obvious that the terragen files (even the 8 bit ones) contain a lot more information.

I personally could never get those working. This is one of the reasons why I moved to Terragens native terrain format - *.ter.

Share this post


Link to post
Share on other sites
Load it as a DirectX black&white texture.

Supports jpg, bmp, raw, etc..

And of course, resizing the image to whatever mapsize you see fit.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!