8000 GLSL cleanup: make var_FadeDepth a scalar by slipher · Pull Request #1338 · DaemonEngine/Daemon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

GLSL cleanup: make var_FadeDepth a scalar #1338

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

Merged
merged 1 commit into from
Jun 16, 2025

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.

8000
// 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.

@slipher slipher force-pushed the depthfade-cleanup branch from 1e22fe7 to 45667ba Compare October 8, 2024 00:00
@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
Divide out the w coordinate in the vertex shader instead of the fragment
shader.

Also add comment about hacky depth fraction calc.
@slipher slipher force-pushed the depthfade-cleanup branch from 45667ba to bdda401 Compare June 15, 2025 01:03
Copy link
Member
@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

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

I totally forgot about this.

If it works, LGTM.

8000

@slipher slipher merged commit 67d3a0f into DaemonEngine:master Jun 16, 2025
9 checks passed
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.

3 participants
0