C# (CSharp) LibNoise.Renderer Namespace

Classes

Name Description
AbstractHeightmapRenderer Abstract base class for an heightmap renderer
AbstractImageRenderer Abstract base class for an image renderer
AbstractRenderer Abstract base class for a renderer
Colors Well-known colors.
GradientColor Defines a color gradient. A color gradient is a list of gradually-changing colors. A color gradient is defined by a list of gradient points. Each gradient point has a position and a color. In a color gradient, the colors between two adjacent gradient points are linearly interpolated. To add a gradient point to the color gradient, pass its position and color to the AddGradientPoint() method. To retrieve a color from a specific position in the color gradient, pass that position to the GetColor() method. This class is a useful tool for coloring height maps based on elevation. Gradient example Suppose a gradient object contains the following gradient points: - -1.0 maps to black. - 0.0 maps to white. - 1.0 maps to red. If an application passes -0.5 to the GetColor() method, this method will return a gray color that is halfway between black and white. If an application passes 0.25 to the GetColor() method, this method will return a very light pink color that is one quarter of the way between white and red.
GradientColors Well-known gradient colors.
Heightmap16Renderer class for an 16bit-heightmap renderer
Heightmap32 Implements a 32 bits Heightmap, a 2-dimensional array of float values (+-1.5 x 10^−45 to +-3.4 x 10^38)
Heightmap32Renderer class for an 32bit-heightmap renderer
Heightmap8Renderer class for an 8bit-heightmap renderer
ImageRenderer Renders an image from a noise map. This class renders an image given the contents of a noise-map object. An application can configure the output of the image in three ways: - Specify the color gradient. - Specify the light source parameters. - Specify the background image. Specify the color gradient This class uses a color gradient to calculate the color for each pixel in the destination image according to the value from the corresponding position in the noise map. A color gradient is a list of gradually-changing colors. A color gradient is defined by a list of gradient points. Each gradient point has a position and a color. In a color gradient, the colors between two adjacent gradient points are linearly interpolated. For example, suppose this class contains the following color gradient: - -1.0 maps to dark blue. - -0.2 maps to light blue. - -0.1 maps to tan. - 0.0 maps to green. - 1.0 maps to white. The value 0.5 maps to a greenish-white color because 0.5 is halfway between 0.0 (mapped to green) and 1.0 (mapped to white). The value -0.6 maps to a medium blue color because -0.6 is halfway between -1.0 (mapped to dark blue) and -0.2 (mapped to light blue). The color gradient requires a minimum of two gradient points. @note The color value ie the gradient color has an alpha channel. This alpha channel specifies how a pixel in the background image (if specified) is blended with the calculated color. If the alpha value is high, this class weighs the blend towards the calculated color, and if the alpha value is low, this class weighs the blend towards the color from the corresponding pixel in the background image. Specify the light source parameters This class contains a parallel light source that lights the image. It interprets the noise map as a bump map. To enable or disable lighting, pass a Boolean value to the EnableLight property. To set the position of the light source in the "sky", use the LightAzimuth and LightElevation properties. To set the color of the light source, use the LightColor property. To set the intensity of the light source, use the LightIntensity property. A good intensity value is 2.0, although that value tends to "wash out" very light colors from the image. To set the contrast amount between areas in light and areas in shadow, use the LightContrast property. Determining the correct contrast amount requires some trial and error, but if your application interprets the noise map as a height map that has its elevation values measured in meters and has a horizontal resolution of h meters, a good contrast amount to use is ( 1.0 / h ). Specify the background image To specify a background image, pass an Image object to the BackgroundImage property. This class determines the color of a pixel in the destination image by blending the calculated color with the color of the corresponding pixel from the background image. The blend amount is determined by the alpha of the calculated color. If the alpha value is high, this class weighs the blend towards the calculated color, and if the alpha value is low, this class weighs the blend towards the color from the corresponding pixel in the background image. Rendering the image To render the image, perform the following steps: - Pass a GradientColor object to the Gradient property. - Pass a IMap2D{Single} object to the NoiseMap property. - Pass an IMap2D{Color} object to the Image property. - Pass an Image object to the BackgroundImage property (optional) - Call the Render() method.
NormalMapRenderer Renders a normal map from a noise map. This class renders an image containing the normal vectors from a noise map object. This image can then be used as a bump map for a 3D application or game. This class encodes the (x, y, z) components of the normal vector into the (red, green, blue) channels of the image. Like any 24-bit true-color image, the channel values range from 0 to 255. 0 represents a normal coordinate of -1.0 and 255 represents a normal coordinate of +1.0. You should also specify the bump height before rendering the normal map. The bump height specifies the ratio of spatial resolution to elevation resolution. For example, if your noise map has a spatial resolution of 30 meters and an elevation resolution of one meter, set the bump height to 1.0 / 30.0. Rendering the normal map To render the image containing the normal map, perform the following steps: - Pass a IMap2D object to the NoiseMap property. - Pass an IMap2D object to the Image property. - Call the Render() method.