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
1
Question by MouseCaneta · Dec 18, 2013 at 01:59 AM · texturespritetilelineblack

Black lines between tile sprites

I have a tile engine I've built myself. Every tile on the screen is a game object with a SpriteRenderer. I set these renderers with sprites created using Sprite.Create(Texture2D, Rect, Vector2, float), passing a Sprite with all the map tiles as parameter.

It doesn't matter what I do, I keep getting these weird 1px black lines between rows of tiles every now and then. How do I fix this? What's causing it?

Additional info:

When I set the filter mode to Bilinear or Trilinear I get black lines between every row and column of tiles.

The lines I get with Point filtering keep blinking as I move around the map and only stay fixed when the camera is not moving. The ones I get using Bilinear or Trilinear filtering are static, even when I move around, although their width change a little.

Here is my project running on the web player:

https://dl.dropboxusercontent.com/u/1978232/Bin-Debug.html

Comment
Add comment · Show 11
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 TimBorquez · Dec 18, 2013 at 05:24 PM 0
Share

I don't know much about sprites and I havent messed with the new 2d stuff at all but any time I have issues with edges I set the wrap mode to clamp in the import settings

avatar image MouseCaneta · Dec 18, 2013 at 05:29 PM 0
Share

I can't choose between clamp and repeat when using Sprite mode for textures. But I've tried to use Texture mode ins$$anonymous$$d and I've tried with both Clamp and Repeat to no success. At least, do the lines appear to you in the web player example I posted?

avatar image TimBorquez · Dec 18, 2013 at 06:50 PM 1
Share

yes i see them you aren't crazy haha

avatar image Zakkon · Dec 18, 2013 at 09:12 PM 1
Share

You are copying the texture from a spritesheet, correct? If so, try having one pixel wide spaces between all sprites on the spritesheet image. This fixed it for me when I had this issue.

avatar image thaiscorpion · Dec 19, 2013 at 02:04 AM 0
Share

I'm not sure but the way it changes everytime you move and you can see horizontal and vertical lines depending on you position makes it look like a z-fighting issue. Is it posible that they are overlapping a bit between them?

Show more comments

7 Replies

· Add your reply
  • Sort: 
avatar image
29

Answer by Cleve Blakemore · Mar 19, 2014 at 12:02 PM

You need to create a material, apply one of the default sprite shaders and then click "Snap To Pixel" checkbox. Use this material to render your sprite.

Comment
Add comment · Show 9 · 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 Squabbler · Aug 04, 2014 at 08:04 PM 1
Share

Wow, this literally fixed every issue I had with this problem. Thank you so much!

I've tried so many resolutions, pixel sprite sizes, camera sizes with formula, etc... and this simple material solved every issue for every resolution.

avatar image Silvio_Medeiros · Aug 06, 2014 at 01:57 AM 1
Share

This solution worked perfectly for me. Needs to be easier to find. Took me a while to get to your answer. Thank you!

avatar image neipo · Apr 20, 2015 at 07:15 PM 0
Share

Have been struggling against this for a while. HUGE help! Thank you!

avatar image Undyinglag · Feb 23, 2016 at 10:29 PM 1
Share

this DID work for me, but then some lines reappeared when i added light and shadow effects on the sprite, think theres something else i could to to fix this?

avatar image twoshorts · Apr 26, 2016 at 05:19 AM 1
Share

Logged in just to upvote this. I have been working on this for over 3 hours. Thanks so much!

Show more comments
avatar image
8

Answer by Mijdax · Mar 15, 2016 at 09:09 PM

Turn on Pixel Snap in the Renderer Material of your object and turn of anti aliasing in Edit/Projectsettings/Quality

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 ReleeSquirrel · Dec 28, 2016 at 08:43 PM 0
Share

This one worked for me. I had lines all over the place and adding a pixel snap material fixed most of them, but I still had thin lines on the bottom of an all-alpha sprite. Turning off anti-aliasing fixed it.

avatar image AtheroX · Aug 24, 2017 at 02:06 PM 0
Share

I turn off Pixel snap and anti-aliasing.

avatar image
0

Answer by StillLearnin · Dec 31, 2013 at 05:44 PM

I had this same problem and changed the "Pixels to Units" size to a slightly smaller value, caused the line flickering to disappear.

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 Romano · Feb 14, 2014 at 06:22 AM

This might explain at least some of the lines: http://answers.unity3d.com/questions/10302/messy-alpha-problem-white-around-edges.html

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 nervu0 · Mar 04, 2016 at 08:11 PM

Try marking them as Static so Unity knows that they aren't moving.

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

37 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Sprites and textures appears black on Samsung Galaxy Grand I9082 0 Answers

tiling texture on multiple planes 1 Answer

Tilemap: Resizing Tiles? 1 Answer

Texture UVs Shift with Camera Movement (ortho) 0 Answers

Sprite texture flickering. 2 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