Skip to content

[FEAT] Add skybox rendering support #568

@Miou-zora

Description

@Miou-zora

Problem Statement

The engine currently has no built-in skybox rendering support. Skyboxes are a standard feature in 3D engines, used to provide a realistic or atmospheric background to scenes. Without this, scenes render against an empty/clear background with no environmental context.

Proposed Solution

Add a skybox rendering system to the engine that:

  • Accepts a cubemap texture (loaded via the cubemap loading system — see [FEAT] Add cubemap loading support #567).
  • Renders the skybox as a full-screen background cube drawn at maximum depth, behind all scene geometry.
  • Integrates cleanly into the existing render pipeline (e.g. as a dedicated render pass or a pre-pass step).
  • Exposes a simple API for enabling/disabling the skybox and swapping cubemaps at runtime.

Alternative Solutions

  • Render the skybox as a large sphere (skysphere) instead of a cube — simpler geometry but requires equirectangular texture mapping.
  • Use a procedural sky shader instead of a cubemap — no asset dependency but higher shader complexity.

Use Cases

  • Use case 1: A developer sets a cubemap and sees a seamless sky rendered around the scene without any additional configuration.
  • Use case 2: A game switches between indoor and outdoor scenes and swaps the active skybox cubemap at runtime.
  • Use case 3: A future PBR pipeline samples the skybox cubemap for image-based lighting (IBL).

Impact

  • New rendering feature — additive, no breaking changes to existing render passes.
  • Requires the cubemap loading feature ([FEAT] Add cubemap loading support #567) to be completed first.
  • Minor GPU cost for the skybox draw call (negligible in practice).

Implementation Details (optional)

  • Render a unit cube with depth test set to LESS_OR_EQUAL and the vertex shader outputting pos.xyww to place the cube at maximum depth.
  • Use a dedicated skybox vertex and fragment shader that sample the cubemap using the view direction.
  • Strip translation from the view matrix so the skybox always appears infinitely distant.
  • Integrate as a system or component in the ECS so the skybox can be toggled per-scene.

Additional Context

N/A

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Not planned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions