#9001 closed enhancement (fixed)
Add a backface culling option when saving to GLTF format
Reported by: | Owned by: | Tom Goddard | |
---|---|---|---|
Priority: | moderate | Milestone: | |
Component: | Input/Output | Version: | |
Keywords: | Cc: | Elaine Meng, Eric Pettersen | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
GLTF materials have a backface culling flag that tells the renderer whether to enable that option. The default is true, but an option to make it false would help for non-closed surfaces.
From: "Browne, Kristen (NIH/NIAID) [C]"
Subject: RE: [EXTERNAL] Re: gltf smoothing attribute:
Date: May 11, 2023 at 5:04:39 PM PDT
To: Tom Goddard
I’m not too sure exactly how things are computed! I actually stumbled into this because when I was building the mesh repair workflow, I use the STL that is created from the GLB files. Those files were really faceted in the viewer because the “smoothing” information was stripped. Then it came up again when I needed to remove the default “smooth shading” preference in my renderings for devices etc. and saw that indeed this was being applied to the GLBs from ChimeraX . Troubleshooting errors in the mesh repair process I’ve been working on gave me the opportunity to really scrutinize the outputs in a way there just wasn’t time for before.
One other thing that would be a totally optional feature request, would be to have a ChimeraX GUI option when outputting a glb to turn backface culling off. By default, most viewers optimize performance by not rendering the backfaces. When Phil was creating custom models that had a patch of surface in ChimeraX, they looked invisible when put in the viewer when viewed from the back. Same on Babylon and other GLTF viewers for web. I fixed them for him by extruding a second face. I could also manually update the gltf setting for backface culling. It is a gltf property of the material as they even have a toggle for it in the Babylon inspector:
<image001.png>
This is something that we can also do on our end, but it might be of wider use to your users that are also wanting to export models that have a surface like this and view it in a glb viewer like Babylon. I leave it up to you if it’s something you would like to incorporate!
K
Change History (3)
comment:2 by , 2 years ago
Cc: | added |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Done.
I added a backfaceCulling option (default true) to the save command for gltf format. So using "save myscene.glb backfaceCulling false" will allow you to go inside surfaces and view the interior. Maybe that should be the default. But it is a standard graphics performance optimization to not render triangles seen on their inside sides. Changing that default so it does render those will slow rendering down a little which could reduce the size of model that can be viewed in VR. So for now I will leave the default as backfaceCulling true which is what the GLTF standard uses as the default.
If you wish to use this option in the NIH3D pipeline scripts for certain models, describe which ones and Eric can look at changing the scripts.
follow-up: 3 comment:3 by , 2 years ago
I think this is great. True should absolutely be the default, but this will let Phil set the option himself when he's exporting certain models that need to go in VR etc. Thanks! -----Original Message----- From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu> Sent: Friday, May 12, 2023 9:06 PM Cc: goddard@cgl.ucsf.edu; Browne, Kristen (NIH/NIAID) [C] <kristen.browne@nih.gov>; meng@cgl.ucsf.edu; pett@cgl.ucsf.edu Subject: [EXTERNAL] Re: [ChimeraX] #9001: Add a backface culling option when saving to GLTF format #9001: Add a backface culling option when saving to GLTF format ---------------------------------------+------------------------- Reporter: kristen.browne@... | Owner: Tom Goddard Type: enhancement | Status: closed Priority: moderate | Milestone: Component: Input/Output | Version: Resolution: fixed | Keywords: Blocked By: | Blocking: Notify when closed: | Platform: all Project: ChimeraX | ---------------------------------------+------------------------- Changes (by Tom Goddard): * cc: Elaine Meng, pett (added) * status: assigned => closed * resolution: => fixed Comment: Done. I added a backfaceCulling option (default true) to the save command for gltf format. So using "save myscene.glb backfaceCulling false" will allow you to go inside surfaces and view the interior. Maybe that should be the default. But it is a standard graphics performance optimization to not render triangles seen on their inside sides. Changing that default so it does render those will slow rendering down a little which could reduce the size of model that can be viewed in VR. So for now I will leave the default as backfaceCulling true which is what the GLTF standard uses as the default. If you wish to use this option in the NIH3D pipeline scripts for certain models, describe which ones and Eric can look at changing the scripts. -- Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/9001#comment:2> ChimeraX <https://www.rbvi.ucsf.edu/chimerax/> 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.