Opened 3 years ago

Last modified 3 years ago

#7552 assigned enhancement

Make exported GLTF atom and ribbon colors work in Enduvo VR

Reported by: phil.cruz@… Owned by: Tom Goddard
Priority: moderate Milestone:
Component: Input/Output Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Want Enduvo VR to be able to show atom and ribbon colors from GLTF exported by ChimeraX.

Phil Cruz reported in yesterday's NIAID meeting that GLTF exported from ChimeraX and then loaded into the Enduvo VR app does not show the colors of atoms and ribbons, they are all gray. But it does show the colors of surfaces.

Change History (7)

comment:1 by Tom Goddard, 3 years ago

A simple test with a print statement added to the gltf code to say which objects are output with vertex colors and which as single color objects shows that atoms and ribbons use vertex colors and the surfaces (per-chain and single color) use single object color.

open 3lbw
surface
save test.glb

So apparently Enduvo does not use vertex colors, but does use single object colors. That is not too surprising. Vertex colors are not very popular in generic 3D scene file formats -- instead almost all uses (3d video game assets) use texture colors.

There are 3 ways this can be remedied. 1) Enduvo software is improved to handle vertex colors. 2) ChimeraX exports texture colors for everything. 3) ChimeraX exports single colors for everything.

Solution 2, exporting textures, is perhaps already done using "save scene.glb textureColors true" as described in this example

https://www.rbvi.ucsf.edu/chimerax/data/texture-may2021/export_3d.html

Solution 3 would require making every atom a separate mesh and every ribbon residue a separate mesh, requiring some substantial changes to the gltf export code and probably making significantly bigger files (2x bigger?).

A drawback of both solutions 2 and 3 is that they cannot handle continuous varying color on surfaces, like electrostatic potential coloring. In theory textures could handle this, but the gltf textureColor option for exporting can only handle discrete colors (each triangle has to have all 3 vertices with the same color). With a great deal of work it might be possible to get texture colors for some continuous surface coloring like electrostatic coloring or hydrophobic coloring because those really are colormapped from a floating point value at each vertex (the texture is that 1D colormap).

comment:2 by Tom Goddard, 3 years ago

I am not able to test the above conclusions because I do not have Enduvo. Although the Enduvo web site has a Basic Plan that is free the link gives "Page not found".

comment:3 by Tom Goddard, 3 years ago

I think we should try both using texture colors with the already implemented "textureColors true" option. And we should also see if Enduvo has interest in supporting vertex colors.

in reply to:  4 ; comment:4 by phil.cruz@…, 3 years ago

Hi Tom,

I just heard back from Enduvo. Their technical lead, Justin Drawz, said "The reason they aren't seeing the other colors is because those other colors are done as "Vertex Colors." Half of their model is colored using material color, and the ribbon/atoms are colored using vertex colors. Enduvo doesn't support vertex colors."  They also sent along a Blender 2.79 script to convert vertex colors to material.  

Does ChimeraX save colors differently for surfaces and ribbons? Can ribbons be colored the same way as surfaces? Is that what the "textureColors true" option does?

Thanks,

Phil

On 9/2/22, 8:22 PM, "ChimeraX" <ChimeraX-bugs-admin@cgl.ucsf.edu> wrote:

    #7552: Make exported GLTF atom and ribbon colors work in Enduvo VR
    -----------------------------------+-------------------------
              Reporter:  phil.cruz@…   |      Owner:  Tom Goddard
                  Type:  enhancement   |     Status:  assigned
              Priority:  moderate      |  Milestone:
             Component:  Input/Output  |    Version:
            Resolution:                |   Keywords:
            Blocked By:                |   Blocking:
    Notify when closed:                |   Platform:  all
               Project:  ChimeraX      |
    -----------------------------------+-------------------------

    Comment (by Tom Goddard):

     I think we should try both using texture colors with the already
     implemented "textureColors true" option.  And we should also see if Enduvo
     has interest in supporting vertex colors.

    --
    Ticket URL: <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7552%23comment%3A3&amp;data=05%7C01%7Cphil.cruz%40nih.gov%7C633926f2110b4b27849108da8d42637b%7C14b77578977342d58507251ca2dc2b06%7C0%7C0%7C637977613524895657%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=qk2d0hKpfdBFzYK9XihzLRTyioV12TjMISnA6CswZAc%3D&amp;reserved=0>
    ChimeraX <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Cphil.cruz%40nih.gov%7C633926f2110b4b27849108da8d42637b%7C14b77578977342d58507251ca2dc2b06%7C0%7C0%7C637977613524895657%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=jjpLZx7CZPJecAUNk8%2Fp1t2d3pl4syC7GOAbDC8QbN8%3D&amp;reserved=0>
    ChimeraX Issue Tracker
    CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and are confident the content is safe.


in reply to:  5 ; comment:5 by goddard@…, 3 years ago

Hi Phil,

  Yes.  That is exactly what I found.  Enduvo does not handle vertex colors.  I told you some wrong things in our meeting about when vertex colors are used.  ChimeraX does not (usually) use vertex colors for a single color surface.  But it does use vertex colors for single color ribbons.  And although atom spheres don't use vertex colors, the GLTF exporter converts them to vertex colors because it was the simplest and highest performance way to handle that different atom spheres have different colors.

  I could probably add an option to the GLTF exporter to handle atom spheres and ribbons that are single color without vertex colors.  But continuously colored surfaces like electrostatic coloring would need a harder fix where ChimeraX instead uses texture colors.  Multi-color ribbons could possibly be split by the GLTF exporter into different pieces with different colors.

  I think the atom and ribbon cases are handled now by the textureColors option when saving gltf.  I don't have an easy way to test, since I can't run Enduvo.  Babylon.js which I use for testing handles vertex colors.

	Tom

comment:6 by Tom Goddard, 3 years ago

I did a test using ChimeraX gltf export with "textureColors true" to verify that it uses no vertex colors when showing ribbons, atoms and surfaces. None were used and all colors displayed correctly in Babylon.js sandbox. So I think that option should also make colors work in Enduvo.

The one case where that won't work is for continuously varying colors on surfaces. In that case, such a surface will still be exported with vertex colors. The definition of "continuously varying colors" used by the code is really if any triangle has 3 vertices which don't have the same 3 vertex colors, then it is continuously varying color. Ribbons and atoms should never have continuously varying color, only surfaces colored by electostatic potential or hydrophobicity or similar.

comment:7 by Tom Goddard, 3 years ago

I requested early access to Enduvo 2.0 on their web-site, apparently the only way to get access, on Sept 2, 2022. On Sept 24 they acknowledged receiving my request and said "we'll be in touch soon". Not holding my breath if it took 3 weeks to even acknowledge the request.

Note: See TracTickets for help on using tickets.