SkyboxPass
SkyboxPass renders a cubemap-based skybox as the scene background. It writes to scene_color after opaque geometry and relies on depth testing to ensure the sky only fills unoccupied pixels.
Render Graph Role
| Attribute | Value |
|---|---|
| Group | Geometry |
| Reads | - |
| Writes | scene_color |
| Cullable | Yes |
Setup
A skybox entity must be present in the scene. The pass resolves its cubemap_id and shader_id each frame through ResourceManager:
// 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>();If no skybox entity exists, the pass is a no-op for that frame.
Rendering Technique
The pass renders a unit cube centered on the camera. The vertex shader strips the translation component from the view matrix so the skybox appears infinitely distant. Depth writes are disabled; the fragment shader outputs to gl_FragDepth = 1.0 so depth testing clips the skybox behind any geometry drawn earlier.
Cubemap Registration
Cubemaps are registered as Texture3DDescriptor with six face paths:
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,
}
));See Textures for cubemap registration details.