Repository navigation
Ortho tint: alpha-masked silhouette rendering with batching - #86248
Merged
GuardianDll merged 1 commit intoApr 5, 2026
Merged
Conversation
dobbry-vechur
force-pushed
the
fix/tint-overlay-ortho
branch
2 times, most recently
from
April 5, 2026 00:22
7c66c3b to
dd65493
Compare
dobbry-vechur
force-pushed
the
fix/tint-overlay-ortho
branch
from
April 5, 2026 00:26
dd65493 to
1ae2b78
Compare
dobbry-vechur
force-pushed
the
fix/tint-overlay-ortho
branch
from
April 5, 2026 00:52
1ae2b78 to
4808c1b
Compare
The colored light tint overlay used a fixed tile_width x tile_height rect for all tiles. In ortho mode, tall sprites (32x64 characters with gear) showed a color seam at the tile boundary, and transparent sprite padding got tinted as a rectangular halo. Replace the ortho rect tint with a hybrid path: - Simple tiles (sprites fit inside tile footprint) keep the cheap rect. - Complex tiles (oversized sprites) use per-pixel silhouette masking: record sprites during the layer loop, replay them as white silhouettes into a scratch render target, composite back with the tint color. Infrastructure: - Silhouette texture variant (6th color filter, RGB=255 + original alpha) computed once at tileset load alongside existing five filters. - Per-sprite opaque_rect (tightest non-transparent bounding box) computed at load for accurate bounds tracking, excluding transparent padding. - Precomputed tint eligibility and color in a per-tile prepass so the overlay pass skips re-scanning. - Contiguous same-color complex tiles batched into a single mask/composite operation with a union area growth cap (2x) to limit waste. - small_literal_vector<4> for tint_sprites avoids heap allocation. - shared_ptr<SDL_Texture> overloads in sdl_wrappers for silhouette atlas. Iso mode keeps the existing flat rect tint unchanged.
dobbry-vechur
force-pushed
the
fix/tint-overlay-ortho
branch
from
April 5, 2026 01:18
4808c1b to
88335cb
Compare
Contributor
Author
|
/retry |
Contributor
|
Retried failed jobs: |
Contributor
Author
|
/retry |
Contributor
|
Retried failed jobs: |
Member
|
to my knowledge, moving to sld3 is quite desired |
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
Interface "Pixel-accurate colored light tint overlay for ortho mode"
Purpose of change
The colored light tint overlay (beacons, colored fields, dawn/dusk) draws a flat rect over each tinted tile. In ortho mode with tall sprites (32x64 characters, multi-layer gear), this shows color seams at the tile boundary and rectangular halos around transparent padding.
Describe the solution
Hybrid tint path for ortho. Simple tiles whose sprites fit inside the tile footprint still get a cheap colored rect. Complex tiles with oversized sprites use a per-pixel silhouette mask instead: recorded sprites are replayed as white silhouettes (RGB=255, original alpha) into a scratch render target, then composited back with the tint color.
small_literal_vector<4>for per-tile sprite records avoids heap allocation in the common caseIso mode keeps the existing flat rect tint unchanged.
Describe alternatives you've considered
Proper fix would be to move to SDL3 shaders, but that's a larger effort. This works within SDL2's render target API.
Testing
Unit tests for the new data structures. Perf profiled near beacons, no measurable regression.
Before:

After:

Additional context
Only addresses ortho mode. Iso has its own set of issues (diamond footprint mismatch) that need separate treatment.