themadcreator / seen

Render 3D scenes into SVG or HTML5 Canvas.
seenjs.io
Other
875 stars 84 forks source link

Immutable data model for collaborative editing #12

Open ghost opened 9 years ago

ghost commented 9 years ago

This looks pretty neat. I like the way the transformations are bunches up with a cache, before pushing to the canvas. I am wondering if you have thought about formalising this to operations, like a log forward system for immutable data. The idea is that other can write operations, and because they are immutable, when they are merged and played back it all works, independent of the time each operation was made. This is a big leap, but the fact that your base architecture is based on queuing the transformations, it seems plausible so i thought i would ask what you think.

Is this using a 2D canvas or 3D canvas ? I am not quite sure. I ask this because i need a way to take a 3D webgl model, and make 2D SVG of it.

themadcreator commented 9 years ago

seen.js renders to regular old 2D canvas as well as SVG.

I believe seen.js can render your 3D model in SVG. Take a look at the example of importing a .obj 3D model : http://seenjs.io/demo-multi-views.html

You can create seen.js shapes from .obj files like so:

var shape = seen.Shapes.obj(contents, false);

where contents is the .obj file data. I usually load the data with an XHR or JQuery.

Be aware, though, that you will not get the same performance as webgl when rendering, so depending on the complexity of the model, it may not be interactive.

As for the the immutable log forward system: can you give me an example of a concrete use case? Like, would I use this to create and replay static animations? Would this have performance impacts on interactive rendering?

ghost commented 9 years ago

Thanks that makes sense.

Log forward examples. Immutable data stores and data structures, but where each operation is idempotent.

That allows collaboration, which I need to do with the 3d stuff