Namespace Apogee.Rendering¶
Namespaces¶
Classes¶
A perspective camera in a right-handed world (+Y up, looking down -Z at yaw 0). The projection is reverse-Z with an infinite far plane: the
near plane maps to depth 1 and infinity to 0, which spreads float precision evenly over the whole depth range. Normalized device y points
down, as in Vulkan, so no viewport flip is needed; the image, and so the winding of triangles (counter-clockwise for front faces, as in glTF), is unchanged.
The position is a
The grid lights are culled against: 16 x 9 cells over the screen and 24 slices in depth, spaced exponentially from the camera's near plane
to
Debug drawing for Luau scripts, as the global table debug_draw: lines and shapes that last one frame, drawn over the world. Call them every frame (from a system, or from the
devtools.on_gui function) for as long as they should show. Colors are vectors of red, green and blue from 0 to 1; without one a line is white. Positions are the world's.
With nowhere to draw (no renderer) the calls do nothing.
The photographic exposure maths of the renderer, on the CPU: the twin of exposure.slang and of the exposure functions in common.slang, which the tests compare it with.
Scene light is photometric: the forward pass writes luminance in cd/m2 (a sun of E lux on a white diffuse surface gives E / pi cd/m2). The camera's exposure is an
EV100, the exposure value at ISO 100: EV100 = log2(N^2 / t) - log2(S / 100) for an aperture f/N, a shutter time t in seconds and a sensitivity S. The
forward pass multiplies its result by 1.2 * 2^EV100 cd/m2, and a fp16 image cannot overflow with a bright sun.
A
The models that entities draw (models). A model is loaded once per path whatever the number of entities
that show it, and reloaded in place when its file changes, so entities keep their id. Ids are never reused.
Several overlays as one, drawn in order over the finished image: the game's UI first, the dev tools on top of it.
One
An ECS
The Forward+ renderer. Every frame it builds a render graph: a depth prepass, a light-culling compute pass over the 16 x 9 x 24 cluster grid, the PBR forward pass (opaque and alpha-masked, then blended draws far to near), and a tone-mapping pass into the target.
Structs¶
A perspective camera at the entity's
The push constants of both auto-exposure passes (exposure.slang).
The Gran Turismo 7 tone mapping operator, on the CPU: the twin of the one in tonemap.slang, which the tests compare it with. It is a port of Polyphony Digital's sample
implementation gt7_tone_mapping.cpp (version 1.0, MIT licence, Copyright (c) 2025 Polyphony Digital Inc.; the notice is in Legal/THIRD_PARTY_NOTICES.md).
The operator works on linear Rec.2020 colors in "frame-buffer" units, where 1.0 is
A light at the entity's
Marks the
Draws a model at the entity's models.load in scripts); 0, or an id the library no longer knows, draws nothing. Many entities may share a model.
Where the final image goes: the window's image, an offscreen one that is read back, or one that is drawn as a texture afterwards (an editor's viewport).
Interfaces¶
Something drawn over the finished image: the dev overlay. It adds its own pass to the frame's graph.
Enums¶
How the camera's exposure is chosen.
The tone mapper that turns the exposed HDR image into the display's range. See Docs/manual/graphics/tone-mapping.md.