Repository navigation
feat: one depth projection for the street - #3
Merged
Merged
Conversation
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.
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.
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
Rainlands a drop atyAt(depth)and moves it atscaleAt(depth).WaterSurfacecatches 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.Next
Raingets what Umbrella's own rain has: a deflector (the swinging canopy), a wind field, and a cloud it falls from.