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

GLSL cleanup: make var_FadeDepth a scalar #1338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

slipher
Copy link
Member

@slipher slipher commented Oct 3, 2024

Divide out the w coordinate in the vertex shader instead of the fragment shader.

Also add comment about hacky depth fraction calc.

// to window coordinates [0, 1]
float fadeDepth = 0.5 * var_FadeDepth + 0.5;

// HACK: the (distance from triangle to object behind it) / (shader's depthFade distance) ratio
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not linearize it then? I assume the different fading based on near/far plane etc. is not intended.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed like more effort than it's worth since I would have to plumb through the near/far values (which can apparently be different for every view) with a uniform. There's an r_zNear GLSL define, but it seems to have a tenuous (at best) connection with the value which is actually used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, zFar is supposed to cover the whole map in whatever direction, while zNear can change for portals. depthtile1_vp does this, albeit with r_zNear, but if it's discreet enough then it's fine as is I guess.

Divide out the w coordinate in the vertex shader instead of the fragment
shader.

Also add comment about hacky depth fraction calc.
@slipher
Copy link
Member Author

slipher commented Oct 8, 2024

Retargeted this to 0.55 to avoid future merge conflicts.

@illwieckz illwieckz changed the base branch from master to for-0.55.0/sync October 10, 2024 16:29
@illwieckz illwieckz changed the base branch from for-0.55.0/sync to master November 4, 2024 17:14
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.

2 participants