Jump to content

TC - programming a landscape utility


k_fishburne

Recommended 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.

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...