Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a shader that visualizes level sets of a scalar quantity as contour lines that have constant thickness in screen space. For scalar quantities, the shader is exposed through under the Options menu, as
Enable contours
(just likeEnable isolines
). Contours have three parameters:There are still some things that could be improved. For instance, contours are currently drawn as black, which may not be very visible over dark color gradients. Here it might be helpful to add a color picker, or at least an option to use a different effective blend mode (like "invert"). Also, stripe width is set using the screen-space gradient of the scalar quantity. Since vertex quantities are piecewise linear, these derivatives will be piecewise constant. Hence, stripe thickness will suddenly jump when going from one triangle to the next. This artifact is especially noticeable for thick contours. Not sure what the best solution is. One is to provide an option that disables constant thickness, and just sticks to uniform thickness (which will render contours as thicker/thinner). Another is to pass in a gradient magnitude per vertex, so that these magnitudes get interpolated linearly across triangles. This will work great, but requires additional setup that is not super compatible with the rest of the shader ecosystem.
I didn't see an obvious place in the docs to document shaders, but let me know if I've missed it and I can add something.