Repository navigation
keep interpolated positions exact so mob shadows stop flickering - #852
Merged
Merged
Conversation
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.
Type of change
Summary
shadows under moving mobs flickered.
Position::lerpused glam'sa * (1 - s) + b * s, which isn't exact when both ends match: an interpolation step at y = -60 gave -60.00000000000001, the shadow's floor dropped to the cell inside the block below, and the shadow vanished for that frame (about a third of frames while a mob moves on superflat). it now usesa + s * (b - a)likeMth.lerp, which covers interpolation steps and the per-frame render lerp.Reference
Vec3.lerp,Mth.lerp,LinearInterpolationHandler.doInterpolate,EntityRenderer.extractShadowTesting
unit test that a lerp between equal positions stays exact at -60 and -63; this is the reliable guard. new
entities/shadow_interpolationnudges a pig by one wire step (1/4096 of a block) six times and matches ten frames of each interpolation against the still one, allowing 100 pixels for the nudge's edge flips (a lost shadow changes ~3700). whether a frame lands on the bad tick depends on tick timing the harness can't pin, so on master it failed 4 of 6 runs; with the fix it passes every run, and on the vanilla harness. addsmax_differing_pixelstomatch_screenshotsfor that. fulljust ingame-testpasses.other position lerps (first-person camera pivot, particles, the dark-disc eye height) still use the inexact form; none feeds a block floor, so they're left for a separate change.