Textures
The renderer supports two texture dimensionalities - Texture2D for flat images and Texture3D / cubemaps for volumetric and environment data. Both are managed by ResourceManager and loaded asynchronously per backend.
Texture2D
A Texture2D wraps a single 2D image. Common uses include albedo maps, normal maps, roughness/metallic maps, and shadow map reads.
Registration
auto res = ResourceManager::get();
res->register_texture(Texture2DDescriptor::create("albedo", "textures/albedo.png"_engine));
res->register_texture(Texture2DDescriptor::create("normal", "textures/normal.png"_engine));Descriptor Fields
| Field | Type | Description |
|---|---|---|
id | std::string | Unique identifier used to look up the texture |
path | Path | Engine-relative path to the image file |
format | TextureFormat | Pixel format (inferred from file if omitted) |
generate_mipmaps | bool | Whether to build the full mip chain on upload |
wrap | TextureWrap | UV wrapping mode (Repeat, ClampToEdge, etc.) |
filter | TextureFilter | Sampling filter (Linear, Nearest) |
Sampling in a Pass
Textures are bound through the active GraphicsPipeline or shader uniform:
auto* tex = ResourceManager::get()->get_texture2d("albedo");
pipeline->bind_texture(tex, /* slot */ 0);Texture3D & Cubemaps
Texture3D covers both volumetric textures (e.g. LUT volumes) and cubemaps (six-face environment maps used by the skybox and IBL).
Cubemap Registration
res->register_texture(Texture3DDescriptor::create(
"sky_cubemap",
{
"textures/skybox/right.png"_engine,
"textures/skybox/left.png"_engine,
"textures/skybox/top.png"_engine,
"textures/skybox/bottom.png"_engine,
"textures/skybox/front.png"_engine,
"textures/skybox/back.png"_engine,
}
));Usage with Skybox
// In Scene::start()
auto* skybox = add_entity<Skybox>("Sky");
skybox->cubemap_id = "sky_cubemap";
skybox->shader_id = "skybox_shader";
skybox->add_component<MeshComponent>();
skybox->add_component<ResourceComponent>();SkyboxPass resolves the cubemap handle each frame and binds it as a samplerCube uniform.
Uploading
Both types are uploaded together with the rest of the descriptors:
res->load_from_descriptors<Texture2DDescriptor, Texture3DDescriptor>(
RendererBackend::OpenGL
);See Async Resource Loading for details on load states and generational handles.
Formats
| Format | Usage |
|---|---|
RGBA8 | Standard color textures |
RGBA16F | HDR color, render targets |
DEPTH_ONLY | Shadow maps, depth prepass |
R8 | Single-channel masks, AO |
RG16F | Normal maps (BC5 variant) |