Skip to content

Fix coplanar strokes in WebGL mode not respecting depth + pixels[] being flipped #5981

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

Closed

Conversation

davepagurek
Copy link
Contributor

Resolves #2938
Also resolves #5386 because I noticed it while writing tests and needed it for my test to work :')

Changes:

  • Makes retained and immediate WebGL modes consistent by drawing strokes after fills
  • Adjusts the stroke shader to draw at the same depth as fills when perpendicular to the camera (and smoothly transitioning to being slightly in front of fills as they face away from the camera)
  • Makes get(x,y) and pixels consistent with 2D mode (previously, y was flipped)

Screenshots of the change:

Before:
image

After:
image

Live: https://editor.p5js.org/davepagurek/sketches/aSFkpcttn

Live demo of 3D shapes: https://editor.p5js.org/davepagurek/sketches/JBttrCMV-

PR Checklist

  • npm run lint passes
  • [Inline documentation] is included / updated
  • [Unit tests] are included / updated

@davepagurek
Copy link
Contributor Author

@aferriss if you get the chance, does this approach seem ok to you? (I kind of forgot about this change for a while, but it'd be great to address the underlying issue in the next p5 release!)

@aferriss
Copy link
Contributor

Apologies, I missed this! I see you added these changes to the updatePixels PR though so maybe we can just close this and merge in the changes over there.

@davepagurek
Copy link
Contributor Author

going to close this one, the changes were merged in with #6109 :)

@davepagurek davepagurek closed this May 3, 2023
@davepagurek davepagurek deleted the fix/webgl-coplanar-strokes branch May 3, 2023 10:26
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.

Inverted y in WEBGL createGraphics() canvas Stroke overlapping issue on co-planar shapes in WebGL
2 participants