Skip to content

feat: one depth projection for the street - #3

Merged
SERDUN merged 2 commits into
feat/wet-worldfrom
feat/street-depth
Oct 1, 2026
Merged

SERDUN merged 2 commits into
feat/wet-worldfrom
feat/street-depth

Conversation

@SERDUN

@SERDUN SERDUN commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Stacked on #1 (feat/wet-world).

First step of one depth model for side-view scenes. Things in the scene used to work out where they stand, how big they are and how fast they move each in their own way. Now they all take this from one projection on the Ground.

Ground projection

Everything stands at a depth. The scale runs from below 0 (behind the street line), through 0 (on the line), to 0..1 (on the ground towards the eye). From the depth:

  • distanceAt: rows are equal steps of 1/distance, as in perspective, so they crowd towards the street line.
  • yAt / depthAt: where the thing meets the ground on screen.
  • scaleAt / projectX: how big it is and how fast it slides by (parallax).
  • sinElevation: the angle the eye looks down. It is now computed from the same distances, so Fresnel follows them too.

Rain and water on it

  • Rain lands a drop at yAt(depth) and moves it at scaleAt(depth).
    • Without a ground, the old perspective stays.
    • The margins past the view are now one metre, not 40 world units, so rain works in metres (Umbrella) as well as in pixels.
  • WaterSurface catches drops where their depth meets the ground.
  • Reflectable.groundDepth: something standing at a depth is mirrored about its spot on the ground.

Tests

  • flame_lighting: 16 tests, including the projection's places, sizes, parallax and crowding.
  • flame_water: 29 tests, including mirroring by depth.
  • The wet world sample renders as before.

Next

  • Rain gets what Umbrella's own rain has: a deflector (the swinging canopy), a wind field, and a cloud it falls from.
  • After that, the game moves onto it.

SERDUN added 2 commits October 1, 2026 12:19
What stood where in a side-view scene was worked out apart in each place:
the rain had its own perspective (1 / (1 - 0.6 depth)) and its own
landing line with pixel insets, the water its own, and a game laying
things out in depth (Umbrella's 2.5D road) a third.

Ground now holds the one projection everything shares. Everything stands
at a depth - below 0 behind the street line, 0 on it, 0..1 on the
ground towards the eye - and from it follow how far it is (distanceAt:
rows are equal steps of 1 / distance, crowding towards the line), where
it meets the ground (yAt, depthAt), how big and how fast it slides by
(scaleAt, projectX) and the angle the eye looks down at it
(sinElevation, now from the same distances).

Tests: the projection's places, sizes, parallax and crowding.
The rain and the water now take the world's projection (Ground) instead
of their own: a drop lands where its depth meets the ground (yAt) and
crosses the view as fast as that depth makes it (scaleAt); water catches
it there. Without a ground the old perspective stays. The rain's
margins past the view are a metre, not 40 world units, so it works in
metres as in pixels.

Reflectable.groundDepth: something standing at a depth is mirrored about
where that depth meets the ground, without working out its base itself.

Tests: a block at a depth is mirrored about its spot on the ground.
@SERDUN
SERDUN merged commit 2db1748 into feat/wet-world Oct 1, 2026
@SERDUN
SERDUN deleted the feat/street-depth branch October 1, 2026 12:34
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.

1 participant