Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Solves #700 #725

Merged
merged 1 commit into from Mar 16, 2016
Merged

Solves #700 #725

merged 1 commit into from Mar 16, 2016

Conversation

hozuki
Copy link
Contributor

@hozuki hozuki commented Mar 14, 2016

Replaced perspective view matrix calculation when given FOV and aspect
ratio. The new implementation does not calculate the view rectangle, so
the result matrix is still valid when znear = 0.

Replaced perspective view matrix calculation when given FOV and aspect
ratio. The new implementation does not calculate the view rectangle, so
the result matrix is still valid when znear = 0.
@xoofx xoofx merged commit 707244f into sharpdx:master Mar 16, 2016
@xoofx
Copy link
Member

xoofx commented Mar 16, 2016

Thanks, it is merged.

@hozuki
Copy link
Contributor Author

hozuki commented Mar 24, 2016

Although this commit ensures that the result matrix is made up of "ordinary" floating point numbers, the matrix itself is still invalid to be a projection matrix. Setting znear to 0 makes all elements in the 4th row become 0, and the projection transform will fail, resulting in unexpected Z orders if you make multiple draw calls.

@hozuki hozuki deleted the solves-iss700 branch March 24, 2016 10:35
@xoofx
Copy link
Member

xoofx commented Mar 25, 2016

I'm not sure what do you expect from using a znear 0, as the result projection matrix column ending with zeros is perfectly normal and valid, that's the formula. It is a degenerated case, but nobody expect to set znear = 0, so it doesn't make sense at all. Not sure why you seem to be so annoyed by this. It is like complaining that dividing a number by 0 is not valid.

If you want to use infinite projection matrix, you can use a different formula as described in Tightening the Precision of Perspective Rendering, and as you can note, that's only the far plane that is discarded, not the near plane that need to be here in order to perform proper "clipping/clamping" of the zvalue when z approach the near plane.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants