Hello everyone I am new around here, so please be patient if I asked stupid questions.
I work with Mathematica and in specific coding 3D human anatomical structures, which while Mathematica has 3D support for these I am not happy with the browser and mobile phone rendering capabilities and as a result dabbling into ThreeJS and Clara:
Export JSON from Mathematica but need a ftp command of some kind to run from within the Mathematica code , do not like to make a Java or PHP external code perhaps later on for super large uploads. I can call ftp from inside Mathematica. So I could create the JSON file for the anatomical structure and then like to call ftp to upload to Clara.io
I could easily create deformations of the 3D structures and store frames in JSON, would like then to do the same upload as #1.
I like to know some high level description of the JSON file which stores the frames for #2 .
How to specify color and opacity for the JSON frames, for example multiple anatomical structures, each with different color and opacity
I havenât used Mathematica for quite a while, but it probably has a few different ways of exporting in 3D - OBJ or Collada (DAE) formats may be better than JSON.
I know that Clara.io has an API, maybe you can connect Mathematica up to that. You might be better asking on their forums though.
Are your models animated in Mathematica? If so, again, there might be better export paths than JSON (note that OBJ doesnât support animation though).
Same goes here, although JSON does tend to be the easiest format to read. How are you exporting JSON from Mathematica?
If you use a different export format, I would assume that things like colour and opacity should be exported too.
EDIT: The Mathematica doc pages are really slow for me now, but thereâs a list of supported 3d formats here - of these I think only the OBJ and Collada loaders are well maintained in three.js. The VRML loader may be worth checking out too.
I do not know what is Claraâs API, if I have the FTP address that allows me to upload models then I will be all set. All I found was some Java code or manual upload button.
All my materials are computed in Mathematica, I can export JSON and .PLY and .OBJ. No idea what format is âpathsâ.
Details of the Clara.io API for importing are here: https://clara.io/learn/sdk/api/import
Thereâs no FTP address, itâs all done over HTTP, but you can upload files over HTTP too using the POST method.
Sorry, by âexport pathsâ, I meant âways of exportingâ, i.e. different formats.
Thereâs a three.js JSON format, I thought you might have been using that.
Itâs not very well documented, but you can find some examples here. You could probably write an exporter for Mathematica that would suit your purposes pretty easily.
However, I would recommend trying to export in .OBJ or .PLY format first.
I just checked DAE format is supported in Mathematica.
I will focus coming days to get an animation loaded into Clara using Mathematica generated 3D frames.
I have 64 cpu core server, each with a standalone license of Mathematica, so I could build large animated sequences, in particular the ones that require computational geometry algorithms e.g. vein generation which creates smoothly joined tube-like structures.
Here is the workflow for how I have to create scenes and animations in Clara, note that we do not want to do anything manually all has to be from the server code:
Mathematica running on 64 linux cpu cores, each core computes a frame for the animation
All frames are sequences and placed in DAE file in Mathematica.
Create New Scene in Clara??? is this necessary need to do that from Mathematica
Copy DAE file into the Scene??? am I understanding this correctly need to do that from Mathematica
Where and how server places the actual Java code in Clara?
How the server gets the URL for the animation from Clara?
@dara you can also test files with the three.js editor - just drag and drop them onto the scene. Also, Windows and Mac now ship with 3D viewers so you can test with those too, or use Blender on Linux.
At this point, you will probably need to go through the various 3D export formats available in Mathematica, see if you can get the models to work the way you want in any viewer.
However, I still think that Collada is likely your best bet here, if you can get Mathematica to export correctly. If you are contacting support, ask them is the Mathematica collada exporter support animation too.
Once you get past that step, you can figure out how to set up an online viewer.
@looeeeb Thanx I already worked most of what is needed. Could easily upload .OBJ files and it is already working for Boundary shells and filled solids, opaque and translucent.
The problem is which format to use for sequence of 3D models to make an animation, which you had proposed to use DAE. DAE is the issue not the rest.
I cannot do any of the listed operations manually on the front end editors. All has to be accomplished thru some code in some server.
The 3D structures we work with e.g. Anatomical are nearly impossible to handle manually since there is a huge number of them, and huge amount of annotation and dissections, beyond any amounts of man hours.