2
\$\begingroup\$

In Godot 3.1.2 using OpenGL ES2, black borders/ lines seem to form around some sprites I have imported. Usually they appear on top of the sprite but can also "border" around it.

Being new to Godot development but coming from Unity I expect I did something wrong in the import or that the texture settings aren't set correctly. But so far I haven't been able to find any setting that resolves this issue.

So my question is: where can I find texture/image settings that can resolve this issue? Or if the issue stems from another source, how can I make sure that the images are being displayed without the black lines? (Bonus question: Is there also a way/ setting to display tiles in the Y-Axis non-blurry?)

(I'm pretty new to Stack Exchange/ GameDev so if my question is missing some details please let me know :) )

Lines appearing over the sprites

\$\endgroup\$
  • \$\begingroup\$ Could you include an example image that reproes this, your import settings, and how you're drawing the images? \$\endgroup\$ – rcorre Jan 15 at 11:46
3
\$\begingroup\$

Edit: To remove the border around the sprite turns out there is an option in the Import Menu for the asset. In this menu change the Repeat Flag Setting to Disabled. Make sure to Reimport the asset after setting this the lines are no longer displayed around the image.

(Import menu Viewable by selecting the image file and then checking the import tab, located at the left dock next to the scene tab)

Original: Turns out you need to put some empty (transparent) space around your assets, to make sure no lines appear. Putting around 10 pixels of empty space around every side of the image will do the trick.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ You don't need the padding for this purpose if you turn off wrapping/repeating using eg. the texture flags described here. That will ensure texture samples just past the edge of the texture clamp to the nearest edge instead of wrapping around to sample from the opposite side, and also keep the opposite-edge content from bleeding into the mipmap chain. But a bit of padding can help edges close to the border of the texture look nicer in smaller mips, instead of getting a hard cut-off. \$\endgroup\$ – DMGregory Jan 15 at 14:18
  • \$\begingroup\$ Thanks, this works as well and is a generally better approach. Thanks for the detailed explanation. Would you mind turning this comment into an answer so I can accept it? :) \$\endgroup\$ – DominoDev Jan 15 at 17:50
  • 1
    \$\begingroup\$ If it helped you, you're welcome to edit it into your own answer or post a second with the information. I've never used Godot myself, so I don't have the hands-on details or tested code examples / screenshots to make a high-quality answer of my own. \$\endgroup\$ – DMGregory Jan 15 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.