Fix index computation in Gu::HeightField::computeCellCoordinates from PxF32 to PxU32#574
Open
Nodli wants to merge 1 commit intoNVIDIAGameWorks:4.1from
Open
Fix index computation in Gu::HeightField::computeCellCoordinates from PxF32 to PxU32#574Nodli wants to merge 1 commit intoNVIDIAGameWorks:4.1from
Nodli wants to merge 1 commit intoNVIDIAGameWorks:4.1from
Conversation
Author
|
The issue is also present in PhysX version 3.4. |
|
Thanks for reporting this. The fix looks good. Looking into the origins of this bug, it seems it stems from trying to avoid a performance penalty converting floats to ints on Xbox 360. |
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.
The vertex index in Gu::HeightField::computeCellCoordinates is computed in 32-bit floating point and the lack of precision causes indexing errors. Indexing errors of 1 start appearing on GuHeightField with a size between 4000x4000 and 5000x5000.
For example a GuHeighField with 8193 columns can see x = 5720 and z = 7826 which means vertexIndex should be 5720*8193+7826 = 46871786 but the floating point representation only allows 46871784 or 46871788 as values.
Wrong indexing causes issues when trying to compute normals or determine the orientation of the tesselation of a GuHeightField.