Graphics‎ > ‎3D‎ > ‎


Every game needs a crate texture

Early on textures was simply mapped onto the polygons. Then with the use of multiple textures one could started to blend them in the fixed function pipeline. Now with shaders textures are not so much specific images but rather data that one needs to pick and choose how to use them in the shader. For the details on how textures are used and abused look in the Material section.

Texture Dimension
A texture can be in one-, two-, or three-dimensions. A 2D texture is a image, a 3D texture is a volume and a 1D texture is like a gradient. Each element in the texture is called a texel and to select a texel one use coordinates of the same dimension as the texture. The coordinates normally go from 0 to 1 so [0.5,0.5] is in the middle of a 2D texture. Getting the texel from the texture with a coordinate is called sampling the texture.

Texture Size
The size of the texture is how big each dimension is in number of texel's. It's common for sizes to be power of two (64,128,256,512,...) as graphic cards liked it best that way. The size in all the dimensions does not need to be the same. The max size supported depends on the graphic card and available memory. One solution to large textures is to use Virtual Texture that are not all loaded at the same time.

Texture Format
The format of a texture describe what data each texel contain.
Filtering and Mipmapping
Say there is a textured surface on the screen where each texel is covering one pixel. If the surface move closer each texel with start to cover more then one pixel, known as texture magnification. If the surface move away there will be more then one texel inside each pixel, known as texture minification. In each of these cases a filtering function is used to select what the color of the texel that is sampled from the texture will be. The visual quality can be improved with mipmaps. A mipmap for a texture is a chain of down sampled images of the texture. So a 256x256 texture have mipmaps of size 128x128,64x64,32x32 and so on. When trying to sample a texture the mipmap is first selected depending on the distance to the surface drawn and then the mipmap is sampled with the filter functions. Mipmaps only affect minification.

Texture filtering
    • Nearest: Takes the texel closest to the ones that we try to sample. Creates a Minecraft style blocky pixel effect during magnification.
    • Bilinear: Take the four nearest texels to the part we try to sample and combine them.
    • Trilinear: Select the two closest mipmaps and sample them both with bilinear filtering. The two values are then interpolated for the final result.
    • Anisotropic:



    Compressed GPU texture formats – a review and compute shader decoders – part 1

    Quick Introduction to Mesh Shaders (OpenGL and Vulkan)

    Subpages (3): Atlas Mapping Virtual Texture