Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Line Drawing #1

Open
SimonDanisch opened this issue Sep 21, 2014 · 5 comments
Open

Line Drawing #1

SimonDanisch opened this issue Sep 21, 2014 · 5 comments

Comments

@SimonDanisch
Copy link
Member

I just noticed, that you either can't discuss a milestone, or I'm just to stupid to do so...
Well, I just wanted to share, that I could use more of my already existing pipeline to draw anti-aliased lines, even in 3D space, with very little memory usage.
I will look into this. But this might mean, that we can just have our own implementation, independent from mapbox =)
The implementation I've in mind, might even be faster! (I'm not yet an OpenGL genius, so I might have missed something here)
I can elaborated if any of you (@yurivish, @rennis250 ) are interested.

@SimonDanisch
Copy link
Member Author

Nice benefit from the method I imagine is, that you can have everything you want on the path/line.
So this might include a stroke pattern, 2D/3D objects, text, etc ;)

@yurivish
Copy link

Please do elaborate! I'm incredibly interested in this. Sent from my Commodore 64

On Sun, Sep 21, 2014 at 6:24 AM, Sdanisch [email protected]
wrote:

Nice benefit from the method I imagine is, that you can have everything you want on the path/line.

So this might include a stroke pattern, 2D/3D objects, text, etc ;)

Reply to this email directly or view it on GitHub:
#1 (comment)

@SimonDanisch
Copy link
Member Author

I don't know how familiar you are with my surface plotting method. But after some thinking it seems, as if it can be easily extended to draw anti-aliased lines as well.
For surface plotting you give a matrix of points, which I upload as a texture.
Then I use instancing, to draw for every point in this matrix a quad, which I transform, so that it is aligned to the surface.
This is best illustrated, when you make the quad a little bit smaller so that it doesn't touch its neighbor.
Surface
So instead of using a matrix and using quads as instance, we could use a vector of points and this as a primitive:
Anti-Aliasing Quad
And then with an additional list of normals and caps, we can calculate the line on the fly.
This would smoothly integrate with the current surface plotting api, one just needs to supply some more primitives and extend the shader a bit.
It's a tad more complicated, to make it look good with all the corner cases, but a first prototype should be easy to implement!
Maybe I can show you the first primitive prototype later today =)

@yurivish
Copy link

Hm. I'm not sure I completely understand, but I look forward to seeing it.

In case it helps, here's a half-implemented version of the Mapbox-style line rendering, which works okay while lines are mostly straight and fails on very angled curves: https://gist.github.com/yurivish/14c669a467fb1b65177a

This uses a couple of my own gl-tools functions so it won't run on its own, but it has most of the essential ideas.

@SimonDanisch
Copy link
Member Author

I made a little prototype as well now ;) I stole your aastep!
AAA
Hm... looked nicer on screen I think.
I guess, its not the optimal approach anyways, but maybe a good start to have line drawing at some point, and then we can gradually make it better from there ;)

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

No branches or pull requests

2 participants