vasturiano/3d-force-graph-vr

Question: loading ndoes with alternate visualization (mesh)

Closed this issue · 6 comments

how challenging would it be to represent nodes with user defined meshes instead of spheres? presuming you had (reference to) those assets.

@eric-schleicher that's a great question. The challenge lies in the object references, because aframe (used by the underlying component) needs to serialize all accessor properties to strings, so they can be specified in the html. Therefore using references won't work.

On the other hand, this would be quite doable in the webgl version, since this restriction doesn't exist there: https://github.com/vasturiano/3d-force-graph.
It would be just a matter of exposing a mesh accessor property.

What's the particular use case for which you need this functionality?

I find myself wanting for personal organization and mind mapping solution and haven't found anything that lets me organize quite the way i would like to (in VR). I would like to come up with a way to create mind maps and use (proxy) representations of node with arbitrary 3d models. and then be able to change those from "thumbnail" models to "scenes" as the used chooses to get closer or interact with it.

Unfortunately i don't have the time to work one something like that. but it would be awesome.

@eric-schleicher I've just added a new feature nodeThreeObject, which allows for custom node objects. See here for an example: https://vasturiano.github.io/3d-force-graph-vr/example/custom-node-geometry/.

Let me know if this helps your case.

OK that's awesome! I will definitely use it

looking at the page's source this is not an a-frame component but the webGL. given what you wrote about the accessor properties, is there any way to ultimately have this work in a-frame?

I'm about to start a project what c/would use this but I'm leaning on starting with a-frame.

@eric-schleicher actually it is still using a-frame. The trick is to serialize the functions into the html attributes:
https://github.com/vasturiano/3d-force-graph-vr/blob/master/src/3d-force-graph-vr.js#L137

And then unserialize it on the a-frame component side:
https://github.com/vasturiano/aframe-forcegraph-component/blob/master/index.js#L19

The catch with this approach is that your functions need to be pure and don't access any local state external to the function, because they're re-instantiated (and called) in a different context then where they're defined.

Ok that makes sense. I'll likely have some question(s) in the next month.

This is great!