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

White stripes when fsaa is enabled #6860

Closed
HybridDog opened this issue Dec 30, 2017 · 13 comments
Closed

White stripes when fsaa is enabled #6860

HybridDog opened this issue Dec 30, 2017 · 13 comments
Labels
Bug Issues that were confirmed to be a bug @ Client / Audiovisuals

Comments

@HybridDog
Copy link
Contributor

HybridDog commented Dec 30, 2017

When using fsaa (here 2x), there's no proper edge between two polygons of nodebox nodes:
screenshot_20171230_150038

Without fsaa there's no white stripe:
screenshot_20171230_150123

As numberZero wrote, this happens because the neighbouring texel is used by fsaa. If it is transparent, the edge becomes half-transparent after blending.

@sfan5
Copy link
Member

sfan5 commented Dec 30, 2017

Can confirm, NVIDIA gpu here.
don't we have an open bug for this already?

@sfan5 sfan5 added @ Client / Audiovisuals Bug Issues that were confirmed to be a bug labels Dec 30, 2017
@sofar
Copy link
Contributor

sofar commented Jan 4, 2018

Confirmed as well.

@numberZero
Copy link
Contributor

numberZero commented Jan 6, 2019

The reason is probably rounding error, just like in #4912. Unlike solid nodes, however, nodeboxes have inexact vertex coordinates as they use rotate* functions all the time. Enabling FSAA increases rendering resolution effectively, which in this case makes the gaps visible. Note that they aren’t white but pink, i.e. blended; that means they are less than 1 pixel wide.

EDIT: My bad, rotate* is only used for texture coordinates. Vertex coordinates are unaffected.

P.S. Also note that size of 1/16 can’t be serialized exactly; that won’t break a single nodebox (as that’s its size and not vertex coordinates) but may lead to a gap (or overlapping) between nodeboxes.

@numberZero
Copy link
Contributor

@HybridDog What’s the node in your post?

@HybridDog
Copy link
Contributor Author

The node is from that mod: https://github.com/hybriddog/riesenpilz

The vertices of the top and side polygons are the same, so shouldn't they also have the same rounding error in the end?

@numberZero
Copy link
Contributor

numberZero commented Jan 9, 2019 via email

@HybridDog
Copy link
Contributor Author

HybridDog commented Jan 11, 2019

Thanks for your explanation. If I add an almost fully transparent black background, the borders are black because of disabled use_texture_alpha:
screenshot_20190111_162353

I think the problem is a bug because it affects every node (see the white stripe next to the black area):
screenshot_20190111_163236
In comparison to other games, minetest doesn't use linear or cubic interpolation for textures, so the stripe becomes clearly visible.
As far as I can see, fsaa mixes 4 colours, two of them are from the neighbouring texels which do not belong to the corner.
Is it possible to stretch the textures by an extremely small value so that fsaa does not use the neighbouring texel on corners?

@numberZero
Copy link
Contributor

minetest doesn't use linear or cubic interpolation for textures

Unless you enable it, but that actually makes the stripes visible just like FSAA does (which is unavailable on my current system BTW, while interpolation is forced).

Is it possible to stretch the textures by an extremely small value so that fsaa does not use the neighbouring texel on corners?

Maybe, but you’d better just pad your textures. You can use [noalpha if don’t want using separate files for inventory image and the node itself; that requires transparent pixels to have a correct value, though.

@HybridDog
Copy link
Contributor Author

[…] but that actually makes the stripes visible just like FSAA does […]

You're right, I haven't thought about texels used for interpolation.

Maybe, but you’d better just pad your textures.

This only affects my nodes. I think that without interpolation and certain textures (see the previous screenshot), FSAA makes the corners look worse, which defeats its purpose.

@numberZero
Copy link
Contributor

I think the problem is a bug because it affects every node (see the white stripe next to the black area):

See also the black stripe next to the white area. The problem here is exactly the same: blending with a wrong texel; this time, that’s the opposite edge of the texture. Try placing several nodes in a row, edges should look clear between them.

Also note that with filtering instead of FSAA, such node wouldn’t look nice at all as the stripes would be blended with each other. But there is an option to disable texture repeating in one or both dimensions, that should help.

Is it possible to stretch the textures by an extremely small value so that fsaa does not use the neighbouring texel on corners?

Okay, that might be reasonable, iff filtering is disabled. With filters, such scaling could break smoothness. But I just noticed one tiny detail that probably can’t be fixed in any better way: gray pixels at the black stripe’s end. These are from the bottom part of the bricks texture. But disabling tiling would break the look with filtering&hi-res textures, so that should be fixed in some other way. Naturally, I’d like to disable tiling automatically when filters are disabled, but that would help full nodes only.

There is still a problem of how to stretch the textures. I’ll try to find a sane method for nodeboxes (meshes are expected to have good texture coordinates already)

@HybridDog
Copy link
Contributor Author

HybridDog commented Jan 20, 2019

I’ll try to find a sane method for nodeboxes

Thanks.

@HybridDog
Copy link
Contributor Author

HybridDog commented Jan 20, 2019

HybridDog@63b7024#diff-15a21807c0c1462b310d02ab1a16763b
2019-01-20-135509_1920x1056_scrot
When stretching the textures another problem appears: The texels in concave corners are moved too, see the ring around the mushroom stem. This can be fixed by using four boxes in the mod instead of one which overlaps with the stem.

@numberZero
Copy link
Contributor

Oh, thanks for founding that. That effectively means there is no universal way to fix broken meshes. But proper meshes would look OK probably, just the offset should be an order of magnitude smaller (the original stripes have sub-pixel width, while the ring here is several pixels wide). Writing the code right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues that were confirmed to be a bug @ Client / Audiovisuals
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants