<div dir="ltr">Hello,<div><br></div><div><br></div><div>I am trying to set my view and projection camera matrix. I do this inside a custom camera manipulator code I am building.</div><div><br></div><div>I set the camera view matrix as </div><div><br></div><div><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">camera-></span><span style="color:rgb(215,215,135);font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures">setViewMatrix</span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">(</span><span style="color:rgb(215,215,135);font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures">getInverseMatrix</span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">());</span><br></div><div><br></div><div>After this, since I am using a perspective projection matrix, I know I need to update my projection matrix. I try to do this with</div><div><br></div><div><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">camera-></span><span style="color:rgb(215,215,135);font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures">setProjectionMatrixAsPerspective</span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">(</span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(135,215,135)">30.f</span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">, aspectRatio, </span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(135,215,135)">0.5f</span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">, </span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(135,215,135)">500.f</span><span style="font-family:monaco;font-size:10px;background-color:rgb(27,27,27);font-variant-ligatures:no-common-ligatures;color:rgb(255,255,255)">); </span> </div><div><br></div><div>This results in the following projection matrix,</div><div><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 2.69691 0 0 0 </span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 0 3.73205 0 0 </span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 0 0 -1.002 -1 </span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 0 0 -1.001 0 </span></p></div><div><br></div><div>However this is wrong, my matrix should be something similar to<br></div><div><br></div><div><p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 2.69691 0 0 0 </span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 0 3.73205 0 0 </span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 0 0 -50 -1 </span></p>
<p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"> 0 0 -1.01309e+06 0 </span></p><p style="margin:0px;font-size:10px;line-height:normal;font-family:monaco;color:rgb(245,245,245);background-color:rgb(4,20,29)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p>What am I doing wrong? What else do I need to correctly compute the projection matrix?</div></div>