Phase 5 updates

Phase 5 · Slice 12 ·

Cubemaps and reflection probes

  • Cubemap:
    • six faces in Unity's order with row 0 at the top;
    • SetPixel/GetPixel/SetPixels/GetPixels store colors as the format does (8-bit rounding, half floats);
    • mipmaps; Apply uploads half floats, so HDR survives;
    • Texture.dimension and isDataSRGB.
  • Cube textures from images:
    • .meta texture shape 2, and inline {"path"} for _Tex, _Cube and Cubemap fields;
    • 2:1 latitude-longitude panoramas (oriented as Skybox/Panoramic), 6:1 and 1:6 strips, and 4:3 and 3:4 crosses;
    • PNG, JPEG and Radiance .hdr (our own RGBE decoder, flat and run-length encoded).
    • .hdr also loads as a 2D texture, clamped to 8 bits.
  • Skybox/Cubemap draws a cubemap sky (tint, exposure, rotation) and lights the skybox ambient mode.
  • Environment reflections:
    • one cube-array texture holds the sky (slot 0) and up to eight reflection probes (128 pixels a face, 8 mips, RGBA16F);
    • each slot is captured by rendering six views like a camera (no UI), each mip prefiltered by a cone blur for its roughness, then copied in;
    • PBR surfaces sample their slot at Unity's roughness-to-mip curve, with box projection;
    • the sky recaptures when it or the sun changes.
  • ReflectionProbe:
    • Unity's properties and defaults, bounds, RenderProbe (one id per frame) and IsFinishedRendering;
    • realtime probes capture on awake, every frame, or on RenderProbe (nothing before it when refreshed via scripting);
    • baked probes capture once (Unity's baked cubemaps aren't read); custom ones use customBakedTexture;
    • each renderer reflects the most important probe holding its center (the smallest of equals), else the sky;
    • inside captures, surfaces reflect the sky.
  • Unity scenes import probes (Unity's serialized names), and culling-mask BitFields now import for every component (cameras' masks came in as 0).
  • A new reflection_probes scenario records probe defaults, settings, bounds and import, RenderProbe ids, and Cubemap sizes, formats, mips and quantization. 37 scenarios pass in both runs.
  • GPU tests cover:
    • cubemap skies against the GPU's cube convention (and the CPU face lookup);
    • smooth metal reflecting the sky, a probe's background, a probe's captured scene, and a custom cubemap;
    • outside a probe's box, the sky. An MCP e2e test covers a scene-edited probe and an HDR panorama sky.
  • Not yet:
    • OpenEXR;
    • Unity's baked probe cubemaps;
    • blending between probes, time slicing, culling masks and resolution in captures;
    • RenderTexture;
    • the Skybox camera component.
  • Next: post-processing (bloom, tone mapping, color grading) on an HDR target.