Godot Version
Godot 4.3
Question
Hi!
I was working on a shader affecting the entire player (my players are made of multiple individual nodes) and to make things simpler, I decided to move the player to it’s own viewport and to then code the shader to affect that viewport as a texture. However, when I put the player into a viewport, they have this weird black outline. I think this might be caused by the fact that my sprites have blurry outlines. Is there anything I can do about this?
This is how the player looks normally:
This is how the player looks in a viewport texture:
Maybe the png has pre-multiplied alpha, try changing the import setting for the image
Ah this won’t be an option for viewport textures sorry. What workflow does the viewport texture help with? Couldn’t you create this merged player as a scene and instantiate that? Or a CanvasGroup? It seems like viewport textures would be a very bad use here, what problem in your eyes does it solve?
1 Like
I’m not all that great at writing shaders, and I already have a shader i found online that adds an outline to a single texture. I thought I could bypass modifying the shader by just putting it all in one viewport.
However if adding a viewport is too much trouble, I can always remove it and attempt to rewrite the script.
Though, even if I do that, I am curious if I can fix this issue because it may affect me in the future.
What is the background color of the viewport you are capturing?
You might be seeing the background of the viewport being rendered to the RGB channels of the viewport texture, and the pixel filtering is just different enough in the A channel that that background color is bleeding in.