The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

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.

https://i.postimg.cc/Y01wrL2S/setup2.png

in Engine by (101 points)
edited by

1 Answer

0 votes

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

by (106 points)

=) 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 ?

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.

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 ?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.