Hello Guest

Author Topic: Tilmap editor - Black lines flickering  (Read 15819 times)

flying_hamster

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Tilmap editor - Black lines flickering
« on: July 19, 2012, 06:15:53 pm »
When I create the tile map everything looks fine, but when you play the game as you move about the game I get these black lines where the edges of tiles are (see screen shot). Is there a way to fix this? My textures are premultiplied.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #1 on: July 19, 2012, 06:38:32 pm »
What is the edge filtering mode on the sprites, and what is behind them? How many layers?

flying_hamster

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #2 on: July 19, 2012, 06:49:06 pm »
There are 4 layers. I am not sure where to find the edge filtering mode? The pad method is set to extend and thats about all I changed in the collection.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #3 on: July 19, 2012, 07:13:21 pm »
Sorry I meant pad method not edge filtering mode.

are the black lines at tile boundaries?

flying_hamster

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #4 on: July 19, 2012, 07:21:00 pm »
Yes they are at the tile boundaries.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #5 on: July 19, 2012, 07:49:53 pm »
This is unexpected. Is there any chance you could set up a repro case for me to look at?
Let me know if it isn't possible / too much hassle, I'll think of a few more tests to try and narrow down whats going wrong.
« Last Edit: July 19, 2012, 07:58:56 pm by unikron »

flying_hamster

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #6 on: July 19, 2012, 08:56:49 pm »
I emailed you a link to an unity package with what I am using. Hopefully that helps. Cant do much more then that.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #7 on: July 19, 2012, 09:01:18 pm »
Thanks for the package. I'll investigate.

TMK

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
    • Dragonhead Games
Re: Tilmap editor - Black lines flickering
« Reply #8 on: July 23, 2012, 05:07:34 am »
This also happens in my project.

Please let me know if you want me to send a repro project as well, or if you've found out the problem :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #9 on: July 23, 2012, 07:47:41 am »
Yeah we figured it out.

flying_hamster was using a perspective camera for the tilemap, had multiple layers and was running on Unity 3.5.3/2D Toolkit 1.7. In that version of 2D Toolkit, there was a workaround for a Unity 3.4 - 3.5.2 bug to do with inertia calculation. The workaround was, one of the vertices per sprite was pushed back slightly.

When viewed with a perspective camera, occasionally (well quite often) the parallax from this slightly offset vertex would cause the pixel behind to be visible. Sometimes this was dark.

If you're using v1.75/6 and Unity 3.5.3 then this should not be a problem any more - just in case, re-commit your sprite collection and see if that improves anything. If not, it could be something different... in that case, a repro project would be very much appreciated.

support@unikronsoftware.com

MooNiZZ

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #10 on: July 23, 2012, 06:22:17 pm »
I actually do see some black lines at some tile borders with my normal orthographic camera. I put the clear flags to Depth only and solved it :P

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #11 on: July 23, 2012, 06:38:56 pm »
That doesn't really solve the problem, it just hides it to some extent. You shouldn't get ANY black lines with an ortho camera and when displaying at full resolution.

If you see black lines with an orthographic camera -
1. Is the sprite padding mode set to extend? If not, its likely this is the problem.
2. Does turning off mipmapping make the lines disappear?  If yes, you probably aren't displaying the tilemap at 1:1 resolution.



MooNiZZ

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #12 on: July 23, 2012, 11:54:26 pm »
It's set to extend. i haven't changed the resolution of anything in the tilemap. I haven o idea how to turn of mipmapping either. I'm pretty new to unity overall. Been working with it for 3 weeks now.

The attached file shows the lines, and it only happens in exactly that place. It's not noticeable at all if you just walk past it slowly. But you see them if you stop there :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #13 on: July 24, 2012, 12:04:37 am »
It's set to extend. i haven't changed the resolution of anything in the tilemap. I haven o idea how to turn of mipmapping either. I'm pretty new to unity overall. Been working with it for 3 weeks now.

The attached file shows the lines, and it only happens in exactly that place. It's not noticeable at all if you just walk past it slowly. But you see them if you stop there :)

That looks like its happening on tilemap chunk boundaries. I'll have to look into this to see if I can reproduce it. The z depths are different on the chunks. Perhaps its got something to do with this.

MooNiZZ

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: Tilmap editor - Black lines flickering
« Reply #14 on: July 24, 2012, 12:18:23 am »
Aye, and remember that i'm offsetting all tiles little more than you normally are in Z,
removed z += 0.00001 from row 299 and added

z = ((y + 1) * 0.1028f) + (tileMap.gameObject.transform.position.y * 0.032125f) - (layerId * 0.1f);
to row 255. If that makes any difference