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

Cause of artifacts at certain zoom levels #21

Open
mreinstein opened this issue Mar 31, 2023 · 5 comments
Open

Cause of artifacts at certain zoom levels #21

mreinstein opened this issue Mar 31, 2023 · 5 comments

Comments

@mreinstein
Copy link

When I zoom the tileset, I see artifacts at various points, little lines at what I think are the edges of the tiles:
Screenshot 2023-03-30 at 8 47 17 PM

I'm guessing this has to do with rounding errors when the scale is set to particular floats?

How would one go about fixing this?

@englercj
Copy link
Owner

If you are using non-integer scales you can get rounding errors. Not sure there is a good fix for this in WebGL1 unfortunately. Depending on what scale you're wanting to use you may be able to round or clamp the coordinates in the shader, but I'm not sure there is a general fix for all scales.

@mreinstein
Copy link
Author

mreinstein commented Mar 31, 2023

Not sure there is a good fix for this in WebGL1

I'm actually using webgpu, and looking at existing tile renderers to try to find a solution (since webl material is so prevalent) but I think the same concepts apply across both graphics apis.

Depending on what scale you're wanting to use you may be able to round or clamp the coordinates in the shader,

hmm, that's interesting. Is there any way of determining what scales would be problematic?

I'm also considering maybe drawing everything to a texture at 1X scale, and then up or downsampling that texture into the frame, but that seems like a PITA in that I'd have to resize the offscreen texture every time the zoom level changes.

@englercj
Copy link
Owner

englercj commented Mar 31, 2023

I'm actually using webgpu, and looking at existing tile renderers to try to find a solution (since webl material is so prevalent) but I think the same concepts apply across both graphics apis.

WGSL has integers, most of the floats in the gl-tiled shaders should be integers (which don't exist in GLSL ES 1.0). Switching those over would likely help.

hmm, that's interesting. Is there any way of determining what scales would be problematic?

Not sure, I haven't thought about this problem space in ~3 years?

@mreinstein
Copy link
Author

WGSL has integers, most of the floats in the gl-tiled shaders

True, though most of the floats are related to texture sampling, and those have to be floats I assume, right?

Not sure, I haven't thought about this problem space in ~3 years?

Oh...well, sorry. Definitely not trying to pester you. Just figured this might be relevant to both of our repos.

@englercj
Copy link
Owner

englercj commented Apr 1, 2023

Not a pestering for sure, just unfortunately I don't think I have good answers for you :)

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

No branches or pull requests

2 participants