Hi,
I want to customize camera's projectionMatrix, but i do not familiar with its operation, i just know the matrix's basic linear operations, but confused about its geometric significance, for example, what's the camera projection matrix' element's meaning, how it will influence the result when changing its elements? Can you give me some materials describing the projectin matrix,or recommend some books?
Here's a script which can stretch the screen. can you explain it for me.
Thanks in advance.
public class StretchScreen : MonoBehaviour
{
public Vector2 offset, stretch=new Vector2(1.13f,1.73f);
//Why stretch initialized with 1.13f,1.73f
public float distortion;//This is for shearing?
private Matrix4x4 projectionMatrix;
// Use this for initialization
void Start () {
projectionMatrix=camera.projectionMatrix;
}
// Update is called once per frame
void Update () {
projectionMatrix[12]=offset.x;//why change element 12
projectionMatrix[13]=offset.y;//why change element 13
projectionMatrix[0]=stretch.x;//why change element 0
projectionMatrix[5]=stretch.y;//why change element 5
projectionMatrix[4]=distortion;//why change element 4, what if other elements?
camera.projectionMatrix=projectionMatrix;
}
}
↧