This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote


I am completely new to shader and shading language.
Searching the net I found , a GLSL gallery and realtime emulation tool.
I am trying to implement some of those effects in Godon but what I get is not exactly what I see in GLSL Sandbox.

ie: see this

I translated into this:
enter image description here

As you can see the rotating figure center is at the (0,0) origin instead being centered to the screen. Do I make something wrong?

Please, help.

in Engine by (78 points)
edited by

1 Answer

+1 vote
Best answer

surfacePosition in the original shader has the origin at the middle of the screen with positive y-axis up. UV coordinates have it at the top left corner, positive y down. To center the effect change the second line to:

vec2 surfacePosition = vec2(UV.x - 0.5, 0.5 - UV.y);
by (1,564 points)
selected by

Now it works.
Thank you!

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.