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

Perspective not corrected #8

Open
skrat opened this issue Mar 12, 2019 · 1 comment
Open

Perspective not corrected #8

skrat opened this issue Mar 12, 2019 · 1 comment

Comments

@skrat
Copy link

skrat commented Mar 12, 2019

I checked out your code, adapted to my purposes, and noticed that the perspective doesn't seem to be corrected in the vertex shader. The lines further away from camera are indeed getting thinner. I then cloned your repo, played a bit with the view and projection matrices, and noticed that it does the same thing. Any idea what's going on and how to correct for perspective and have lines with constant width?

Imgur

Also, my code is here https://github.com/skrat/webgl-line-rendering

@skrat
Copy link
Author

skrat commented Apr 22, 2019

All right in case anyone ever needs this:

// vertex shader
float t = u_thickness*currentProjected.w;

// fragment, if you do your own anti-aliasing in fragment shader
float t = u_thickness/gl_FragCoord.w;

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

1 participant