how can i reproduce the 'Unity_Matrix_VP' value?
I wan't to calculate the Unity_Matrix_VP in C# code.
But, always I got the incorrect result. My code as follow:
             Matrix4x4 V = camera1.worldToCameraMatrix;
         Matrix4x4 P = camera1.projectionMatrix;
         var N = new Matrix4x4();
         N.SetRow(0, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
         N.SetRow(1, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
         N.SetRow(2, new Vector4(0.0f, 0.0f, -1.0f, 0.0f));
         N.SetRow(3, new Vector4(0f, 0f, 0f, 0f));
         Debug.Log("testCamera");
         Debug.Log(N);
         Debug.Log(P * N * V);
 
 
               My Code result is:
 0.97384    -0.02902    0.00304    3.04939
 0.05073    1.72168    0.18231    179.67620
 0.00624    0.10518    -0.99504    -990.16710
 0.00623    0.10512    -0.99444    -989.57320
 
               But, the value of Unity_Matrix_VP from FrameDebugger is another value:

It amazing me. So Unity calculate it's unity_Matrix_VP value via another method?
 
                 
                xxx.png 
                (4.6 kB) 
               
 
              
               Comment
              
 
               
              I would have just log V * P no ? I don't understand why you introduce the matrix N
I try 'Debug.Log(P V);' and 'Debug.Log(V P);' But it's incorrect too.
Your answer
 
             Follow this Question
Related Questions
Shader MVP matrices: what does vertex position mean at each step? 2 Answers
FPS shader fixing 1 Answer
how to get spot-/point-/..lights working with vertex displacement shader? 0 Answers
Need help with custom shader 0 Answers
How to darken the camera feed from ARkit without darkening the AR objects 0 Answers