Base Asset class for texture handling; textures are basically images that are used with Material; and are used to be mapped onto the surfaces a Material is applied to.
There are multiple subtypes of textures that can be created:
Image: Which are basically filed from popular image format usually created by an external image manipulation program.
Attachment: Which are built to store the rendering result of a Camera.
Font: Provides 2D font capabilities generated from a .TTF
of .OTF
file.
Video: Allows you to render in real-time .OGV
VideoBuffer.
Storage: Used to store the result of a compute Shader.
Band and Vector: Provides user based gradient functionalities that are mostly used for special effects etc...
See Also
Name | Description |
---|---|
asset | Parent Asset maintaining the active Texture component. |
data | Access the properties and settings for the active TextureType. |
sampler | Access the GPU Sampler associated to the current Texture. |
texmap | Access the Texmap connected to the current Texture. |
mipmap_count | Total amount of manual mipmap slots defined for the active Texture. |
cubemap_count | Amount of Cubemap that is currently using the active Texture. |
usage | Specify the UsageType of the current Texture. |
buffer_id | Internal Texture buffer id assigned by the GPU (if any). |
Name | Description |
---|---|
Update | Update and optionally rebuild the active Texture. |
AddMipmap | Allow the user to add and define a new mipmap slot. |
SetMipmap | Manually connect an existing Texture Asset to be used by a specific mipmap slot. |
GetMipmap | Helper to retrieve the Texture connected to a certain mipmap level. |
GetMipmapIndex | Helper to check if a certain Texture is connected to a mipmap level. |
SetMipmapIndex | Manually change the slot index number of an existing mipmap Texture. |
RemoveMipmap | Remove a specific mipmap slot by index. |
SwapMipmaps | Exchange the position of two exsiting mipmap slot. |
SetUsage | Modify the UsageType of the current Texture. |
Available types of Texture.
kAttachment
: This type of texture is designed to be used by a Camera FrameBuffer and represent a FrameBuffer attachment which can either be color, depth or depth+stencil.kImage
: A Texture of the type kImage
is a standard two-dimensional texel buffer that can be populated by commonly used file formats or manually by the user.kFont
: A font Texture allows you to write Text on screen. Generated from a Truetype Font file (.ttf and .otf); font textures are built to be assigned to a Text Object.kVideo
: Generally in conjunction with a VideoBuffer; this type of Texture has its own specific set of settings that will affect the quality of the output.kStorage
: A storage Texture is a specific type reserved to store the result of a compute Shader.kColorBand
: Gradient like Texture where each color along the band can be specified by the user.kColorVector
: A color vector Texture is a type of LUT where each color component can be controlled independently by a Curve.All possible ways of filling a Texture is pretty standard and the pixels are available "as-is" and place accordingly. However, there is one exception; when the Texture Texmap data have been filled by a .IES
file.
IES lights are used by many lighting manufacturers and are one of the industry standards in photometric data distribution. An IES file is basically the measurement of the distribution of light stored in ASCII format; once processed it looks like a grayscale gradient.
The Shader below is showing you how to actually apply this data on the lighting of your Scene using an IES texture.
vec3 L = normalize( <light_position> - <world_position> ); // Calculate the light vector.
vec3 D = <ligth_direction>; // Get the light direction vector.
float LD = acos( dot( L, D ) ) * M_PI_INV; // Calculate the sample on the IES map.
float A = texture2D( <IES_Sampler2D>, vec2( LD ) ).x; // Read the attenuation for the current sample.
<my_lighting_calculation> * A; // Apply the attenuation to your lighting calculation.
|