• 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 NymThePseudo · Oct 13, 2014 at 12:04 AM · flickeringseams

Flickering seams when moving camera [Unity2D]

Hello,

I'm trying to create a top down 2D game. Currently I'm stuck on a graphical problem: Some sprites 'borrow' pixels from their immediate left (in the sprite sheet) when moving the camera around, resulting in flickering seams. Below is an example:

alt text

Long Question: In this screenshot, you can see there are 4 'water' tiles that have this yellow 'seam' to the left of them (middle of screen). These lines originate from the vertical line of pixels to the immediate left of the sprite in the sprite sheet (See bottom left for the sprite and the yellow gapes in between sprites in my sprite sheet). The seams/lines flicker for a fraction of a second, happen when moving the camera around and can happen to any tile. In this case the grass tiles are not getting these lines since there are no pixels to the left of them in the sprite sheet.

I hope this issue has some obvious solution that I'm missing, but I couldn't find a proper solution through a google/forum search.

Additional information about sprite sheet/screen: Max Size 4095, Truecolor format, Point filtering, 64 Pixels to Units, happens at all resolutions. I could provide additional information about these seams/lines, but seeing how these lines are depending on their neighboring pixels in the sprite sheet, there's probably an obvious answer to this problem.

Short question: Sprites are using pixels from immediate vicinity in sprite sheet for fraction of a second, only when moving camera around. Possible causes?

EDIT: Since the colors of the seams depend on the vertical pixel line next to the sprite, I'm guessing this might have to do something with compression? I don't know exactly how the sprite renderer works though, so maybe someone with more knowledge about it might be able to answer this question.

problem.jpg (226.3 kB)
Comment
Add comment
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

4 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Lovelock · Oct 13, 2014 at 01:57 AM

My guess is that this is caused by fractional lookups in the sprite texture whenever the camera and/or tile positions aren't aligned properly. For example, if your sprite's Pixels to Units is set to 10, you could try and quantize your camera and tile positions to the nearest tenth.

 float nearestTenth = (int)(floatValue/0.1f)*0.1f;

This might eliminate your textures trying to read "half-pixel" values and keep them in line. Good luck.

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 NymThePseudo · Oct 13, 2014 at 02:10 AM 0
Share

Thanks! This did seem to make it work, I don't know why I didn't come up with this myself.

EDIT: This solution is not perfect it seems. When I repositioned my tiles so that my map's left boundary is touching the y axis and the bottom boundary touching the x axis, the lines reappear. However moving all the tiles with a slight offset toward any direction seems to solve it again. It definitely has to do something with things (not) aligning properly, but it can be worked around pretty easily, so I'm happy with this solution (-> Camera position rounding + Tiles offset [+0.01, +0.01]). Not the cleanest, but might avoid unexpected future graphical issues as well.

avatar image Lovelock · Oct 13, 2014 at 04:32 AM 0
Share

Glad I could help. I have an idea of why aligning it on the axis still causes the lookup to bleed into the seams. If the camera is at (0,0) and the tiles are aligned to the axes then the very center of the screen would be the intersection of 4 pixels surrounding the origin. That means that the $$anonymous$$or offset of (+0.01, +0.01) will make the rasterizer favor the proper pixels since you are now looking more-or-less at the center of the pixels. If you can calculate the size of half a pixel and offset the camera by that, you'll be dead center on each pixel and avoid seam bleeding. I hope. :) Best of luck! Edit: If you're rounded to tenths, then the offset might be half of that (0.05).

avatar image
3

Answer by stuckwiththisname · Nov 30, 2016 at 07:38 AM

I found your question while searching for my old question.

I'm going to post another answer since the question-asker notes in a comment to the accepted answer that the accepted solution didn't really work.

I had a very similar issue and it was also mostly corrected by snapping my camera to my pixel grid. Disabling Anti Aliasing fixed this problem for me.

Edit -> Project Settings -> QualitySettings and Disable "Anti Aliasing".

Details about my problem: http://answers.unity3d.com/questions/600341/seams-in-2d-pixel-art.html

Comment
Add comment · Show 1 · 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 MusaabOsman · Feb 05, 2017 at 06:34 PM 0
Share

This worked, thank you.

avatar image
0

Answer by MrScottyPieey · Sep 10, 2019 at 09:32 PM

This works but enable texture flickering.

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 Catonyourhead · Mar 25, 2020 at 04:05 AM

Hey, So make sure your import settings for the sprite are set to point(no filter), otherwise it can cause problems. I had moving tiles and synchronizing their movement using time.deltatime helped.

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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

how do i make lights flicker 2 Answers

Odd Portional Screen Flickering 0 Answers

Realtime spotlight shadows constantly flicker 1 Answer

Windows standalone game window flickers when no keyboard input is detected. 0 Answers

object in Jump&Run-Game is flickering when hitting boundaries - how to avoid? 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