Matching ProjectorLight with Perspective OffCenter

Hello lovvvvely people!

I come asking for help.

I am attempting to create some debug tools to make things easier going forward and part of that lead me to emulate my projector.

I have already created a helper for the projector itself, and the frustum it creates based on its off-center lens as you can see here:

I managed this using a Perspective(OffCenter Distance RightHanded) which brings us to my first question:

  1. What does the Relative Distance input pin in Perspective(OffCenter Distance RightHanded) do, and how do I calculate this value based on my projector’s characteristics?

Now I want to actually project some texture using ProjectorLight to match my projector’s frustum. This will enable me to test stuff virtually, including object and spectator shadows, etc.). However, when I try to use ProjectorLight with the same transformation matrix I have for my projector’s frustum, it’s “direction” is inverted, as you can see here (helper in light blue, pointing at the projector):

And it does not project properly.

I can make ProjectorLight fill up my frustum’s intersection with the wall manually using a LookAt (RightHanded) but then the occlusions/shadows etc would not match (ProjectorLight helper in light blue, pointing at screen/wall):

Which brings up my following two questions:

  1. In ProjectorLight, what does the Angle input pin actually do and how do I calculate this value based on my projector’s characteristics?
  2. How can I transform ProjectorLight in order to make it match my projector’s frustum?

Thank you very much in advance for your attention and any light you might be able to shed on this.

Cheers!

Might not be exactly what you are looking for, but I tried similar stuff earlier. Maybe there is something in it you find helpful…

2 Likes

Hi @motzi !

Thanks for your reply!

I see you already did all of the heavy lifting, amazing! I will move on to the discussion you shared to see what the current status is on actually giving the spotlight the appropriate off-center parameters.

Cheers!

not exactly what you asked for, but latest 5.3 previews now include a ProjectedTexture shader that take a perspective matrix in.

1 Like

Thanks!

It works like a charm if you don’t need light behaviour (projects onto any surface and applies shadows).

I would still love to get my hands on those features though :)

Cheers!