Skip to content

Let the fog of war tiles overlap into one blanket - #41

Open
Upabjojr wants to merge 2 commits into
tomluchowski:shaders-improvementfrom
Upabjojr:split/fog-of-war-overlap
Open

Let the fog of war tiles overlap into one blanket#41
Upabjojr wants to merge 2 commits into
tomluchowski:shaders-improvementfrom
Upabjojr:split/fog-of-war-overlap

Conversation

@Upabjojr

Copy link
Copy Markdown

Implements Poikilos's recipe from issue #13: each unexplored tile's fog was scaled exactly to the tile, so the fog of war read as a grid of separate lumps. Every fog instance (the opaque dirt dome and the cloud quad) is now drawn 1.5× the tile size, so neighbours overlap by half a tile: the domes interlock into one rolling mass, and the cloud quads fade out over their outer third so overlapping fades blend instead of stacking a hard edge — his "square symmetrical gradient" idea, done in the cloud shader rather than a texture since the cloud is procedural.

Along the way this fixes a latent bug in Cloud.frag: it read its texture coordinates from a TexCoords input that nothing writes (the vertex shader emits out_UV0), leaving the noise anchor undefined — and the edge fade needs real coordinates to know where the quad's borders are.

Before/after of the same unexplored region, brightened for visibility — the per-tile spike grid is gone on the right:

ab

The fog also creeps ~a quarter tile over the frontier tiles now, which reads as natural fog behaviour rather than a defect, and is inherent to the overlap approach (Poikilos's proposal explicitly extends past the block edge). If the effect should be stronger or subtler, the scale factor and the fade width are the two knobs.

🤖 Generated with Claude Code

https://claude.ai/code/session_014hrk8PiEUMgjYJnTxLF2PU

Unexplored tiles each carried their own fog dome and cloud, scaled
exactly to the tile, so the fog of war read as a grid of separate
lumps with visible seams (issue tomluchowski#13). Following the recipe proposed
there, every fog instance is now drawn half a tile wider than its
tile: the opaque dirt domes interlock into one rolling mass, and the
cloud quads fade out over their outer third so neighbouring fades
blend into each other instead of stacking a hard edge.

The cloud fragment shader also read its texture coordinates from a
"TexCoords" input that nothing wrote - the vertex shader emits
out_UV0 - leaving the noise pattern's anchor undefined. It now reads
the coordinates the vertex shader actually provides, which the edge
fade needs to know where the quad's borders are.

Verified in a running game: the per-tile spike grid in unexplored
areas is gone and the fog reads as one connected blanket, with the
usual soft creep over the frontier tiles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014hrk8PiEUMgjYJnTxLF2PU
@tomluchowski

Copy link
Copy Markdown
Owner
Screenshot_2026-08-23_11-50-41 Problem is the tiles player wants to mark for digging looks jagged now..... Here's example of one tile width tunel marking.

@tomluchowski

Copy link
Copy Markdown
Owner

Besides that the fog/ clouds look now much better ! I would merge in this PR, if not the drawback mentioned above.

Widening every fog dome half a tile in all directions made the domes
spill onto neighbouring tiles marked for digging, chewing the yellow
marking's edges into jagged teeth (review on PR tomluchowski#41, worst on a one
tile wide tunnel, overlapped from both sides).

Each dome is now widened per side, only towards a neighbour that is
also under fog and not marked for digging, and a marked tile's own
dome stays at its exact tile size. Untouched fog still interlocks
into one mass, while markings keep the clean tile-aligned edges they
had before the widening. Whenever a tile's fog or marking state
changes, the widening of its dome and of its neighbours' domes is
recomputed.

Verified in a running game with a one tile wide marked tunnel through
fog: the jagged teeth are gone and the marking reads as one solid
band again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014hrk8PiEUMgjYJnTxLF2PU
@Upabjojr

Copy link
Copy Markdown
Author

Good catch — reproduced it exactly (one-tile-wide marked tunnel through fog): the flat 1.5x widening made every fog dome spill a quarter tile onto its neighbours, and where an unmarked dome overlapped a marked tile (and vice versa) the domes' silhouettes interleaved into those jagged yellow/dark teeth.

Fixed in 7f40835: the widening is now decided per side, and a dome only extends towards a neighbour that is also under fog and not marked for digging; a marked tile's own dome stays at its exact tile size. So markings keep the clean tile-aligned edges they had before this PR, while untouched fog still interlocks into one blanket. The widening is recomputed for a tile and its neighbours whenever its fog or marking state changes, so marking/unmarking and revealing tiles keep the edges correct.

Before (your case reproduced) / after, brightened crops of the same one-tile tunnel:

before/after

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.

2 participants