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

Possible regression in euc 0.4.1 #9

Closed
CryZe opened this issue Sep 13, 2019 · 18 comments
Closed

Possible regression in euc 0.4.1 #9

CryZe opened this issue Sep 13, 2019 · 18 comments

Comments

@CryZe
Copy link
Contributor

CryZe commented Sep 13, 2019

I'm seeing some weird artifacts with euc 0.4.1:

Before:
score_split_2d9fac28

After:
score_split_3d370ce9

The 4 of the main points meter has a weird line going through it.

@zesterer
Copy link
Owner

Interesting. How are those numbers currently rendered?

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

I'm getting the glyphs from rusttype and then triangulate them with lyon. So they are basically just normal meshes. There shouldn't be a gap there as the two adjacent triangles there don't have a gap, as they are sharing the same vertices.

@zesterer
Copy link
Owner

euc's vertex shader now expects [f32; 4] as part of the return type, but I see that's not happening in your code. What happens if you emit 1.0 as the last value?

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

That's what I'm doing here. I didn't push the changes yet. Without a fourth f32 value, it wouldn't build.

@zesterer
Copy link
Owner

Would it be possible to put together a setup that demonstrates the problem such that I can try to figure out what's going on? I have a few suspicions, but it's difficult for me to confirm them without a way to test them.

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

I'll try to replicate it in a small-ish test.

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

Okay, this is really odd. If I disable alpha blending, the problem goes away O.o

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

It seems like the color values are completely out of range.

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

Yeah, that's a line where the input color is NaN apparently.

@zesterer
Copy link
Owner

I suspect that a NaN is generated somewhere in the rasterizer for a 0-width triangle or something like that, and that this gets propagated to the blending code.

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

Here's the code as a gist: https://gist.github.com/CryZe/ab4544126b6e0b6660364066cc818714

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

It's a white line in this because I do .min(255.0) at the end.

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

The line is at y=362, x>=198, x<=208

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

The triangle that causes it seems to be this one:

    let mesh = [
        Vertex {
            position: Vec2 {
                x: 0.39804077,
                y: -0.21000671,
            },
            texcoord: Vec2 {
                x: 0.0,
                y: 0.36832988,
            },
        },
        Vertex {
            position: Vec2 {
                x: 0.27268982,
                y: -0.21000671,
            },
            texcoord: Vec2 {
                x: 0.0,
                y: 0.36832988,
            },
        },
        Vertex {
            position: Vec2 {
                x: 0.44769287,
                y: -0.21000671,
            },
            texcoord: Vec2 {
                x: 0.0,
                y: 0.36832988,
            },
        },
    ];

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

And yeah, looks like that's a straight line as all y coordinates are the same.

@zesterer
Copy link
Owner

Okay, I've found the bug. As suspected, it was a NaN that got propagated throughout the texture projection code. I'm pushing a fix now (I'll publish a new version too).

@zesterer
Copy link
Owner

euc 0.4.2 now includes the patch.

@CryZe
Copy link
Contributor Author

CryZe commented Sep 13, 2019

Looks like that fixed it in all of my tests. Thank you for figuring this out :D

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