Repository navigation
Conversation
Owner
|
already fixed in PR #81 |
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.
t3d_mat4_perspectivemixes two depth conventions. Result: geometry staysvisible until twice the far plane passed to
t3d_viewport_set_projection.tiny3d/src/t3d/t3dmath.c
Line 153 in 73d822f
Cause
Constant term is written for the -1..1 depth convention, which carries a factor
of two:
Z term is written for the 0..1 convention, which does not:
Clip Z at eye distance
dcomes out as:Clipping tests
z <= w, andwisd. Solving:With the matching term
-(far + near)/(far - near)the same solve givesd <= far.Near plane is unaffected: it solves to
d >= neareither way.Measurement
Four posts on one axis, 10 metres apart, FPS camera walking the line, both
planes printed on screen. Far plane set to 25 metres, geometry disappears at
50.
Screenshots of both builds attached, before and after the fix. Both ROMs are
attached as well.
Fix
Impact
Behaviour change, visible in every existing project. Scenes tuned against the
current behaviour lose whatever sat between the declared plane and its double.
Depth precision improves: that range currently compresses into the tail of the
depth buffer.