Page 1 of 1

Attribute Map exported properties

PostPosted: Sat Oct 07, 2006 5:53 pm
by cliff
Hi, there.

I'm working on a tool for the Neverwinter Nights 2 toolset that does terrains. Unfortunately, it doesn't just allow the importing of a texture file - instead you have to paint your textures using the textures that the game ships with.

My problem is this - I am having trouble making heads or tails of how the *_AM.png file relates to the climatic values. The color values I see in the png when I load it are nothing at all like the color values I see in the *.cli.xml file, nor can I wrap my head around how to translate the color value into the ID# listed in the exported type info list that the application generates.

Any help you guys could give would be most appreciated.

Re: Attribute Map exported properties

PostPosted: Sun Oct 08, 2006 3:50 pm
by Aaron
Hi Cliff,

Welcome to the users' group.

The colours in the *_AM.png files, when read as unsigned short integers (16-bit), are the same as the ID#s in the export list. If you want to see the attributes map in the full-colour mode, you might like to follow this part of the user guide:

http://www.bundysoft.com/docs/doku.php?id=l3dt:userguide:ops:am#editing_the_attributes_map

Cheers,
Aaron.

PostPosted: Sun Oct 08, 2006 9:00 pm
by cliff
Wonderful, thank you.

PostPosted: Mon Oct 09, 2006 1:38 am
by cliff
I've gotten it working pretty well, and I have a small followup question. What does a value of 1.0F in Vertical Scale represent in metres? Is there a value somewhere that this is representing a percentage of?

PostPosted: Mon Oct 09, 2006 2:48 am
by Aaron
Hi Cliff,

Cliff wrote:What does a value of 1.0F in Vertical Scale represent in metres? Is there a value somewhere that this is representing a percentage of?


Um...that depends on the 'Vertical Scale' to which you refer (there may be several). From whence do you find this 'Vertical Scale' value?

Anyway, I'll take a stab that this is in some file input/output, which is where I generally do my 'vert scale' tricks to convert from file values to metres. For instance, loading a 16-bit HFF file will have a vertical scale of:

Code: Select all
scale = (maxval - minval) / 65536;


Where scale, minval and maxval are all in metres.

For an 8-bit file, it is:

Code: Select all
scale = (maxval - minval) / 256;


To convert form file values to metres, we use:

Code: Select all
height = fileval * scale;


I hope this helps.

Cheerio,
Aaron.

PostPosted: Mon Oct 09, 2006 3:33 am
by cliff
Yeah, I've got the vertical scale (which is a small fraction) and the height values stored in the HFF. The Vertical Scale float from the data format is coming out as a rather small value... is this a proportion of a maximum value from somewhere?

Perhaps I am missing values in a different file... but while I have the general height value as a proportion from 0 to 1, I do not know what the resultant height should actually be in metres.

PostPosted: Mon Oct 09, 2006 3:55 am
by Aaron
Hi Cliff,

Okay, if you're referring to the HFF the relevant scale info is on the HFF specs page. That page explains how to convert from file values to metres using the vert scale and vert offset (see the reading/writing a HFF sections), and also has source code for loading a HFF.

Cheers,
Aaron.

PostPosted: Mon Oct 09, 2006 4:18 am
by cliff
Ah, I think I must've failed to understand what I was looking at, since that's exactly where I was digging. I think I've found it now, thanks again for all your help!