PDA

View Full Version : what does a .raw file contain?



Andrew Davey
05-12-2004, 01:02 AM
Hi am doing a hieght map, but am wondering what a .raw file contains, does it just contain a list of x,y,z coords and if so can i use any file and generate my own using random values???

Bob
05-12-2004, 01:24 AM
A raw file usually just contains raw data. No headers or stuff to describe what's in there, just the data ready to be loaded. This means you have to know the layout yourself before you can load it, and the layout depends how it was saved.

If it's an image, it could contain the image data as unsigned bytes ordered in RGB trippes. If it's an image intended to be used as a height map, it could be floats representing height samples in a uniform grid, either saved in ascii of binary.

raw files can contain anything, in any format, usually without any information about the internal structure. This means YOU have to know the internal structure, like size of the image, format (float vs. integers, binary vs. ascii, and so on). If you don't know the exact internal structure of the raw-file you have, it's pretty much useless.

Andrew Davey
05-12-2004, 02:01 AM
so if i wanted to create a heightmap could i use a normal txt file, which contains x,y,z coords for each point???

as the .raw file i am using is the nehe tutorial, but oi get errors with the BYTE data type, it doesnt get recognised and wont work.

Bob
05-12-2004, 02:10 AM
You can use whatever format you want. If you feel a text file with XYZ trippes is good enough for you, then go ahead and use it. It depends on what you need and what you're willing to pay to get it.

For a heightmap, a normal greyscale image usually works good, but as I said, it depends on what you need. The heightmap in NeHe's tutorial 34 is a normal 8-bit greyscale image representing height.

Andrew Davey
05-12-2004, 03:00 AM
when you say what you are willing to pay to get it, what do you mean??

Bob
05-12-2004, 04:02 AM
Nothing is free, everything costs in one way or another. If you, for example, finds a file format that exactly fits your needs, but is extremely difficult to load, are you willing to spend lots of time to make a loader for that format? Or would you rather choose a less complex file format, but also make some changes in your design? When you have choosen a format, do you have the programs needed to create the files in that particular format?

The price you have to pay includes time spent making code to load the file, making changes to the design of your program to handle the file format, getting the programs needed to create the files, and so on.