Hi Byrne,

  Thanks for the info about exporting models for iOS.

  Glad you found a way to export a virus model from ChimeraX suitable for use in iOS apps made with Xcode.  The STL format is just a list of triangles, each with 3 vertex (x,y,z) coordinates, used mostly for 3D printing.  It does not have vertex normal vectors which are used to give smoother lighting.  In the future maybe ChimeraX will directly export Collada (*.dae) files and you will be able to export a usable model without running it through Blender.  As I mentioned before we support GLTF but not Collada currently.  Our ChimeraX efforts are mostly to help researchers analyze molecular structures so adding this does not have highest priority.  Unfortunately there are hundreds of feature requests we do not have time to implement with our limited funding.

Tom

On Dec 18, 2021, at 9:34 AM, Byrne Pedit <bpedit@comcast.net> wrote:

Hello again Tom,

 A follow-up follow-up. After extensive testing I have found a useable workflow from ChimeraX to iOS. Of course iOS apps may utilize PDB viewers, this is for folks who may want to incorporate models, in customized ways, into SceneKit for manipulation.

ChimeraX  ––>  STL  ––(graphics editor)––>  DAE ––Xcode–>  SCN

• In Chimera
–  reduce polys as much as possible*
–  export individual elements, e.g. chains, if you want individual control (materials, etc)
• In a graphics editor:
–  eliminate polygonal faceting of STL files
Blender, check Auto Smooth in addition to toggling on Smooth Shading
- Cinema 4D, add a phong tag 
–  recenter if desired, add additional elements

*You might want to add  surfaces to your reducing file-size tutorial. In the model below, the spike's resolution was set to 7, gridSpacing 3. You also need to click Hide for Atoms and Cartoons; otherwise they will severely bloat the file even though not seen. The entire file size of this SARS-CoV-2 model, as used by iOS, is 1.2 Mb (all but one of the spikes are all clones).
 
Thanks again for the help,

Byrne

                                         




On Dec 3, 2021, at 11:00 PM, Tom Goddard <goddard@sonic.net> wrote:

Hi Byrne,

  Thanks!  So Blender can convert GLTF to Collada.  The ChimeraX GLTF is binary and Collada is all text, so no surprise that the file size is much larger.  If we add Collada support it would be produced directly from the ChimeraX scene, not converting from GLTF.  But we have hundreds of new feature requests so I don't think Collada output is likely to be added soon, unless a funded project needs it.

Tom

On Dec 3, 2021, at 9:48 AM, Byrne Pedit <bpedit@comcast.net> wrote:

Hi Tom,

A follow-up for future reference. Blender, the one recommendation I found on StackOverflow, is indeed capable of converting GLTF to DAE. But the conversion bloats the files by as much as 10x! In addition, the hierarchy is only partially preserved. I tried an on-line converter with even less satisfactory results. So I think this pathway is a bust. This might serve as a fair warning for ChimeraX developers to avoid an internal conversion from GLTF if introducing a DAE export option.


Byrne




On Dec 2, 2021, at 2:22 PM, Tom Goddard <goddard@sonic.net> wrote:

Hi Byrne,

  I agree, OBJ and STL are very limited compared to Collada and GLTF.   OBJ is supported by almost every 3D model program and STL is commonly used for 3D printing (single color) which is why they are in ChimeraX.  GLTF is definitely the best option in ChimeraX for your case.

  There appear to be lots of programs that convert GLTF to Collada and the other direction too.  But I have not tried any of them so don't have any recommendation.  Let us know if you find one that works well -- other ChimeraX users may have the same need.

  A major stumbling block exporting 3D models from ChimeraX (or Chimera) is that they use vertex colors, while most of the non-biology 3D model world uses texture colors, and will simply ignore vertex colors losing all your color information.  That example I linked to in the last email describes a relatively new ChimeraX feature to export texture colors (for limited cases, e.g. discrete colors only).

  Another common problem exporting molecular models for use in other software is that the file size and number of triangles is too large for the application that you want to use them in, often tens of millions of triangles or hundreds of Mbytes to Gbytes in size.  The example also shows how to tell ChimeraX to limit the number of triangles.


Tom

Model from gltf export from linked ChimeraX example

<spike.png>


On Dec 2, 2021, at 2:04 PM, Byrne Pedit <bpedit@comcast.net> wrote:

Hello Tom,

Thanks for the response. I tried the GLTF export, not recognizable by Xcode (the development platform for iOS and Mac OS). The only ChimeraX file options I’ve found to be openable are OBJ and STL. These are, however,  problematic and unusable.

But your hint of using GLTF as an intermediary offers an avenue for exploration, it’s not a format I’ve used. I see it supports scene graph hierarchy, absent with OBJ and STL( exported from ChimeraX anyway) so this is promising. Now to find a converter.

The  GLTF export link is informative, it may help further refine my approach.   Interestingly, the molecule you’ve chosen for demo purposes appears to be the one, or a variant thereof, I’ve been testing with! 

Thanks again,

Byrne


On Dec 2, 2021, at 12:30 PM, Tom Goddard <goddard@sonic.net> wrote:

Hi Byrne,

  We have long been interested in adding Collada format export of scenes from ChimeraX.  Here is the feature request for that


But our scene export in ChimeraX has focused on GLTF format, as that has been the most requested.  Here is an example showing GLTF export from ChimeraX (including texture colors).


  ChimeraX also exports OBJ, STL, X3D, VTK as shown in the save command docs

https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#formats

Can you make use of GLTF files?  If not, a quick solution might be to convert ChimeraX GLTF files to Collada with third-party software.

Tom

On Dec 2, 2021, at 10:41 AM, Byrne Pedit via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:

ChimeraX is awesome and definitely superior to the original but for the inability to export as .dae (Collada). Is that possibly on the to-do list?   This is important for those of us (just me?) writing interactive molecular apps for devices. It is the only satisfactory path I’ve found between a PDB file and SCNNodes/Scenes in iOS. (See the iOS app ‘BioMole’, free, if interested in an application.)
_______________________________________________
Chimera-users mailing list: Chimera-users@cgl.ucsf.edu
Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimera-users