< Animation Resources | UserGuide | Shader Resources >


Textures (:api:texture:::)

Luxinia can load .png, .jpg, .dds and .tga textures.

Textures can be requested to be loaded by using Lua. In most cases, the textures are loaded automaticly by models, material scripts or particle scripts. Luxinia provides some special functions to create CUBE,2D atlas textures and alike from a series of 2d images (:api:texture:combine2d::).

It is also possible to create textures from within luxinia, and use them as rendertarget. Therefore it's possible to create 16/32 bit float rendertargets for HDR lighting or other custom effects.

You can change the data of the texture completely or partially at runtime using (:api:texture:uploaddata:uploaddata:). You can also retrieve the data to local memory, or keep at load and manipulate/access pixels.

  • Color Types (:api:textype::textype class:)
    • RGB,RGBA: typical 3 or 4 channel colors (when missing Alpha defaults to white)
    • ALPHA: single channel alpha only (color defaults to white)
    • LUMINANCE: single channel color only
    • ABGR,BGRA: different color layouts, BGRA is common with bitmaps and is fastest format to upload.
    • DEPTH: for depthbuffer useage in different precisions available. special format that is equivalent to z-buffer storage (typically non-linear). Such textures can be used in twomodes when bound in a shader, as "comparison" or "byvalue", the first is default and useful for shadow-mapping.
    • STENCIL: for stencilbuffer useage. As hardware typically packs 24-Bit DEPTH + 8-Bit STENCIL, DEPTHSTENCIL should be favored instead of two textures (when both are needed).
  • Format Types
    • 1D: images with a height of 1 pixel become 1D. Useage is mostly lookup textures in shadres.
    • 2D: regular image textures, typically power-of-2 dimensions and used as textures.
    • 3D: a volume texture (needs hardware capability, which cards since GeForce3? typically have). Slowest type of all textures.
    • CUBE: a cubemap contains 6 2d textures making the insides of a box. Mostly used for reflection or skymaps, but can also be used for special lighting effects.
    • RECT: 2d textures with non-power of 2 sizes are normally loaded as rectangle textures. RECT textures need texture coordinates in [0,texturesize] compared to all other formats using [0,1].
  • Data Storage The way the pixeldata is kept in regular memory, and before uploaded to graphics card. Typically the data is not kept resident in memory unless you explicitly ask for it. Be aware that OpenGL? driver may do a local copy of a texture as well. Which mans you might end up having the texture twice in RAM and once in VRAM, when you keep it locally resident.
    • unsigned byte: each color channel is 8-bit wide and can have 256 values [0,255].
    • unsigned short: [0,65535] 16-bit wide
    • float: 32-bit signed floats.
    • compressed: via DDS data can be pre-compressed for faster uploads, however you cannot access pixel data at runtime then.
  • Data Upload
    • 8-Bit: default for most textures
    • 16-Bit: for higher precision single or double channel formats.
    • 16-Bit float: new graphics card support floating point textures, but often without mipmapping support. Main purpose is offscreen-rendering for true HDR effects.
    • 32-Bit float: higher precision than 16-Bit, but double the costs. Typically 16-Bit is sufficient and should be preferred.