TexturingBatch

Description

struct Tinman.Terrain.Meshing.TexturingBatch

Output batch of the Texturing class.

TexturingBatch values have the following natural sort order:

  1. TextureAtlas.TextureIndex of BaseTexture in Atlas (ascending)

  2. TextureAtlas.TextureIndex of Texture in Atlas (ascending)

  3. Batch (ascending)

Public / Constants

Empty


public static readonly attribute Empty → (TexturingBatch)

The empty batch.

Public / Attributes

Atlas


public readonly attribute Atlas → (TextureAtlas)

The associated TextureAtlas object.

BaseSector


public readonly attribute BaseSector → (int32)

The parent mesh sector.

BaseTexture


public readonly attribute BaseTexture → (int32)

Handle of the base texture tile (see TextureAtlas.TileSetup).

Batch


public readonly attribute Batch → (SectorBatch)

The mesh sector batch.

Blend0


public readonly attribute Blend0 → (Vec4F)

Coefficient vector for distance-based texture tile blending on the GPU.

Tile blending is necessary in order to avoid visible artifacts due to swapping of texture tiles; it can be performed on the GPU with the Blend0 and Blend1 coefficients according to this formula:

        /    1 \
        |    u |
f     = |    v | * (Blend0 / x + Blend1)
        \  u*v /

pixel = (1 - f) * S0 + f * S1;

Values on the GPU:

    u, v   : texture coordinates
    x      : Distance between camera and vertex
    S0     : Sample of parent texture tile
    S1     : Sample of child texture tile
    Blend0 : Shader constant (per-texture state)
    Blend1 : Shader constant (per-texture state)

The texture coordinates u and v have been set up with TextureAtlas.TileSetup and been computed on the GPU as described there. The blend factor f can optionally be modified by a smoothstep function (e.g. Maths.SmootherStep1). This will make the transition slope steeper at the center. Additionally, the texture tile age (see TextureAtlas.TileFadeReset and TextureAtlas.TileFadeFactor) can be used to fade in freshly loaded tiles.

Blend1


public readonly attribute Blend1 → (Vec4F)

Coefficient vector for distance-based texture tile blending on the GPU.

See remarks of Blend0 for details.

Coords


public readonly attribute Coords → (PyramidCoords)

The pyramid tile coordinates of this texturing batch.

Texture


public readonly attribute Texture → (int32)

Handle of the texture tile (see TextureAtlas.TileSetup).