perf(runner): pre-light water textures to drop the per-pixel colormap - #22
Merged
Conversation
Water/lava/slime ('*') surfaces render at a fixed light level (0) with only a
UV warp -- the texture itself never changes. So pre-light each source texture
once through the colormap (cm.LightIndex(0, texel)), cache it by source Pic,
and draw the turbulent fill with cm=nil, which skips the per-pixel colormap
lookup. The baked image is bit-identical (same cm[0][texel]); verified
in-browser (lq_e0m1), the water renders unchanged.
Adds a turbulent-fill benchmark showing the pre-lit path is ~7% faster on a
~250k-px water quad (519us vs 557us). It is a modest win -- the colormap is
one of ~10 per-pixel ops; the dominant cost is the intrinsic sin-LUT warp --
but it is free and zero-risk (no render-package change, no visual change).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Water/lava/slime (
*) surfaces render at a fixed light level (0) with only a UV warp — the texture itself never changes. So pre-light each source texture once through the colormap (cm.LightIndex(0, texel)), cache it by sourcePic, and draw the turbulent fill withcm=nil, skipping the per-pixel colormap lookup.cm[0][texel]); verified in-browser (lq_e0m1) — water renders unchanged.A modest win — the colormap is one of ~10 per-pixel ops; the dominant turbulent cost is the intrinsic sin-LUT warp — but it's free and zero-risk (no render-package change, no visual change). Confirms per-pixel water is near-exhausted like the lightmapped fill; the remaining big lever is overdraw reduction.
🤖 Generated with Claude Code