Hello Guest

Author Topic: tilemap tearing even with large amount of padding  (Read 8303 times)

nachobeard

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 28
    • View Profile
tilemap tearing even with large amount of padding
« on: June 20, 2015, 01:10:37 am »
Hello

I've been noticing that there's some occasional "gaps" in the geometry of the tilemaps where some of the background becomes visible.  it's quite a jarring effect.

I've looked through the forums and you suggest adding padding to the spritesheet, which I've already done but the tearing is still there.

Please take a look at the attached images, where you'll find:
-an ingame image with the tearing
-a screen capture of the editor, showing the tilemap geometry
-a screen capture of the tile collection settings
-a screen capture of the spritesheet settings
-a screen capture of the sprite settings

You'll notice that there's plenty of padding, yet the tearing is still evident.

I'm using unity 4.6.6f2 and 2dtk 2.5.3

I've been happily using 2d toolkit for two years except for this tearing effect, which is driving me nuts.
It tends to happen when the camera is moving very slowly, which makes it all the worse because everything is moving smoothly and you notice these sudden flickers.

thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #1 on: June 20, 2015, 01:12:18 pm »
Post a repro, this shouldn't happen if the padding is working correctly. It looks like actual geometry gaps there, not a filtering issue that would be fixed by padding.

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Re: tilemap tearing even with large amount of padding
« Reply #2 on: June 20, 2015, 05:47:20 pm »
I have the same issue, which I can't seem to figure out how to resolve either. I'll try putting together a project that reproduces it.

Edit: This is seemingly too difficult to reproduce without sending you my entire game project, which I can't do. So given that, is tilemap padding setting the only thing that would be causing this? Lets say I was able to give you a project that reproduced this, where would be the first place you start looking? Could you explain why this is happening and why padding is suppose to help?
« Last Edit: June 20, 2015, 06:50:14 pm by Neeko »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #3 on: June 20, 2015, 10:29:18 pm »
I'd start figuring out what the problem is. Filtering issues are very different to vertex snapping issues. Then work out the coordinates of the points being fed into the renderer. If the points are the same, its gonna be unlikely its a vertex issue.

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Re: tilemap tearing even with large amount of padding
« Reply #4 on: June 21, 2015, 04:19:20 pm »
So which classes would you start debugging? You mention "work out the coordinates of the points being fed into the renderer" so where would I look to debug that, exactly? RenderMeshBuilder.BuildForChunk?
« Last Edit: June 21, 2015, 04:30:22 pm by Neeko »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #5 on: June 21, 2015, 04:30:57 pm »
Yes, but if that didn't give me the info i wanted I'd look at the actual meshes.

nachobeard

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #6 on: June 25, 2015, 05:18:11 pm »
Hey

it's taken me all day but I put together a project that reproduces the issue.
I'm concerned that this might be GPU-related so I'm not sure what results you'll be getting from your machine.  I've run it on two laptops with different chipsets and the tearing effect appears in both cases under the same circumstances.
it also appears on my iPhone 5s and my iPad 3.

Here's how to repro:
-load the project in unity.
-load the scene.
-make sure the game view is set to 1024x768 and that the game window is big enough so that it doesn't get scaled down (!!!)
-run the project (in the editor).
-press and hold right arrow for about 2 seconds (this moves the camera to the right).
-tearing should appear just for one frame and then disappear.  you can use left and right arrows to hone on the exact position where it's visible.

if the tearing doesn't appear, you'll just have to keep moving the camera with the left and right arrow (hold left shift to go faster) until the tearing pops up.  this can take a while though.

here's a weird thing, if I'm moving around with the arrows and I find a position where the tearing appears, the tearing doesn't actually appear if you copy and paste the same position into the transform component.

that's all I can do from my side, please fix this or provide a workaround, I can't ship a game with strange artifacts on it :(

Download link for the project:
Removed Link

regards.
« Last Edit: June 25, 2015, 06:42:20 pm by unikronsoftware »

nachobeard

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #7 on: June 25, 2015, 05:20:34 pm »
Here's what the tearing looks like, not sure if the image uploaded correctly in the previous post:
http://dl.dropbox.com/s/u1n3v2mwwvidqxf/tearing.png

regards.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #8 on: June 25, 2015, 06:43:03 pm »
Please register your copy and repost that in the private support forum, your project contains a drop of the tk2d source.

nachobeard

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #9 on: June 25, 2015, 06:49:05 pm »
oh so sorry about that I didn't realize :(
I'll do that instead.
sorry again.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #10 on: June 25, 2015, 09:20:03 pm »
What platform are you running this on? I can't see this happen in your repro on my laptop (15" 2015 retina macbookpro with AMD graphics). What hardware have you tested on - if windows, are you running dx11 mode? The more details the better.

Don't worry about it btw, this is a solveable issue - I suspect the values are all correct in there but you're seeing a precision issue, that can be solved in a few ways.

nachobeard

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #11 on: June 26, 2015, 09:00:12 am »
Hello Unikron,

cool, I'll do whatever I can from my side.
here's the hardware details:

My dev machine is a macbook pro (retina, late 2013)
2.8 ghz i7
Intel iris 1536 MB
OS X 10.9.5
this has unity 4.6.6f2 on it.
the "use Direct3D 11" box is unchecked in the player settings.

The other machine I've tried it on is an alienware M17R5
it has a geforce GTX 880M
it's running windows.
this has unity 5 on it.
dx9 is selected in the player settings.

the thing is it's quite hard to repro, it took me a couple of hours to place the camera in a spot where I can repro it every time, and it happened just by chance.

is there anything else that might help?

many thanks
-nacho.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #12 on: June 26, 2015, 09:22:52 am »
Hey,
I have a early 2013 retina mbp (with a 650M - but I'll disable that?) that I can test this on as well.
Don't have anything similar to the alienware though.

Let me see if I can reproduce it.


nachobeard

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #13 on: June 26, 2015, 09:24:13 am »
thanks man, fingers crossed

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tilemap tearing even with large amount of padding
« Reply #14 on: June 29, 2015, 10:15:03 pm »
Hi, drop me an email at support and we'll continue this on there. I can't reproduce this on my old machine, but I can think of a workaround for you to try out.