Repository navigation
feat(shader_material): modulate2x blend — dst * 2 * src, for lighting overlays - #81
Conversation
… overlays A material that must both darken and brighten what is under it (baked room lighting drawn as one overlay quad over batched sprites) cannot do it with alpha or additive blending. modulate2x multiplies each RGB channel by 2*src (0.5 = unchanged) and keeps the destination alpha. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. 📝 WalkthroughWalkthroughThe ChangesBlend option
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This change adds the documented blend option, and the reviewed repository shows no actionable build or rendering issue. Mergeability risk is minimal. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Adds
Blend.modulate2xto game-owned shader materials: each RGB channel of what is already drawn is multiplied by2 * src, and the destination alpha is kept. A source of 0.5 leaves the pixel unchanged, 0 blacks it out, 1 doubles it.Why: Flying Platform is moving its night lighting from a shader on every lit sprite to one baked light overlay per room (one quad drawn over the room's contents). An overlay has to both darken (the 60% ambient) and brighten (lamp beams, up to ~1.5x) whatever is under it. Alpha and additive blending can't do that; a 2x multiply can. On an SM-T505 this takes a 17-room night scene from 31.6 ms to 16.7 ms a frame, and a 1000-citizen colony from a frozen ~400 ms to normal frame times.
Compatibility: additive enum value; the default stays
.alpha. Backends that switch exhaustively onBlendneed the new case: labelle-bgfx gets it in a companion PR (the(DstColor, SrcColor)/(Zero, One)blend state). The assembler'smaterial.jsonschema gets"blend": "modulate2x"in its own PR.Tests:
zig build test230/230. The bgfx companion builds and passes 253/253 against this branch (-Dcore-source).Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.