The Sample Image Generator creates images by rendering a heightmap.

The heightmap is generated by objects implementing IModule. There are currently three mathematical primitives in addition to the noise-based primitives provided by LibNoise for .NET, listed below. The heightmap used by the Sample Image Generator is a unit square, centred on the origin. Note that the coordinates system has y pointing downwards, in the same way as all the .NET Drawing classes.
  • Distance
    • The height returned is the distance of the point in question from a set point
  • Sinewave
    • The height returned is the sine of the distance of the point in question from a set point
  • Gaussian
    • The height returned is based on a Gaussian distribution centred on a fixed point.

An object implementing IPalette is used to assign a colour to each height in the heightmap. There are currently two classes implementing IPalette:
  • LinearPalette
    • The colour assigned to a height depends on a linear mapping of colours specified to the palette.
  • ModulePalette
    • The height to render is taken to be "h". An IModule is queried for it's value as position "h" in the X, Y and Z directions to generate values for the red, green, and blue components of a colour.

Finally, the pixels are rendered to an image using a particular renderer.
  • Flat Renderer
    • The colour of the pixel rendered is the colour returned by the palette. This looks rather dull, and although the source code is still in the repository, it's not being used at the moment.
  • Height Renderer
    • The colour of the pixel rendered is shaded depending on the direction of the surface of the heightmap at that point. This produces a 3D effect.

Last edited Apr 9, 2012 at 12:03 PM by matthewkitson, version 3

Comments

No comments yet.