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

More lume-line instance attributes #272

Open
Pecos7 opened this issue Aug 6, 2023 · 4 comments
Open

More lume-line instance attributes #272

Pecos7 opened this issue Aug 6, 2023 · 4 comments

Comments

@Pecos7
Copy link

Pecos7 commented Aug 6, 2023

Add styling to the lume-line attributes similar to many design editors such as:

  • Line thickness
  • Cap type and corner types
  • Dashed and dotted lines
  • Gap and length specifications for dashed/dotted lines
  • Line alignment (inside, center, outside)

Example (Adobe Illustrator):
Screen Shot 2023-08-06 at 11 39 53 AM

The ability to curve lines like a bezier. Perhaps something similar to what lume-shape already has.

@trusktr
Copy link
Member

trusktr commented Aug 6, 2023

Hey Kyle! GPU shaders are tricky. Lines are based on points (geometry). SVG is based on math curves and not. We won't be able to support all SVG features.

To get an idea of how the near-term HTML line abilities will be, see here:

https://docs.lume.io/three-meshline/

That's a more complicated JavaScript interface for Three.js directly, and we'll be using that to improve the HTML line element.

So the near-term updates that we can realistically do will be:

  • curves, but these curves are not math pixel algorithms like SVG, but based on geometry (a series of points). So with curves, we will generate discrete points along the hypothetical curve path.
    • To get an idea of what I mean, the following demo has "curves" around the shape of a person, but if you zoom in, you can see the discrete geometry points: https://docs.lume.io/three-meshline/demo/shape.html
    • The HTML interface will have an option to configure how many points to place around each curve, but ultimately they will be geometry points. SVG is 2D, and pixel-based, so when you zoom in on an SVG, it re-calculates the 2D pixels in a very different way (not 3D shaders) and the result is always smooth, but not as fast, and not 3D.
  • line thickness with size attenuation (in that previous demo with the person, the lines have a thickness in world units, and a part of a line closer to the camera is thicker than a part of the line further away)
  • dashes (see dashArray and dashRatio in https://docs.lume.io/three-meshline/demo/index.html to play with dashes, and more).
    • There will be no dotted lines (as in circles/dots along a line?) for now, but it might be possible to generate a sequence of evenly-spread points (vertices) along a line and render them as GPU particles instead of lines, as a workaround, TBD.

The rest will require some tricky math and shader work, and would be longer term if possible. For you mapping use case, we'd need to stick to these initial near-term limits.

@trusktr
Copy link
Member

trusktr commented Aug 6, 2023

I forgot to mention, these lines in the GPU are made using sets of triangles. They are meshes. That's why they are difficult to make compared to SVG. They are meshes with triangles that, on screen, give the resemblance of a line.

@Pecos7
Copy link
Author

Pecos7 commented Aug 6, 2023

Thank you for these resources, Joe! I'll dive deeper in to the docs from the links provided and work within these constraints. Your amendments to my feature request make sense given your framework. I'm excited!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants