Repository navigation
fix(rendering): let Color carry HDR values above 1 - #702
Closed
stormmuller wants to merge 1 commit into
Closed
stormmuller wants to merge 1 commit into
stormmuller wants to merge 1 commit into
Conversation
Color clamped r, g and b to [0, 1], so HDR tints and clear colors were silently capped at white before reaching an hdr render target. RGB is now only clamped to 0 from below; alpha stays in [0, 1]; non-finite channels throw; toRGBAString clamps its output to 255. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLZGR5YxNP6W4AW3coFP9h
Member
Author
|
Closing: #710 ("let colors go brighter than white") already landed on Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Colorclamped r, g, b and a to [0, 1] in its constructor. Forge has HDR render targets, bloom and tone mapping, but an HDR tint, clear color or emissive color (e.g.new Color(4, 2, 0.5)) was silently capped at white. The demo game worked around this: it darkens its UI buttons at rest "since forge clamps tints to 1", because otherwise hover can't make them any brighter.The constructor was the only place values were capped. Everything downstream already carries plain floats with no cap: sprite tint instance data, text effect data, material uniforms, and
RenderContext.clear.r,g,bare clamped only at 0 from below; values above 1 are kept ("overbright"). Unity, Godot and Bevy all keep colors unbounded too.ldrtargets and the canvas saturate overbright values when they're written;hdrtargets keep them.c/(c+1), which divides by zero at -1.SRC_ALPHA, ONE_MINUS_SRC_ALPHAblend.toRGBAString()caps each channel at 255, since CSS can't express HDR.lerpColorin the UI transition system: back and elastic easings that overshoot can now show a brief overbright tint, which is what an overshoot easing means. There's a comment on this.solution-reviewerverdict: approve. It also asked for:bloom.mdandhdr-rendering.mdupdated to cover HDR tints and clear colors.All three are done.
Related issue(s)
Once released, the demo game can drop its button-dimming workaround in
src/ui/create-menu-button.ts.Verification checklist
npm run check-typespasses with 0 errorsnpm testpasses. New tests cover:toFloat32Array;toRGBAStringcapping at 255.npm run lintpasses with 0 errorsnpm run cspellpasses with 0 errors ("overbright" added to the project words)npm run check-exportspassesrendering/bloom.md(HDR tints as a way to make something glow) andrendering/hdr-rendering.md(new "Brighter-than-white colors" section)Changelog
## [Unreleased]inCHANGELOG.md(Fixed, including what consumers relying on the clamp need to do)🤖 Generated with Claude Code
https://claude.ai/code/session_01FLZGR5YxNP6W4AW3coFP9h
Generated by Claude Code