Jump to content

Photo

TC - programming a landscape utility


  • Please log in to reply
No replies to this topic

#1
k_fishburne

k_fishburne

    Newbie

  • Members
  • Pip
  • 17 posts
I'm attempting to program a utility that works similarly to Landscape Creator 1.1 (Gilles_K). It will generate a 32x32, 64x64, or 128x128 cell ESM using a height field (grayscale image) to control the landscape's elevation.

I'm having a huge problem deciphering the VHGT section of the ESM, which contains a cell's height data. Here's what I've done:

1) I'm converting the 4 bytes that control each cell's overall height offset to a single precision floating point value.

2) I'm interpreting the 4225 bytes of height data as a 65x65 vertex grid of relative heights. Each byte I'm treating as a signed integer (-128 to +127).

3) Although I'm interpreting the 4225 bytes as they're stored in the file (sequentially), I'm plotting them in the cell starting from the bottom-left corner, moving right, then moving toward the top of the cell a row once the right side is reached. Example:

Data in file:
0 1 2 3 4 5 6 7 8

Data in cell:
6 7 8
3 4 5
0 1 2

I reset the accumulative elevation for the current row to zero once it reaches the right side and I move up a row.

What am I doing wrong? My results when "rendered" are off. Most noticably any vertical changes in elevation aren't represented, although there are other anomalies. Thanks.




Page loaded in: 1.516 seconds