Hi there,
I would like to implement projective texture mapping for projectors with lens shift.
In other words, I want to implement the projector with off-axis custom frustum to map texture on other objects. Currently I’ve successfully implemented it without lens shift using the shader at GLSL Programming/Unity/Projectors - Wikibooks, open books for an open world
How can I achieve this? Any help is appreciated.
Thanks!
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
Projector-Camera Calibration / 3D Scanning Software (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 : Dissecting the Camera Matrix, Part 3: The Intrinsic Matrix ←
It can look discouraging but those kind of experiences worth the challenge
Cheerz!
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: Cg Programming/Unity/Projection for Virtual Reality - Wikibooks, open books for an open world . 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.