•      Sign In
• Create Account

### #ActualBelos

Posted 20 June 2012 - 11:17 AM

I have quite the trouble with the world, view, and projection matrices. I understand how the world matrix works, but I don't know how to implement it can you give an example? also for the perspective projection I use the following method:
[source lang="csharp"] public static Matrix3D ProjectionMatrix(double angle, double aspect, double near, double far) { double size = near * Math.Tan(MathUtils.DegreeToRadian(angle) / 2.0); double left = -size, right = size, bottom = -size / aspect, top = size / aspect; Matrix3D m = new Matrix3D(new double[,] { {2*near/(right-left),0,(right + left)/(right - left),0}, {0,2*near/(top-bottom),(top+bottom)/(top-bottom),0}, {0,0,-(far+near)/(far-near),-(2 * far * near) / (far - near)}, {0,0,-1,0} }); return m; }[/source]is there anything wrong here?
and the last question how do I use the camera matrix?

### #1Belos

Posted 20 June 2012 - 11:13 AM

I have quite the trouble with the world, view, and projection matrices. I understand how the world matrix works, but I don't know how to implement it can you give an example? also for the perspective projection I use the following method:
[source lang="csharp"] public static Point ProjectionMatrix(double angle, double aspect, double near, double far) { double size = near * Math.Tan(MathUtils.DegreeToRadian(angle) / 2.0); double left = -size, right = size, bottom = -size / aspect, top = size / aspect; Matrix3D m = new Matrix3D(new double[,] { {2*near/(right-left),0,(right + left)/(right - left),0}, {0,2*near/(top-bottom),(top+bottom)/(top-bottom),0}, {0,0,-(far+near)/(far-near),-(2 * far * near) / (far - near)}, {0,0,-1,0} }); return m; }[/source]is there anything wrong here?
and the last question how do I use the camera matrix?

PARTNERS