0 votes

I got a texture for a sprite and I had like the delete the white from it to make it transparent so it wont overdraw the background

in Engine by (1,196 points)

1 Answer

0 votes
Best answer

Just delete the white pixels and leave it transparent in an image editor?

by (28,733 points)
selected by

is there a way i can do it with shaders?

Do you really need the white part of the image?
Anyways, here is a simple CanvasItemMaterial fragment shader that makes white pixels transparent:

vec4 col = tex(TEXTURE, UV);
if(col.rgb == vec3(1,1,1)) {
    col.a = 0;
}
COLOR = col * SRC_COLOR;

But I still think it would be much simpler if you open the image in Paint.NET / Photoshop / Gimp and make the areas you want transparent.

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.