Skip to main content

Module impostor_section

Module impostor_section 

Source
Expand description

Section 19 (IMPO): Directional Octahedral Impostor Atlas for .10d Living Containers.

Provides the runtime data container and projection mathematics for Tier 3 rendering (Screen-Space Radius: 8–64 px). At this distance, drawing full geometry or even dense meshlets triggers the GPU 2x2 quad-overdraw penalty. An octahedral impostor replaces the entire geometry with a single camera-facing quad (2 triangles) that samples an offline-baked atlas of directional views.

§Mathematical Foundations

  1. Hemi-Octahedral Projection: Maps upper-hemisphere directional rays $V \in S^2$ ($z \ge 0$) onto a unit square UV coordinate $[0, 1]^2$: $$u = \frac{x}{2(|x| + |y| + z)} + 0.5, \quad v = \frac{y}{2(|x| + |y| + z)} + 0.5$$ This provides uniform solid-angle texel distribution with minimal distortion compared to equirectangular maps.

  2. Barycentric View Interpolation: At runtime, a camera view vector falls between grid cells. The runtime determines the 3 closest discrete camera angle viewpoints on the octahedral grid and blends them with barycentric weights, providing parallax-free rotation without popping.

  3. Packed Channels:

    • Slice 0: Albedo RGB + Radial Depth A (for depth-buffer reconstruction and soft intersections).
    • Slice 1: Octahedral normal map + Metallic/Roughness.

Structs§

ImpostorAtlasMiniHeader
64-byte POD header encoding octahedral impostor atlas in SectionType::ImpostorAtlas (19).
ImpostorBlendSample
Viewpoint blending information for smooth camera interpolation.

Enums§

ImpostorSectionError

Constants§

FLAG_DEPTH_IN_ALPHA
FLAG_HEMI_OCTAHEDRAL
FLAG_OCT32_NORMALS
FLAG_PBR_METALLIC_ROUGHNESS
IMPOSTOR_MINI_HEADER_SIZE
IMPOSTOR_SECTION_VERSION
MAGIC_IMPO

Functions§

decode_impostor_section
Decode impostor header and extract zero-copy slice of atlas payload. Zero heap.
encode_impostor_section
Encode impostor header and binary atlas payload into caller-supplied buffer. Zero heap.
hemi_octahedral_decode
Unproject 2D octahedral UV coordinates $[0.0, 1.0]^2$ back to a normalized 3D directional vector on the upper hemisphere.
hemi_octahedral_encode
Project a normalized 3D direction vector $V = (x, y, z)$ on the upper hemisphere ($z \ge 0$) onto 2D octahedral UV coordinates $[0.0, 1.0]^2$.
sample_impostor_blend_weights
Calculate the 3 closest discrete camera viewpoints on the octahedral grid and their barycentric blending weights.