Godot Version
Godot v4.4.1.stable - Windows 11 (build 26100) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce MX250 (NVIDIA; 32.0.15.7602) - Intel(R) Core™ i7-10510U CPU @ 1.80GHz (8 threads)
Question
Hello there,
I’ve written a script to procedurally generate some 2D plants, drawing them with the Line2D object. I then wanted to apply a vertex shader to the plant as a whole, but I couldn’t work out a way of applying the shader to the objects as a group. So, from what I could tell looking at the docs, the best solution would be to render the Line2Ds to a SubViewport, apply that as a texture to a Sprite, and then apply the shader to that Sprite. This worked, however there is now a dark outline around the edges of the texture. The SubViewport has a transparent background.
Here you can see on the left an image I drew and imported as a png, and on the right is the generated image using Line2Ds on a SubViewport. I’ve tried changing the texture filtering on the sprite holding the texture of the SubViewport, which hasn’t helped. I have anti-aliasing enabled here, but the dark outline appears even without the anti-aliasing. Rendering the Line2Ds normally without a SubViewport does not have this issue either.
Is there a solution to this? Either to somehow get rid of the dark outline, or to avoid using the SubViewport and still get the effect I want of applying a vertex shader to the whole plant at once.
And help would be appreciated, thanks!