Skip to content

[BUG FIX] Clamp BatchRenderer deferred RGB packing - #57

Merged
duburcqa merged 2 commits into
Genesis-Embodied-AI:mainfrom
NoahLinckeScout:noah-batch-rgb-pack-clamp
Jul 22, 2026
Merged

[BUG FIX] Clamp BatchRenderer deferred RGB packing#57
duburcqa merged 2 commits into
Genesis-Embodied-AI:mainfrom
NoahLinckeScout:noah-batch-rgb-pack-clamp

Conversation

@NoahLinckeScout

@NoahLinckeScout NoahLinckeScout commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Why

BatchRenderer packs deferred RGB into 8-bit channels. Direct-light values above one were converted to integers before saturation, allowing high bits to spill into adjacent channels and producing cyan/blue material corruption.

What changed

  • Clamp deferred RGB to the representable [0, 1] range before byte packing.
  • Document that this is an LDR output boundary: HDR lighting needs tone mapping upstream rather than relying on overflow behavior.

Impact / safety properties

The change preserves all in-range colors and prevents one channel from contaminating another. Values above one now saturate predictably instead of corrupting the packed pixel.

Validation

Rendered a textured tan vehicle under direct light: BatchRenderer retains the intended material without cyan/blue artifacts. Rasterizer remains correct.

Stack

This branch contains one commit on top of #56. GitHub cannot select another fork branch as this PR’s base, so it targets main; after #56 merges, this becomes a standalone one-commit fix.

Fixes #58.

@duburcqa
duburcqa marked this pull request as ready for review July 22, 2026 11:52
NoahLinckeScout and others added 2 commits July 22, 2026 18:13
Match the alpha-shift convention already used by the sibling pack
helpers (draw_deferred_depth.hlsl, post_process.hlsl). `255 << 24`
is a signed-int left shift into the sign bit; the explicit
`(uint32_t)255` keeps the shift well-defined and consistent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@duburcqa
duburcqa force-pushed the noah-batch-rgb-pack-clamp branch from 493e527 to 413280a Compare July 22, 2026 16:15
@duburcqa
duburcqa merged commit 16ae000 into Genesis-Embodied-AI:main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Deferred RGB packing spills HDR bits into adjacent channels

2 participants