Search Unity

Altering the main camera frustum to match a live camera image

Discussion in 'Getting Started' started by Whitt1985, Sep 7, 2015.

  1. Whitt1985

    Whitt1985

    Joined:
    Aug 2, 2015
    Posts:
    10
    Hi all,

    I have been tinkering with AR and Unity. I have a feed from my webcam behind a model of the test room which have been mapped 1:1 in scale into the model space in Unity. The challenge I have now is to match the live camera feed image to the image from the main camera of the model space.

    Obviously I can alter the fov, and after setting this at a value I was happy with, the back wall of the rooms now align nicely. However the problem I have now is that the model is not wide enough to match the camera feed. I could of course alter the scale of the objects in the scene but I want to keep a 1:1 match for positioning reasons.

    I read the unity documentation regarding altering the frustum by the projection matrix, unfortunately I don't understand how to use this to solve my problems. I'm looking at simply shrinking the frustum view horizontally (by a 1/2 prob) but maintaining the vertically that I have chosen from the fov.

    I hope that makes sense, any thoughts would be most welcome.

    James