viewport camera offset (3d) ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By siska

I’m using a very simple fragment shader to project an animation of a rotating key (scene 1) into a mirror in my ‘main’ scene (scene 2). All is fine, except that the camera used in the ‘key’ scene requires an offset to center the key in the mirror … Also, the 2 background circles are centered behind the key (just a bit further away from the viewport camera), but they appear off-center in the mirror …

Am I doing something wrong, or is this expected behavior ?

Some info :
My shader receives the viewport texture from the ‘key’ scene and uses that ‘as is’ for the ALBEDO output.
The cameras in both scenes are centered on the mirror and the key respectively.

Edit : I also posted on Redit (small video), but I couldn’t get the image to appear … so, here I am. If I get an answer there, I’ll post it here as well.

:bust_in_silhouette: Reply From: lofi

if i understood correctly, do you want the image appear centered in the mirror?
to me it looks like the h offset on the viewport cam is the problem, it has a value of -1.3… or something; try to put it at 0 and see what happens

=) That’s my point exactly : if I don’t set the offset to -1.3, my image isn’t visible in the mirror. I need to set the camera offsets to center the image.
My question is : why is this necessary ?

siska | 2021-02-18 14:31

are you sure both viewport camera and your key object are aligned? check both values in the x axis translation, if you need to h offset it’s to compensate, so most probably is that they arent aligned, if thats not the case share a comment.

lofi | 2021-02-18 17:35

As far as I can tell : yes, they are aligned. All at (0,0, Z) [different z-values only]

Should both cam’s be at exactly the same location ?

siska | 2021-02-18 18:00