C# Класс 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.
Наследование: AbstractImageRenderer
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
_WrapEnabled bool
_bumpHeight float

Открытые методы

Метод Описание
NormalMapRenderer ( ) : System

Default constructor

Render ( ) : void

Renders the noise map to the destination image.

Приватные методы

Метод Описание
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.

Описание методов

NormalMapRenderer() публичный Метод

Default constructor
public NormalMapRenderer ( ) : System
Результат System

Render() публичный Метод

Renders the noise map to the destination image.
public Render ( ) : void
Результат void

Описание свойств

_WrapEnabled защищенное свойство

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
Результат bool

_bumpHeight защищенное свойство

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
Результат float