Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by dfass · Jan 30, 2015 at 04:49 PM · spritebugpixel artlinessprite sheets

Lines appear between sprites from sprite sheets

I'm having this strange bug where lines appear between sprites from a sprite sheet:

alt text

bug.png (6.8 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bonfire-Boy · Sep 23, 2015 at 11:28 AM 0
Share

This can happen when the import settings for the sprites are set to Repeat rather than Clamp.

avatar image TruffelsAndOranges Bonfire-Boy · Sep 23, 2015 at 02:09 PM 0
Share

It can also happen if you're using bilinear filtering in combination with a sprite sheet. The shader will actually sample from adjacent pixels in the sprite sheet when doing the filtering.

7 Replies

· Add your reply
  • Sort: 
avatar image
12

Answer by NiceNinja · Jan 12, 2017 at 08:46 AM

I encountered a similar issue and found that the cause was the "Anti Aliasing" setting on the Quality Settings for the project. The default for my project was "2x Multi Sampling" for the "Beautiful" and "Fantastic" build settings. Setting this to "Disabled" removed the lines.

Before alt text

After alt text


bad-line-crop.png (28.1 kB)
bad-line-gone-crop.png (25.7 kB)
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Alsstar · Dec 18, 2017 at 09:35 AM 0
Share

Thank you so much, this solution helped me with all my frustration, i thought the line is showing because i imported the sprite in a wrong way, all import setting have been set to my need but i dont know that the quality setting also affect the sprite image in Unity

avatar image Stitchey_ · Jan 19, 2018 at 07:00 PM 0
Share

Cheers! This fixed it.alt text

2a6e090bd5cdcb30584804545dc580a7.png (28.2 kB)
avatar image
4

Answer by CodeAndWeb · Sep 24, 2015 at 02:20 AM

Do you create the sprite sheet inside unity? Or do you import a sprite sheet from outside?

The reason for this OpenGL. There are a bunch of ways to fix the issues - one or more of them should fix your problem:

1) If you build the tile atlas yourself make sure to surround each tile with a 1 pixel border that repeats the tiles outer pixels. Pixels from neighbor tiles might be dragged in otherwise. This is what I would expect is your main issue here. I guess under the tile with the green line is a grass tile inside your atlas.

2) Texture's "Filter Mode": Set it to "Point" - linear or bilinear might drag in pixels from neighbor tiles.

3) Make sure your coordinates and sizes are all full pixels. Don't try to draw a tilemap at a pixel position 0.5 - this will create artifacts at the sprite borders - you'll see the background flashing through. But this is not the case here - the line would be gray not green.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by TruffelsAndOranges · Sep 23, 2015 at 07:40 AM

This is a problem in Unity. I also have this behaviour.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dave-Carlile · Sep 23, 2015 at 02:15 PM 1
Share

This is a problem in any system that uses sprite sheets with mip maps and/or anything but point sampling. A general solution is to duplicate the sprite edges so when the bilinear sampling goes over the edge it will get the same color. I was thinking Unity's sprite packer has the ability to do this but I don't have Unity in front of me to find it.

avatar image TruffelsAndOranges Dave-Carlile · Sep 23, 2015 at 02:21 PM 0
Share

Exactly. And that's the problem. There should be an in-built solution to prevent these things, but I don't think there is. Haven't found it atleast.

avatar image Dave-Carlile TruffelsAndOranges · Sep 23, 2015 at 02:58 PM 0
Share

It would be nice if there were something built in, yes. But this may be something that's difficult to generalize. Do a search for "color dilation" for some solutions you can apply to your sprites beforehand. Unity has Photoshop actions to help as well (although I never had much luck using them).

Show more comments
avatar image
0

Answer by Alex_May · Sep 23, 2015 at 05:47 PM

This is floating point precision, it is not Unity-specific, and the solution is usually to add a bleed pixel around the edge of each tile. It isn't something Unity can itself fix as various filtering rules will blend those pixels anyway, so fixing it for nearest neighbour point sampling won't have an effect on, say, bilinear filtering.

Add a bleed pixel and offset your tile positions to account for it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by cjonasw · Jun 29, 2018 at 11:59 AM

Hopefully this helps speed up this tedious process:

https://charliejwalter.net/spritesheet-bleed/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to create animated "sprites" in a 3D environment 1 Answer

Does unity have a limit of build size ? 1 Answer

Sprite Profile BUG? 0 Answers

What is the most Unity-compatible way to import sprite animations? 1 Answer

Problem with Sprites in Android. Maybe a bug? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges