HOOPS Luminate Textures and Images
Image and texture management is a key part in HOOPS Luminate. Textures are needed to reach a high visual quality, and images in general can be processed by HOOPS Luminate for a variety of purposes. In the rest of this book as in the HOOPS Luminate API documentation, we’ll refer indifferently to texture or images as the same type of object.
A texture is generally a source image loaded somehow from the computer disk and intended to be applied to an object for its rendering (a wood texture on a wooden shelf for instance, a marble texture, etc…). An image is the generic term designating an array of pixels, that can be used for any purpose. In HOOPS Luminate we’ll switch between terms depending on the way they get used, but in the end this is the same object under the hood.
Image Types
HOOPS Luminate supports different types of images:
Image Type |
Interface |
Description |
---|---|---|
|
This is the most common image kind found. HOOPS Luminate supports both POTD (Power-Of-Two-Dimensioned) and NPOTD (Non-Power-Of-TwoDimensioned) 2D images. POTD images can benefit of hardware rendering modes that NPOTD images can’t use. NPOTD images have a wider range of available pixel formats than POTD images do have. This category covers 1D images (color ramps) as well. |
|
See under the section Creation of 2D Images |
|
Render images is one of the most important 2D images types in HOOPS Luminate, as render images capture the rendering results of an auxiliary Render images are 2D images. |
|
Given one more dimension, HOOPS Luminate can store 3D images as blocks of texels, and provides a ( u, v, w ) sampling access to these images. |
|
|
Cube images define 6 faces of a cube and are commonly used for spherical or cubical environmental mapping display. |
|
|
A composite image is a HOOPS Luminate specific image. A composite image is a 2D image that is generated by user-defined (or built-in) HOOPS Luminate programs. A composite image can be used to implement a complete hierarchical shading tree that results in a single 2D image that can then be reused by a shader. |
|
|
The readback is another specific image kind in HOOPS Luminate. A readback image provides the application with a direct channel from the GPU video memory by reading pixels back to the CPU. This image kind should be used by high performance applications that need to retrieve data from the video board. |
Image Pixel Formats
Various image pixel formats are supported in HOOPS Luminate. These are defined by the RED::FORMAT
enumeration. These formats are divided in two categories:
LDR formats (Low Dynamic Range), that store a single colour component on 8 bits. A value stored on 8 bits [0,255] is usually mapped to the [0.0,1.0] range of values when used for shading purposes: There are 1 channel, 3 channels and 4 channels LDR formats available. Some of them have hardware compressed modes.
HDR formats (High Dynamic Range), storing a single colour component on 16 bits (for the half-float formats) or 32 bits (for the float formats). Some very old graphics hardware don’t support floating point formats. 3 channels and 4 channels HDR formats are available.
HOOPS Luminate also features a special anti-aliased HDR format (the RED::FMT_FLOAT_RGBA_AA
format). This is a special HOOPS Luminate compressed format storing anti-aliasing and background information in a HDR image. This format authorizes dynamic edition of post-processing settings during and even after the rendering has completed.
Please, refer to the chapters dedicated to each image type for in-depth explanations.
The Image Target
Each image has a target which can be any of the RED::TARGET
enumeration entries. This describes the usage we can make of the image. However, when using software rendering, targets are relaxed a little bit as RED::TGT_TEX_1D
is a special case of RED::TGT_TEX_2D
while there is no difference between RED::TGT_TEX_2D
and RED::TGT_TEX_RECT
.
When writing hardware shaders you need to be careful to make your texture sampling code to match the target of the input textures (especially power-of-two 2d textures need texture coordinates in [0,1]x[0,1] while RECT 2d textures need texture coordinates in [0, texture width]x[0, texture height]). This is fully covered in Manipulating Images under section Using Images as Textures.