Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile edge issue in 2d stretch mode #41696

Closed
qdwang opened this issue Sep 2, 2020 · 5 comments
Closed

Tile edge issue in 2d stretch mode #41696

qdwang opened this issue Sep 2, 2020 · 5 comments

Comments

@qdwang
Copy link

qdwang commented Sep 2, 2020

Godot version:

3.2.3 rc4 mono

OS/device including version:

Godot Engine v3.2.3.rc4.mono.official - https://godotengine.org
OpenGL ES 3.0 Renderer: Intel(R) UHD Graphics 620

Issue description:

There will be an tile edge issue in 2d stretch mode when resizing the window. Please check the picture below.
The problem won't happen at 100% size of window.
Using pixel snap can fix this issue, but my goal is to create a HD 2d game not a pixel game.

godot_tile_edge_issue

Minimal reproduction project:

GodotIssueTest.zip
The tile png is also in the zip file. The only 2 tiles are both 64x64 pixels with crisp edges.

@lawnjelly
Copy link
Member

I can't check out your project this week, as I'm away from home, but from the screenshot this looks similar to the issue solved in GLES2 with #39256.

Is this using the nvidia_workaround in GLES3 by any chance? This might be more susceptible to precision bugs than the legacy method (TEXTURE_RECT).

Some other options :

  • Use GLES2 batching (with uv contract in project settings)
  • add padding to your textures around each tile.

1 pixel should be enough if used only at normal magnification (no mipmaps) but 4 pixels probably better if you are using compressed textures.

@qdwang
Copy link
Author

qdwang commented Sep 4, 2020

  1. I'm not using nvidia wordaround.
  2. Using GLES2 batching with uv contract won't fix this issue.
  3. I believe that adding padding to the textures will solve the problem, but i hope this issue can be fixed.

@qdwang
Copy link
Author

qdwang commented Sep 4, 2020

This textureatlas png is auto generated by godot, which should have a 4x4 offset and 7x7 separation. It looks like the tileset renderer will change the texture a little bit. And the edge become blur.

image

@lawnjelly
Copy link
Member

lawnjelly commented Sep 4, 2020

Am back now and have had a look at the min reproduction project.

The tile atlas png is set to import with filter to on. This will give bilinear filtering but will require padding that matches the edge colours of the tiles. The alternative is to turn off filtering in the the texture (untick the filter checkbox, and click reimport).

I don't know whether there is an option in the tilemap editor to automatically create these matching edge padding for you (I'm not really familar with the tilemap editor etc), it is widely used for uv mapping and usually called dilate (I use it in my lightmapping module). If not it could be added as a godot proposal to autogenerate this padding.

@qdwang
Copy link
Author

qdwang commented Sep 4, 2020

Turning off the filter can solve the problem, but it will cause artifacts when moving the content.
Looks like I can create two different atlas for different use.

  1. textures with filter on, and won't be used in tileset.
  2. textures with filter off, and shouldn't be moving in canvas.

Thanks for the reply. I'm done for the issue, please feel free to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants