C# Class LibNoise.Renderer.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.
Inheritance: AbstractImageRenderer
Afficher le fichier Open project: everbytes/LibNoise

Protected Properties

Свойство Type Description
_WrapEnabled bool
_bumpHeight float

Méthodes publiques

Méthode Description
NormalMapRenderer ( ) : System

Default constructor

Render ( ) : void

Renders the noise map to the destination image.

Private Methods

Méthode Description
CalcNormalColor ( float nc, float nr, float nu, float bumpHeight ) : IColor

Calculates the normal vector at a given point on the noise map. This method encodes the (x, y, z) components of the normal vector into the (red, green, blue) channels of the returned color. In order to represent the vector as a color, each coordinate of the normal is mapped from the -1.0 to 1.0 range to the 0 to 255 range. 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. The spatial resolution and elevation resolution are determined by the application.

Method Details

NormalMapRenderer() public méthode

Default constructor
public NormalMapRenderer ( ) : System
Résultat System

Render() public méthode

Renders the noise map to the destination image.
public Render ( ) : void
Résultat void

Property Details

_WrapEnabled protected_oe property

This object requires three points (the initial point and the right and up neighbors) to calculate the normal vector at that point. If wrapping is/ enabled, and the initial point is on the edge of the noise map, the appropriate neighbors that lie outside of the noise map will "wrap" to the opposite side(s) of the noise map. Otherwise, the appropriate neighbors are cropped to the edge of the noise map. Enabling wrapping is useful when creating spherical and tileable normal maps.
protected bool _WrapEnabled
Résultat bool

_bumpHeight protected_oe property

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. The spatial resolution and elevation resolution are determined by the application.
protected float _bumpHeight
Résultat float