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

Screen texture and scan lines are now affected by curvature #1

Merged
merged 2 commits into from
Jul 18, 2019

Conversation

CowThing
Copy link
Contributor

@CowThing CowThing commented Jul 16, 2019

The shader no longer multiplies what's behind it, and now uses the screen texture as the color, and applies curvature to the screen UV. Scanlines are also affected by curvature now. I also added an option to change the speed of the scanline movement.

example

The shader now uses the screen texture as the color, and applies curvature to the screen UV. Scanlines are also affected by curvature now.
@hiulit
Copy link
Owner

hiulit commented Jul 16, 2019

Hey, thanks! That's awesome! :D
I've just opened an issue for myself to do what you have already did :P

The only issue I see is that the grille is also affected by the curvature.

Captura de Pantalla 2019-07-16 a les 16 32 32

@CowThing
Copy link
Contributor Author

Yeah I noticed that as well, it's called a moire effect. It's caused by how the grille lines are being distorted by the curve. If you scale up the screen enough it goes away. This does happen on real CRT screens as well when you take a photograph of one. I don't know if it's possible to fix it.

@hiulit
Copy link
Owner

hiulit commented Jul 16, 2019

That's a pity. The grille looked pretty cool, hehe!

It gets even worse when setting viewport mode.

Captura de Pantalla 2019-07-16 a les 17 10 05

Even if you scale up the screen, the grille stays the same. The moire effect doesn't go away.

@hiulit
Copy link
Owner

hiulit commented Jul 16, 2019

I'm really new to shaders, so here's my noob question: Can the grille somehow be "on top" of the rest?

This uniform allows the user to change the number of grille lines and scan lines that appear.
@CowThing
Copy link
Contributor Author

Keep in mind this also happens when curvature is disabled. It's just a bit harder to tell when it happens because the moire effects are straight lines instead of curved lines. And yeah when it's set to viewport mode it wont go away when scaled up. This effect can happen to the scan lines as well, not just the grille lines.

I made a few changes to help. I changed the line calculations from using cos to sin, and increased the precision of PI, so that the lines better match the pixels. I also added a screen_size uniform which will allow the user to change how many grille lines and scan lines appear, having fewer grille lines and scan lines will make them larger, which makes it harder for the moire effect to appear.

@hiulit
Copy link
Owner

hiulit commented Jul 18, 2019

Thank you very much! I really appreciate it.

@hiulit hiulit merged commit aa1c246 into hiulit:develop Jul 18, 2019
@hiulit hiulit mentioned this pull request Jul 18, 2019
@CowThing CowThing deleted the screen_curvature branch July 18, 2019 14:48
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

Successfully merging this pull request may close these issues.

None yet

2 participants