0 votes

Here's my shader code, I would like to flip the image horizontally, I managed to do it with texture(1.0 - UV.x, UV.y) but I need to use the screen'UVs.
The 'text' uniform comes from a Viewport texture.
I tried doing :
var image = viewport.gettexture().getdata()
var texture = ImageTexture.new()
and then feed this texture to the shader but I get a black screen, so I have to flip it inside the shader.
Thanks !

shadertype spatial;
mode unshaded;
uniform sampler2D text: hint_albedo;

void fragment() {
ALBEDO = texture(text,vec2(1.0 - SCREENUV.x, SCREENUV.y)).rgb;

Godot version 3.2.2
in Engine by (12 points)

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.