allow independent radius for point and edge in CurveNetwork
Currently, for CurveNetwork, it seems we can only set the radius to a fixed number for all nodes.
And the edge radius is determined automatically.
It would be very helpful if the radius setting can be expanded.
For Node: customized radii for each. For Edge: customized radiii for each. Different radii for the two ends would be even better.
Some references here: Node: https://stackoverflow.com/questions/27098315/render-large-circular-points-in-modern-opengl Line: https://stackoverflow.com/questions/9476503/glsl-tapered-lines
My knowledge is a bit limited for openGL shader stuff, so it would be great if someone else saw this issue and can help.
This would be awesome! Totally agree.
A thought about implementing this: Right now curve networks are rendered via spheres + cylinders (implemented in raycasted fragment shaders), where the sphere/cylinder radii are equal. This makes the cylinder edges nicely meet up with the sphere nodes. For setting a radius per-node, this all still works out, we could have the cylinders become circular frustums joining the two node spheres on either end. The harder case is what to do with edges--what happens if a node has many edges of different radii incident on it? What size should we draw the node sphere? It's impossible to make it join up smoothly, I think. Perhaps we shouldn't let this stop us from implementing the feature, but it's worth thinking about.
If someone wanted to start working on this, the PointCloud structure already supports something similar (setting a custom radius per-point from a scalar quantity). Most of the design should be copied from there: https://github.com/nmwsharp/polyscope/blob/master/include/polyscope/point_cloud.h#L92-L98
The sphere node rendering already supports using custom radii (see above). I think trickiest challenge here would be generalizing the cylinder shader to have different radii at the two ends. And figuring out a policy for the situation mentioned above, where a bunch of different-sized edges meet at a node.
This would be awesome! Totally agree.
A thought about implementing this: Right now curve networks are rendered via spheres + cylinders (implemented in raycasted fragment shaders), where the sphere/cylinder radii are equal. This makes the cylinder edges nicely meet up with the sphere nodes. For setting a radius per-node, this all still works out, we could have the cylinders become circular frustums joining the two node spheres on either end. The harder case is what to do with edges--what happens if a node has many edges of different radii incident on it? What size should we draw the node sphere? It's impossible to make it join up smoothly, I think. Perhaps we shouldn't let this stop us from implementing the feature, but it's worth thinking about.
If someone wanted to start working on this, the PointCloud structure already supports something similar (setting a custom radius per-point from a scalar quantity). Most of the design should be copied from there: https://github.com/nmwsharp/polyscope/blob/master/include/polyscope/point_cloud.h#L92-L98
From my own experience, in some cases, making the node larger than the curve is needed to show the connections, like in this pic:
So allowing customizing the radius size for each would be great.
I can check on the node radius based on the point cloud sometime this/next week and submit a PR.
For the edge issue (radius larger than node), in general, I can think of two solutions when an edge radius exceeds a node's:
- replace it with the node's radius (may need additional cost if the dataset is large?), and shoot a
warning; - just render it as bigger cylinders and shoot a
warning+ no rendering and shoot anerrorwhen the radius is too large.
For users who want to edit the edge radii, they should know what they are doing and what to look at if an error occurs.
The sphere node rendering already supports using custom radii (see above). I think trickiest challenge here would be generalizing the cylinder shader to have different radii at the two ends. And figuring out a policy for the situation mentioned above, where a bunch of different-sized edges meet at a node.
I agree, and my knowledge of shaders is very limited. In my previous libigl experience, I just created meshes and sent them to the openGL part...
Yeah, I think you're right that it's fine to just let the user set the node / curve radius however they want. There are lots of good reasons for sizes that don't perfectly match up at the nodes.
I'm all-for this feature, though I don't personally have time to implement it at the moment :)
I can take care of the point, and not sure how much I can go for the edge. Will do a PR.
#180 has been merged (see there for dicsussion)