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

fix: make ring outline determine thickness as a proportion of radius #178

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/graph/nodes/ring/Ring.fs.glsl
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is in the ring shader, I assume this applies to the circle node as well? What about the other shapes? How does the thickness work for those?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change only affects the ring type node. I have not made any changes to other shapes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

right, but the question is should we, i assume right now the other shapes are doing what they did before, so pixel locked the outline width. All shapes/nodes should behave the same otherwise it will be very confusing to keep track of the differences.

Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ in vec2 vFromCenter;
out vec4 fragColor;

void main() {
float thickness = max(fPixelLength, min(0.1, fPixelLength * uOutline * uPixelRatio));
float antialias = min(thickness, fPixelLength * 1.5);
Copy link
Collaborator

Choose a reason for hiding this comment

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

you removed the antialias now, that will make the rendering jaggy, should this not be added back with the new thickness checked?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How would we implement it in the new context of using a proportion instead of a particular pixel length?

Copy link
Collaborator

Choose a reason for hiding this comment

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

do we not compute the thickness value with the ratio? could we not pass that along withthe 0.5 offset?

float radius = 1.0 - thickness;
float ring = opOnion(sdCircle(vFromCenter, radius), thickness);
float modeDistance = uRenderMode == MODE_HIGH_PASS_1 ? -antialias : -antialias * 0.5;
float distance = uRenderMode == MODE_HIGH_PASS_2 ? 0.0 : modeDistance;
float thickness = uOutline / 2.0;
float innerRadius = 1.0 - thickness;
float ring = opOnion(sdCircle(vFromCenter, innerRadius), thickness);
float antialias = fPixelLength * 1.5;

if (ring > distance) {
if (ring > 0.0) {
discard;
}

Expand Down
Loading