Maximum height

General discussion of the Project Reality: BF2 modification.
Post Reply
Epoc
Posts: 56
Joined: 2009-02-15 13:12
Contact:

Maximum height

Post by Epoc »

Hi folks,
I've a specific question about the maps files. I would like to know in wich file the maximum height for each maps is located. In the BF2Editor, his name is TerrainHeight, but I can't find it in the maps files.
Can someone help me ?
Epoc
Posts: 56
Joined: 2009-02-15 13:12
Contact:

Re: Maximum height

Post by Epoc »

Anyone can help me ?
Zimmer
Posts: 2069
Joined: 2008-01-12 00:21

Re: Maximum height

Post by Zimmer »

Epoc
Posts: 56
Joined: 2009-02-15 13:12
Contact:

Re: Maximum height

Post by Epoc »

Thanks man, I will try it ;)
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Maximum height

Post by Rhino »

its in the level settings in the tweaker tab where you change the view distance of your map, and under it you change your sky and water settings etc...
Image
e-Gor
Retired PR Developer
Posts: 3752
Joined: 2006-03-06 22:40

Re: Maximum height

Post by e-Gor »

Some rather confused/unconnected thoughts from me:

The terrain shape is controlled by the heightmap.raw files. The actual height of the terrain is controlled by the terrain scale in the heightdata.con, e.g.

Code: Select all

heightmap.setScale 2/0.005/2
Those are x/y/z, with the y value (here 0.005) being the vertical scale. I believe this is in metres, giving the vertical resolution of the heightmap. It's perhaps worth mentioning here that the '2' in the x and z values is what most people mean when they talk about "scale 2" maps.

So there are two ways of scaling terrain: scaling the image itself, as Jonny suggested, or changing that number.

However, for optimal height resolution the heightmap should be already using the full range, meaning you won't be able to scale it up without creating plateaus at the heighest and/or lowest points. I don't know if the BF2 editor creates heightmaps like this or not though.


Having said all that, this is not the way you should be scaling the terrain. Unlike collisions, the visuals do not work from the heightmap.raw/heightdata.con but rather use the terraindata.raw file. This is what gets created when you save "compiled terrain" in the editor. So even if you do change the scaling manually, you will still have to open the map in the editor to create that .raw file. If you don't, the ground will still appear in the old location, but you'll be walking around in mid air.


So... if you're wanting to change the vertical scale, you're much better off doing it in the editor to start with.

If you're just wanting to find the maximum height of the map then you'll need to combine that vertical scaling value with the maximum height of the heightmap. Which you can find easily either in photoshop or by writing a little script.
Epoc
Posts: 56
Joined: 2009-02-15 13:12
Contact:

Re: Maximum height

Post by Epoc »

Thanks for responses all !
e-Gor wrote:If you're just wanting to find the maximum height of the map then you'll need to combine that vertical scaling value with the maximum height of the heightmap. Which you can find easily either in photoshop or by writing a little script.
Yes, that is what I want to do but when you talk about the maximum height on the heightmap, it's a color code ?
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Maximum height

Post by Rhino »

its a grayscale image, the whiter the higher, the darker the lower.
Image
Epoc
Posts: 56
Joined: 2009-02-15 13:12
Contact:

Re: Maximum height

Post by Epoc »

Yes I'm agree, but how many meters represent these colors?
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Maximum height

Post by Rhino »

Epoc wrote:Yes I'm agree, but how many meters represent these colors?
gray scale is measured in %, 0% = pure white, 100% = pure black.

0% = the max height of the level
100% = 0m high, the lowest hight of your level.

so if you have a hill that its peak is say 20% and your max height of your map is 200m, you find 80% of 200m and you find the height of that terrain ingame which would be 160m

But what would be the easiest would be just to load up the level editor, then plonk a object ontop of that hill and you will find out the height of the terrain from the z of the object.
Image
e-Gor
Retired PR Developer
Posts: 3752
Joined: 2006-03-06 22:40

Re: Maximum height

Post by e-Gor »

More accurately, it's an array of height values. When you open it up in an image editing program (e.g. photoshop) it will appear as a greyscale image. Most if not all main heightmaps are 16bit - i.e. they use 16 bits per pixel. The secondary heightmaps (used for surrounding terrain) will be lower resolution, but they probably aren't relevant to what you're wanting.

You can the height range of the map by subtracting the height (greyscale value) for the lowest (darkest) point from the highest (lightest) point, and multiplying by the heightscale. Water adds an extra bit of difficulty. The level is set in the heightdata.con. Presumably this is metres above/below the origin, but I don't know where BF2 takes as the origin - you'll need to do more research. Maybe a mapper can add some more insight. You'll also hit the same problem if you just want to find the coordinate of the highest point.


edit: got majorly ninjad. But I think all I said still holds :)
Epoc
Posts: 56
Joined: 2009-02-15 13:12
Contact:

Re: Maximum height

Post by Epoc »

I see, I will try it :p
Post Reply

Return to “PR:BF2 General Discussion”