I am not into Shaders but maybe someone can help me:
Is it possible to use more than one View and Projection Matrix in a shader?
I want to use the „Projected Texture" - Node but in a little different way:
I’d like to spread a mesh into several „Instances“ in 3D Space.
But instead of using one Camera (= View+Projection Matrix) for all Instances, connected to the renderer, I want to use indiviual Cameras for each Instance.
With a normal shader like Gouraud this is no problem (by multiplying the vertices not with only one View+Projection connected to the Renderer but with different View+Projections for each Instance).
But with the ProjectedTexture Node this is different:
if multiply transform and viewprojection before connecting to ProjectedTexture I dont get the 3D-Effect because the vertices are already in Screen Space.
Now I had the idea to do this multiplication inside the shader after all the projectedTexture stuff: Instead of using the View and Projection Matrix from the Renderer you take different Matrices for each instance.
Transform0 * View0 * Projection0,
Transform1 * View1 * Projection1,
Transform2 * View2 * Projection2
and so on.
Is that possible? Can anyone give me a hint how to do this? How to start?
The reason why I want to do this:
I am using Elliot Woods’ nice OpenCV CalibrateProjector Contribution to do Projection Mapping. (Calculate a View and Projection Matrix which match the real world projector and the virtual camera) That works very well if 3D-World and real world are identical. If they aren’t 100% identical you have to accept compromises and the mapping isn’t perfect, especially if you are handling several objects spreaded in the room.
One solution for this is to calculate one ViewProjection for every object and multiply the Object-Transform with this ViewProjection-Matrix.
It works very well but it doesn’t work with the ProjectedTexture Node for fancy 3D effects in a changeable spectator position.
See attached patch to understand what i mean.
Thank you for your help!!!
ProjectedTextureQuestion (15.7 kB)