Opened 2 years ago
Closed 2 years ago
#10076 closed enhancement (fixed)
VRML output for 3D color printers
Reported by: | Owned by: | Tom Goddard | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Input/Output | Version: | |
Keywords: | Cc: | pett, Elaine Meng | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
I was looking at PDB 8hq3, and saw that one of the objects has a material and not vertex color so won't print correctly: [cid:image001.png@01DA08E6.DC9789F0] This is in Blender where it doesn't render vertex color by default, but it does render materials. The yellow is a material. Can this be fixed such that all pieces of the printable mesh are vertex colored? This would apply to all the ribbon (printable) presets. Thanks! Kristen Kristen Browne, MSc, MscBMC ((she, hers, her...why?<https://www.mypronouns.org/what-and-why/>) OCICB/OSMO/OD/NIAID/NIH Contractor - MSC, Inc. | A Guidehouse Company 3D Modeling and Biovisualization Specialist Bioinformatics and Computational Biosciences Branch (BCBB)<https://www.niaid.nih.gov/research/bioinformatics-computational-biosciences-branch> Remote from Buffalo, NY PH: 202-253-5228
Attachments (5)
Change History (17)
by , 2 years ago
Attachment: | image001.png added |
---|
comment:1 by , 2 years ago
Cc: | added |
---|---|
Component: | Unassigned → Input/Output |
Owner: | set to |
Platform: | → all |
Project: | → ChimeraX |
Status: | new → assigned |
comment:2 by , 2 years ago
I don't understand. If I use the NIH 3D preset Ribbon by Chain (Printable) I get a colored ribbon which will use vertex colors because there are multiple colors, and it has a single missing segment pseudobond that is yellow that will use a material color because our GLTF output uses material colors for all single-color objects.
I see from your image that Blender ignored the vertex colors which all became gray, but not the material color which is yellow. This indicates that Blender does not handle vertex colors. So why do you want to make everything vertex colors? To rely on Blender being broken to get rid of the colors? That seems a strange approach. If you need the model to be single color in Blender why wouldn't you in Blender change it to a single color? It seems perverse to have ChimeraX output vertex colors in order to rely on Blender not handling them.
by , 2 years ago
Attachment: | 8hq3_ribbon_by_chain_printable.png added |
---|
comment:3 by , 2 years ago
These comments didn't make it into the ticket due to cluster downtime:
Kristen: Everything needs to be vertex colored for 3d printing. I only used blender to illustrate the problem. Our printers cannot read material colors, everything has to be per-vertex for printable color models or they will come out white.
Tom: Do your printers directly accept GLTF format? I am wondering what software only accepts vertex colors. Most software does not accept GLTF vertex colors. So it is a twist that there is also software that only accepts vertex colors. I can make ChimeraX have an option to save GLTF with all objects using vertex colors. But I want to understand what software requires this. We have an amazing array of GLTF saving options in ChimeraX already because of various software packages not being able to handle various legal GLTF files, and I at least want to understand what software is causing the problem. Thanks.
Kristen: The printers take wrl or ply for color printing. We don’t use the glb directly, we always have to convert for printing. I think glb was requested from chimera x exclusively due to the viewer, but if I had been the one to make the call, I would have said dae because glb has limited support and we can convert to glb on our end.
I don’t use the printers or printer software directly, but our printers are quite old, so that may be part of where this requirement comes from. We can follow up with Meghan and Phil to make sure they’ve checked with victor that this requirement is still valid.
Tom: So the printers don't use .glb files -- not surprising. We need to know exactly what software is imposing a requirement for vertex colors. Is the conversion program from .glb to wrl or ply causing the problem, or is the printer itself not liking the wrl or ply file? I'm very reluctant to produce hacked GLTF output that is all vertex colors that almost no software can handle just so some broken downstream software that only handles vertex colors is happy. I can do that but we need a complete understanding before producing these unusual vertex-color only GLTF files that are likely to cause problems in the future because most programs won't read vertex colors.
Kristen: Just in case this has gotten lost in translation, this is just for the NIH3D presets, not a general requirement for ChimeraX (as far as I know). Everything but this one type of component are vertex colored including single color objects like bonds in the preset. I’ll let victor fill in the specifics of our software or hardware limitations for color.
comment:4 by , 2 years ago
From: "Browne, Kristen (NIH/NIAID) [C]"
Subject: Vertex Color Export
Date: November 1, 2023 at 5:20:03 AM PDT
To: Tom Goddard <goddard@…>, "Cruz, Phil (NIH/NIAID) [C]" <phil.cruz@…>, "Starr Kramer, Victor (NIH/NIAID) [C]" <victor.starrkramer@…>, "McCarthy, Meghan (NIH/NIAID) [C]" <meghan.mccarthy@…>
Tom:
I’ve followed up with Victor and Phil to confirm 100% that the color 3D printing software (zprint and 3D print) can only read color information using vertex color. So for anything that is exported with the intention of color printing (anything that isn’t produced by the monochrome + print presets), the model must be completely vertex colored. Anything with a material will print in white. Even outside of NIH 3D, this will become a problem for Phil or anyone else doing color printing.
That being said, GLB is indeed not a 3D printing format. ChimeraX does not support any formats that are compatible with color 3D printing. Our machines accept PLY or WRL, but not X3D. So anyone looking to do color printing will more than likely have to convert a glb or x3d into one of those formats. Ideally, ChimeraX would output wrl format completely vertex colored, and we’d use those for any color printable in the lab and in NIH 3D. I don’t know the level of effort to put in a wrl exporter. I know it’s similar to x3d, but I’m not sure how similar.
So the options in order of best resolving the issue are:
Add a wrl exporter which ALWAYS exports everything with vertex color. This would be the recommended format for export when doing color 3D printing.
Export GLB with everything vertex colored when it’s intended for color 3D printing. This would possibly be a gltf export option.
Please share your thoughts on this. I’ve talked to Phil, and color 3D printing of ChimeraX models is one of our most critical applications so it is important that we find a good solution. We’ve seen this feature impact other representations like byChain when there is a single chain, and I have a feeling it will crop up elsewhere.
Thanks!
Kristen
comment:5 by , 2 years ago
From: Tom Goddard
Subject: Re: Vertex Color Export
Date: November 1, 2023 at 10:10:38 AM PDT
To: "Browne, Kristen (NIH/NIAID) [C]"
Cc: "Cruz, Phil (NIH/NIAID) [C]" , "Starr Kramer, Victor (NIH/NIAID) [C]" , "McCarthy, Meghan (NIH/NIAID) [C]", Eric Pettersen
Hi Kristen, Victor, Phil,
Thanks for the info about color 3D printing. It is surprising to me that they require vertex colors since most software does not do anything with vertex colors. I think it will be pretty easy to add an option to our GLTF export to produce all vertex colors.
Exporting VRML (.wrl) might be not too hard if we stick to triangle sets, which I suspect is what the 3D printers want, not spheres, cylinders and standard shapes that VRML supports. The PLY format is probably easier as it is a very simple format.
Could the NIAID team think about the priorities of the 3 possibilities, gltf all vertex colors, VRML, PLY. My very rough estimate is that all 3 are about the same degree of difficulty each taking a few days, so we can provide multiple solutions so we can best support 3D printing.
Tom
comment:6 by , 2 years ago
Begin forwarded message:
From: "Browne, Kristen (NIH/NIAID) [C]"
Subject: RE: [EXTERNAL] Re: Vertex Color Export
Date: November 7, 2023 at 8:32:31 AM PST
To: Tom Goddard
Cc: "Cruz, Phil (NIH/NIAID) [C]", "Starr Kramer, Victor (NIH/NIAID) [C]" , "McCarthy, Meghan (NIH/NIAID) [C]", Eric Pettersen
Tom:
Sorry about the delay while we discussed our options.
I think we’d like to go with VRML/wrl as the export format and to have them completely vertex colored. That way if someone wants to color print, that format will be perfectly suited
Once that is available, we can update the workflows to use wrl output for any of our non-vis presets.
Let me know if you have any further questions!
Kristen
comment:7 by , 2 years ago
From: Tom Goddard
Subject: Re: [EXTERNAL] Vertex Color Export
Date: November 7, 2023 at 10:14:33 AM PST
To: "Browne, Kristen (NIH/NIAID) [C]"
Cc: "Cruz, Phil (NIH/NIAID) [C]", "Starr Kramer, Victor (NIH/NIAID) [C]" , "McCarthy, Meghan (NIH/NIAID) [C]", Eric Pettersen
Hi Kristen,
Ok. I will see if I can get ChimeraX exporting simple VRML consisting of triangle sets with all vertex colors.
Tom
comment:8 by , 2 years ago
Summary: | material instead of vertex color → 3D color printers need all vertex colors |
---|
comment:9 by , 2 years ago
Keep forgetting to post the discussion to this ticket so we have a record of it.
From: Tom Goddard
Subject: Re: [EXTERNAL] Vertex Color Export
Date: November 13, 2023 at 6:37:35 PM PST
To: "Browne, Kristen (NIH/NIAID) [C]"
Cc: "Cruz, Phil (NIH/NIAID) [C]" , "Starr Kramer, Victor (NIH/NIAID) [C]" , "McCarthy, Meghan (NIH/NIAID) [C]" , Eric Pettersen
Hi Kristen,
I was looking at VRML examples from 3D Print Exchange, and it doesn't look hard to output. But I'm still somewhat surprised we are going in this direction. If ChimeraX directly outputs VRML for 3D printing then that bypasses any mesh repair that might be needed. ChimeraX cannot fix the meshes to make them closed and connected. So is unrepaired ChimeraX VRML output going to be printable?
Tom
comment:10 by , 2 years ago
From: "Browne, Kristen (NIH/NIAID) [C]"
Subject: RE: [EXTERNAL] Vertex Color Export
Date: November 14, 2023 at 5:13:27 AM PST
To: Tom Goddard
Cc: "Cruz, Phil (NIH/NIAID) [C]", "Starr Kramer, Victor (NIH/NIAID) [C]" , "McCarthy, Meghan (NIH/NIAID) [C]" , Eric Pettersen
Tom:
In 3DPX, Color prints didn’t undergo any mesh repair, but our software is nonetheless able to print the ChimeraX models without issue. So, at least for our purposes, the unrepaired VRML is printable. The different printing softwares and printers have different levels of “forgiveness” for manifold issues and self-intersections. I’ve seen filament printers fail on the non-repaired stick models because of manifold issues. But so far as our powder-bed printer goes, it has everything it needs to work with the files with no repair. There’s a bit of a long story about mesh repair and it’s limitations, but for 3DPX, the input had to be STL and that’s why there is no repair on color models. For NIH 3D that is still the case. I will be adding color repair for small molecules in V2 of our workflows, but for ribbons it still isn’t possible due some limitations within Blender.
VRML was picked because this would allow us to print ChimeraX outputs directly without having to do any conversions after the fact . The NIH 3D workflows can generally handle anything I write the logic for, but for our print lab, they really need an output that will always be all vertex color that they can print directly. Given equal effort, this seemed like the choice with the most overall benefits.
K
comment:11 by , 2 years ago
Cc: | added |
---|---|
Summary: | 3D color printers need all vertex colors → VRML output for 3D color printers |
Type: | defect → enhancement |
I added saving of VRML output from ChimeraX to the 1.8 daily build and 1.7 release candidate, for example,
save test.wrl model #2 center true size 10 backfaceCulling false
All the options except the file name are optional. If models is not specified then the displayed models are saved. If center is true then the the VRML scene will have 0,0,0 at the center of the bounding box of the models. The default for center is true. If size is specified then the scene is scaled so the max bounding box edge size is the given value. If the size option is not given no scaling is done. If backfaceCulling is true then viewers do not need to so the interior side of triangles. This is usually used for surfaces with no holes. The default is false. The recognized file suffixes are .wrl and .vrml. There is no capability to read VRML files in ChimeraX.
The VRML output is very basic and intended specifically for 3D printing. It outputs everything in the scene as a single shape, a VRML IndexedFaceSet which is a set of triangles. Primitives such as exact spheres or cylinders are not exported. The number of triangles used for atoms and bonds in ChimeraX controls the quality of those spheres and cylinders in the VRML output. Colors are always output as vertex colors even if single colors are used in ChimeraX. Textures (e.g. volume image style display) are not handled. Normal vectors used for lighting are not included in the VRML file. So the VRML will appear faceted in viewer programs. VRML does not offer per-vertex transparency. If the entire scene has the same transparency then this will be specified as the VRML material transparency, otherwise the VRML will say the scene is opaque.
VRML is almost an entirely dead format. I made ChimeraX output similar to VRML files provided by 3D Print Exchange. I'll attach an example 3DPX file and a ChimeraX example VRML file. I tested the ChimeraX output using InstantPlayer from InstantReality (from 2016 and appears defunct now). I could not find any usable VRML validator to test if the ChimeraX vrml output conforms to the specification. Practically, the most important test will be whether it works with 3D printer software such as GrabCAD from StrataSys.
by , 2 years ago
ChimeraX VRML output example for virus capsid PDB 2bbv.
by , 2 years ago
Attachment: | 2bbv_instantplayer.png added |
---|
Image of ChimeraX 2bbv virus capsid VRML shown by InstantPlayer.
by , 2 years ago
Attachment: | 14588-cpk-color-print_NIH3D.wrl added |
---|
Example NIH 3D Print Exchange VRML file.
comment:12 by , 2 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
If it is still desired to allow gltf output to use all vertex colors, let me know and that can be done too.
Added by email2trac