float4x4.PerspectiveOffCenter(): possible logic flaw?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- csharp, unity
- Ambito
- computer-graphics
Direzione di ricerca
Inizia in src/Unity.Mathematics/matrix.cs da PerspectiveOffCenter() e confronta la disposizione della relativa matrice con l’implementazione System.Numerics collegata. Verifica la trasposizione e le convenzioni delle coordinate descritte nell’issue, quindi conferma se i valori diversi M33/M34 o M43 costituiscono un errore logico; il lavoro è completato quando il comportamento è risolto e l’implementazione o la spiegazione corrisponde alla convenzione prevista.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The Unity.Mathematics implementation of PerspectiveOffCenter() Link
public static float4x4 PerspectiveOffCenter(float left, float right, float bottom, float top, float near, float far)
{
float rcpdz = 1.0f / (near - far);
float rcpWidth = 1.0f / (right - left);
float rcpHeight = 1.0f / (top - bottom);
return float4x4(
2.0f * near * rcpWidth, 0.0f, (left + right) * rcpWidth, 0.0f,
0.0f, 2.0f * near * rcpHeight, (bottom + top) * rcpHeight, 0.0f,
0.0f, 0.0f, **(far + near) * rcpdz**, **2.0f * near * far * rcpdz**,
0.0f, 0.0f, -1.0f, 0.0f
);
}
differs from the .NET System.Numerics.Matrix4x4 implementation:
public static Matrix4x4 CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance)
{
if (nearPlaneDistance <= 0.0f)
throw new ArgumentOutOfRangeException("nearPlaneDistance");
if (farPlaneDistance <= 0.0f)
throw new ArgumentOutOfRangeException("farPlaneDistance");
if (nearPlaneDistance >= farPlaneDistance)
throw new ArgumentOutOfRangeException("nearPlaneDistance");
Matrix4x4 result;
result.M11 = 2.0f * nearPlaneDistance / (right - left);
result.M12 = result.M13 = result.M14 = 0.0f;
result.M22 = 2.0f * nearPlaneDistance / (top - bottom);
result.M21 = result.M23 = result.M24 = 0.0f;
result.M31 = (left + right) / (right - left);
result.M32 = (top + bottom) / (top - bottom);
// below is different
**result.M33 = farPlaneDistance / (nearPlaneDistance - farPlaneDistance);**
result.M34 = -1.0f;
// below is different
**result.M43 = nearPlaneDistance * farPlaneDistance / (nearPlaneDistance - farPlaneDistance);**
result.M41 = result.M42 = result.M44 = 0.0f;
return result;
}
In Unity M33 is:
(far + near) * rcpdz
while System M33 is:
result.M33 = farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
In Unity M34 is:
2.0f * near * far * rcpdz
while System M43 is:
result.M43 = nearPlaneDistance * farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
Note that both matrices are transposed to each other; System Matrix can be thought of as rotating the coordinate system itself while Unity Matrix rotates the given vector.
- Lingua principale
- C#
- Stelle
- 1.4k
- Fork
- 159
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Unity-Technologies/Unity.Mathematics
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
-
64 Bit Quaternion Request Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Unity-Technologies/Unity.Mathematics#245 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
Unity-Technologies/Unity.Mathematics#243 · 6 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Unity-Technologies/Unity.Mathematics#240 · 1 reazione ·
Tutte le issue di Unity-Technologies/Unity.Mathematics
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
azurenoops/spin_agent#975 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SubtitleEdit/subtitleedit#15108 · 1 commento ·