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

Check matrix multiplication in shaders #4250

Open
bagnell opened this issue Aug 29, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@bagnell
Copy link
Contributor

commented Aug 29, 2016

Prevent possible precision errors when transforming vertices be multiple matrices.

Go through all of the shaders and change things like:

vec4 positionWC = czm_inverseView * positionEC;
vec4 positionMC = czm_inverseModel * positionWC;

to
vec4 positionMC = czm_inverseModelView * positionEC;

The only exception here is the projection matrix where we would want to do the opposite. Change
gl_Position = czm_modelViewProjection * position;
to

vec4 positionEC = czm_modelView * position;
gl_Position = czm_projection * positionEC;

For the first change see Creating Vast Game Worls by Emil Persson.
For the second change see Tightening the Precision of Perspective Rendering by Paul Upchurch and Mathieu Desbrun and Depth Precision Visualized by Nathan Reed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.