Search Unity

Projective texture mapping for projectors with lens shift

Discussion in 'General Graphics' started by thorikawa, May 6, 2016.

  1. thorikawa

    thorikawa

    Joined:
    Dec 3, 2013
    Posts:
    25
  2. raphael-ernaelsten-heaj

    raphael-ernaelsten-heaj

    Joined:
    Mar 9, 2016
    Posts:
    78
    Hi!
    I did this a while ago.

    Unfortunately, you will need more than a shader for this. ;)
    You will actually have to compute the intrinsic matrix from your projector first (the calibration data, which are the focal length, the center offset, the bias, the skewing, etc).
    There are free softwares that compute them for you :
    https://github.com/davidfofi/procamcalib
    http://mesh.brown.edu/calibration/ (I personally used that one, which I found easier and hassle-less)

    Then, using those, you will have to compute a new perspective matrix for your camera that will use those data.
    There is a very good explanation of this here : http://ksimek.github.io/2013/08/13/intrinsic/

    It can look discouraging but those kind of experiences worth the challenge :)

    Cheerz!
     
  3. Martin-Kraus

    Martin-Kraus

    Joined:
    Feb 18, 2011
    Posts:
    617
    Oh, I'm late but maybe I can help someone who has the same question. In computer graphics, the problem is called off-axis projection; see here for how to set up an off-axis camera in Unity: https://en.wikibooks.org/wiki/Cg_Programming/Unity/Projection_for_Virtual_Reality . In many cases that's all you need since you can render to a render texture with an off-axis camera and use the render texture for standard texturing.