TextureTile
Description
Represents a texture tile in a texture atlas.
In order to get correct texture coordinates, the following steps must be performed:
-
Provide per-vertex texture coordinates (e.g. by using VertexFormat.HeightmapCoordinates).
-
Call TextureAtlas.TileLookup to check if a tile texture is available for the given pyramid tile coordinates.
-
Call TextureAtlas.TileSetup to obtain the texturing coefficient vectors Offset, U and V.
-
Render geometry separately per cubemap face.
-
Use the following formulae to transform cubemap texture coordinates
X
,Y
andZ
to tile texture coordinatesS
andT
:S := ([X, Y, Z] * U + Offset.X) + Offset.Z T := ([X, Y, Z] * V + Offset.Y) + Offset.W
-
Clamp
S
andT
to Bounds in order to avoid color bleeding at the tile edges:Bounds.X <= S <= Bounds.Y Bounds.Z <= T <= Bounds.W
Clamping should be done on the GPU to avoid distortions between vertex positions and texture coordinates.
The formulae above are free of precision issues as long as the GPU is capable of handling at least 24 effective floating-point mantissa bits during vertex processing.
- See also
Public / Attributes
Gamma
The gamma correction to apply on the GPU.
After sampling Texture, the following computation must be performed on the GPU:
output.rgb = pow(input.rgb, Gamma);
where input
is the texture sample and output
is the tuple that will be further processed by the GPU shader. Usually, Gamma will be 1
, i.e. GPU texture sampling and CPU texture encoding use the same sRGB behaviour. Different behaviour will result when a texture atlas holds texture tiles that have been encoded with different sRGB behaviour flags.
Slice
The texture slice to use or -1
if the texture for the given pyramid tile is not ready yet or does not exist.
- See also