PixelLayer

Description

abstract class Tinman.Terrain.Heightmaps.Painting.PixelLayer

Derived from

IPixelLayer

Abstract base class for IPixelLayer implementations.

Public / Constructors

Coverage


public static method Coverage → (2)

colorRamp opt : IColorRamp = null

The color ramp to use. If null, a default black/white color ramp will be used.

adjustRange opt : bool = false

Transform the given colorRamp opt to the input range [0..1]?

returns → IPixelLayer

The pixel layer.

Creates a pixel layer that renders the coverage layer (see HeightmapLayer.Coverage) into the output pixel buffer.

Default


public static method Default → (3)

heightmap in : IHeightmap

[not-null]
The heightmap.

lit opt : bool = true

Use baked lighting?

layers opt : HeightmapLayer = HeightmapLayer.All

The layers of heightmap in to use.

returns → IPixelLayer

The default pixel layer.

Creates a default pixel layer for the given heightmap.

Displacement


public static method Displacement → (2)

colorRamp opt : IColorRamp = null

The colors to use. If null, a simple black/white ramp is used.

adjustRange opt : bool = false

Transform the given colorRamp opt to the vertical range (see HeightmapRegion.Vertical)?

returns → IPixelLayer

The pixel layer.

Creates a pixel layer that reads HeightmapLayer.Displacement samples, applies a color-ramp to them and stores the resulting pixels in the output buffer.

Elevation


public static method Elevation → (2)

colorRamp opt : IColorRamp = null

The colors to use. The color ramp input coordinates are terrain-space elevation values in metres. If null, a simple black/white ramp is used.

adjustRange opt : bool = false

Transform the given colorRamp opt to the vertical range (see HeightmapRegion.Vertical)?

returns → IPixelLayer

The pixel layer.

Creates a pixel layer that reads HeightmapLayer.Elevation samples, applies a color-ramp to them and stores the resulting pixels in the output buffer.

Material

2 overloads


public static method Material1 → (1)

materials in : MaterialKeys

[not-null]
The material keys to use.

returns → IPixelLayer

The pixel layer.

Creates a pixel layer that renders the material layer (see HeightmapLayer.Material) into the output pixel buffer, using the given material color keys.

See also

MaterialToken


public static method Material2 → (4)

materialRed opt : int32 = 0

ID of material which weight to encode in the PixelChannel.Red channel.

materialGreen opt : int32 = 1

ID of material which weight to encode in the PixelChannel.Green channel.

materialBlue opt : int32 = 2

ID of material which weight to encode in the PixelChannel.Blue channel.

materialAlpha opt : int32 = 3

ID of material which inverse weight to encode in the PixelChannel.Alpha channel.

returns → IPixelLayer

The pixel layer.

Creates a pixel layer that renders the given materials of the material layer (see HeightmapLayer.Material) into the output pixel buffer.

See also

MaterialToken

Normals


public static method Normals → (1)

stretch opt : bool = false

Stretch normal vectors so that the maximum absolute component is one (true), or use unit-length normal vectors (false)?

returns → IPixelLayer

The resulting pixel layer.

Renders normal vectors (see PaintingBuffer.Normals) into the output pixel buffer.

The red, green and blue channels define the tangent-space normal vector (not necessarily of unit length). The alpha channel is ignored.

The relative pixel intensities (red, green, blue) in the range [0..1] are mapped to the unit cube:

red  :[0..1] => X:[-1 .. +1]
green:[0..1] => Y:[-1 .. +1]
blue :[0..1] => Z:[-1 .. +1]

where X+ is the tangent direction (positive texture U-axis), Y+ is the bitangent direction (positive texture V-axis) and Z+ is direction of the surface normal vector.

Occlusion


public static method Occlusion → (2)

padding opt : int32 = 0

[>=0]
The amount of padding to use (see IPixelLayer.Padding).

range opt : int32 = 0

[>=0]
The maximum distance (in pixels) that a ray may travel before being discarded. If 0, rays will never be discarded.

returns → IPixelLayer

The pixel layer.

Creates a pixel layer that renders ambient occlusion terms as grayscale pixels into the output pixel buffer (black := fully occluded, white := no occlusion).

Ambient occlusion is computed by casting 16 rays (see 0.. F) per pixel (see x), collecting the horizon angle for each one. The resulting ambient occlusion term is the average horizon angle (i.e. 0 means no occlusion at 0°, 1 means maximum occlusion at 90°).

+---+---+---+---+---+
| A | B | C | D | E |
+---+---+---+---+---+
| 9 |   |   |   | F |      |
+---+---+---+---+---+      |
| 8 |   | x |   | 0 |   ---+--> X
+---+---+---+---+---+      |
| 7 |   |   |   | 1 |      V
+---+---+---+---+---+      Y
| 6 | 5 | 4 | 3 | 2 |
+---+---+---+---+---+

The range opt parameter can be used to speed up computation time, at the cost of accuracy. In combination with the padding opt parameter, the generated pyramid tiles will be seamless iff range opt is not zero and less than or equal to padding opt.

Slopes


public static method Slopes → (1)

colors opt : IColorRamp = null

The colors to use. Slope values (between 0° and 90°) are passed to the color ramp.

returns → IPixelLayer

The resulting pixel layer.

Renders slope angles (see PaintingBuffer.Slopes) into the output pixel buffer.

Texture


public static method Texture → (1)

materials opt : MaterialKeys = null

The material keys or null.

returns → IPixelLayer

The pixel layer.

Creates a pixel layer that copies the texture layer (if materials opt is null) to the output pixel buffer or renders the material layer using the given material color-keys.

Uniform


public static method Uniform → (1)

color opt : int64 = Colors.White

The color to clear to.

returns → IPixelLayer

The pixel layer.

Returns a pixel layer that initializes all pixels in the output buffer to the given color opt.

Protected / Methods

DoComputeLayerPixels


protected abstract method DoComputeLayerPixels → (2)

input in : PaintingBuffer

The input buffer.

output in : ColorBuffer

The output buffer.

Performs the work of IPixelLayer.ComputeLayerPixels, after all input parameters have been validated.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<IPixelLayer>

[not-null]
The configurator object.

The configurator object for this type.