Repository navigation
feat: rain in and out of focus - #10
Merged
Merged
Conversation
Every drop was drawn equally sharp at whatever depth it fell, so the drops nearest the eye - the biggest and fastest on the screen - were the most prominent, though they pass in front of whatever a game is about. Rain.focusDepth and Rain.aperture make the eye a lens. A drop is blurred by aperture times the difference between its perspective and the focused depth's (a thin lens blurs as |1/z - 1/z_focus|, and the perspective is 1/z), its streak widened by that much and faded by as much as it widened, so its light stays the same; its ends fade out over the blur too. Splashes follow the same rule. Aperture 0, the default, draws every drop sharp, as before.
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.
Rain in and out of focus: a game can keep sharp the rain that matters and soften the rest.
Before this, every drop was drawn equally sharp at whatever depth it fell. Perspective makes the drops nearest the eye the biggest and fastest on the screen, so they were the most prominent. Yet they pass in front of whatever the game is about.
Rain
focusDepthis the depth the eye is focused at. It defaults to 0, the street line.aperturesets how strongly the rest of the rain is out of focus:aperture × |perspective − perspective at the focused depth|. A thin lens blurs as|1/z − 1/z_focus|, and the perspective is1/z.0, the default, draws every drop sharp, as before.Checks
flame_waterhas 38 tests,flame_lighting17; all pass. A new test compares one seed with and without aperture:Merged by rebase into
serdun; then a row in #9 and a new tag.