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

Add depth_bias field to PolylineMaterial #26

Merged

Conversation

nicopap
Copy link
Contributor

@nicopap nicopap commented Apr 25, 2022

This let the user draw lines closer or further away from the camera
than the line is really in the 3d world.

A good use case for this is making the lines draw always in front of
geometry, or slightly offsetting the line so they can be shown in front
of geometry it shares with other things.

Closes #25.

Note on perspective: I would like to keep the ability to set/unset the perspective independently from the depth_bias. Perspective is a good way to see "where" a line should be even when it always show up in front of other things.

This let the user draw lines closer or further away from the camera
than the line is really in the 3d world.

A good use case for this is making the lines draw always in front of
geometry, or slightly offsetting the line so they can be shown in front
of geometry it shares with other things.
src/shaders/polyline.wgsl Outdated Show resolved Hide resolved
@nicopap nicopap marked this pull request as draft April 26, 2022 09:05
Also add some documentation explaining what it illustrates.
@nicopap nicopap marked this pull request as ready for review April 26, 2022 09:55
This commit accounts for homogenous clip space and makes sure the lines
with a -1.0 depth_bias are always shown in front of everything else by
having a depth value exactly equal to the clip's W.

This uses an exponential function for user ergonomics. But honestly, we
could probably do the exponential once on creating the material. and use
linear calculation in the shader.
@nicopap
Copy link
Contributor Author

nicopap commented Jun 10, 2022

@aevyrie May I get your attention? You might have overlooked this PR.

Copy link
Collaborator

@aevyrie aevyrie left a comment

Choose a reason for hiding this comment

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

This looks excellent, appreciate the added comments.

@aevyrie aevyrie merged commit 125c084 into ForesightMiningSoftwareCorporation:main Jun 29, 2022
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.

Feature request: Depth test bypass
2 participants