ProjectedTexture --- Several ViewProjection-Matrices possible?

Hello vvvvorum!

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!!!
Cheers Gerrit

ProjectedTextureQuestion (15.7 kB)

hi, yea sure thing you can do whatever
there is concepts i don’t really got

I’d like to spread a mesh into several „Instances“ in 3D Space.

i’m not sure what you mean here since projective texture is’s an operation on texcoords, and it’s has nothing to do with “spread a mesh”. It’s more a texture technique.

normally it looks:
tex0 use original texcoords
tex1 use projected texcoords
tex2 use projected texcoords bla-bla

then you blend them on pixelshader

basically you have this world (witch is transform pin) view and projection (witch comes from render), so you have this line mul(PosO,tWVP)
witch says multiply this vertex position by world, view, projection
then you project texture cords (since every vertex can have quite few properties (normals, color, id, whatever)).
on pixel shader you sample texture “by this projected cords”
so it’s technically means you can operate this stuff inside shader pretty easy.

anyways quite get what you want will see if i can do it quick

hope you can rename stuff yourself inside

ProjectedTextureQuestion_1.rar (8.2 kB)

Hi Antokhio!
Wow thanks, that was quick!
As far as I can see it seems to work. I will check it later with the projector.
Thanks a lot!

Tested it with the Projector. Everything works fine, thanks again!!!