A Game of Thrones • A Song of Ice and Fire NWN2 Persistent World • Low Magic Role Play

YATT: Rules

Resources - Technical Documentation
Tuesday, 02 December 2008 17:12

Rules are used in YATT to automatically generate colormap or texturemap information from the heightmap. By specifying an expression for the colormap or texturemap, the value for each point in the map can be calculated. One rule can be specified for each colormap or texturemap. They are specified as a simple string.

There are 3 keywords that you can use in the rules. These are:

  • HEIGHT - A value from 0.0 to 1.0 indicating the relative height at the current position. 0.0 will be the lowest and 1.0 the highest.
  • SLOPE - A value from 0.0 to 1.0 indicating the relative slope at the current position. 0.0 will be the lowest and 1.0 will be the steepest.
  • INPUT - A value from 0.0 to 1.0 read directly from the file specified for this map. Using this you can combine a rule with an input bitmap.

The easiest way to see how this is useful is to consider some examples. The easiest is a default colormap. A colormap generally looks best when the steepest areas in the map are set to be darkest. To get this effect, colormaps in the current version of YATT default to the following expression: 1.0 - SLOPE giving the desired effect.

An even simpler example is where you wish to load the entire area with a single uniform texture. In this case, just assign a texturemap and set its rule to a constant value of 1.0.

For a second texture you may then wish to set steep areas to have a cliff or rocky texturing. This is easily achieved by adding a texturemap with its rule set to something like 0.7 * SLOPE.

YATT also understands simple relational and equality expressions. So if you want the top 20% of areas in you texturemap to be set, you can use a rule similar to HEIGHT > 0.8.

You can also combine relational expressions with calculations if you wish. YATT considers true = 1 and false = 0, so something like the following rule would create texturing, which varies with slope but is also only present in positions that are in the top 30% of the height. ( HEIGHT > 0.7 ) * SLOPE * 0.8.

 

Add comment


Security code
Refresh