Opened 2 years ago
Last modified 2 years ago
#9219 assigned defect
GLTF viewer colors differ from original ChimeraX colors
| Reported by: | Owned by: | Tom Goddard | |
|---|---|---|---|
| Priority: | moderate | Milestone: | |
| Component: | Input/Output | Version: | |
| Keywords: | Cc: | phil.cruz@… | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
From: "Browne, Kristen (NIH/NIAID) [C]" Subject: GLB color space from ChimeraX Date: June 20, 2023 at 12:22:32 PM PDT To: Tom Goddard <goddard@sonic.net> Cc: "Cruz, Phil (NIH/NIAID) [C]" Tom: I’ve been noticing that the ChimeraX GLB file colors look significantly different in all the GLB viewers and Blender that I’ve tried (all look like left) when compared to when they are loaded into Chimera X (right). The ribbons have vertex color, the surfaces have a material from ChimeraX. All the small molecules are doing the same thing. The surface looks closer, but a bit muted. This could just be a matter of the material/lighting, but I wanted to check whether the glb colors are being saved in linear sRGB color space? I’ve read that saving in gamma space is the number one cause of muted colors in glb files. I haven’t had problems with the colors when loading glbs from babylon’s example files. image001.pngimage002.png image004.pngimage003.png I can color correct the files as part of my conversion workflow, but it was worth checking whether it was something happening on your end that might be fixed for others as well, Thanks! K Kristen Browne, MSc, MscBMC Contractor – MSC, Inc. | A Guidehouse Company 3D Modeling and Biovisualization Specialist Bioinformatics and Computational Biosciences Branch (BCBB) OCICB/OSMO/OD/NIAID/NIH 5601 Fishers Lane, Room 4A60 Rockville, MD 20852
Attachments (4)
Change History (5)
by , 2 years ago
| Attachment: | image001.png added |
|---|
comment:1 by , 2 years ago
From: Tom Goddard
Subject: Re: GLB color space from ChimeraX
Date: June 20, 2023 at 1:08:43 PM PDT
To: "Browne, Kristen (NIH/NIAID) [C]"
Cc: "Cruz, Phil (NIH/NIAID) [C]"
Hi Kristen,
I have wondered about this too. ChimeraX does no color management. The colors in the saved PNG images are exactly the RGB values used in OpenGL and sent to the graphics card. The following Mac technical note says that OpenGL is not color managed on macOS, although every other Mac rendering e.g. done by the Preview app is color managed.
https://developer.apple.com/library/archive/technotes/tn2313/_index.html#//apple_ref/doc/uid/DTS40014694-CH1-NONCOLORMANAGEDFRAMEWORKS-OPENGL___EXPLICIT_COLOR_MANAGEMENT_EXAMPLE
If I save a PNG image on Mac and open that image and visually compare side-by-side with the original ChimeraX view the colors are different. They are exactly the same RGB values being displayed but Preview is applying a color profile and then the color profile of the display is being used. I can change the Preview color profile (menu Tools / Assign Profile...) but I had no luck getting them to match. The color differences look much smaller between Preview and ChimeraX compared to GLB viewers and ChimeraX. I suspect the reason for that is that the lighting has a strong effect on the perceived color and the GLTF lighting model (PBR = "physically based rendering") is entirely different than the ChimeraX lighting model. If I read a ChimeraX png image back into ChimeraX (open test.png format photo) it produces exactly the same colors that ChimeraX shows for the original model.
From what I gather online the OpenGL color profile is sRGB with gamma 2.2. But I guess it is unaware of your monitor's color profile so it probably won't look the same as an sRGB shown in a photo app because that will take account of the monitor's color profile.
This thread says GLTF vertex colors are supposed to be linear RGB, while other colors (e.g. material colors) are sRGB.
https://github.com/KhronosGroup/glTF/issues/1638
That would make a large difference in appearance and may be why the GLTF colors look so different from the ChimeraX colors. On May 12 I changed ChimeraX GLTF export so it replaces vertex colors with a single material for single-colored objects. If vertex colors and material colors are being interpreted in different color spaces then I guess a compliant GLTF viewer would show different colors with the newer ChimeraX (and probably more faithful ones since all single color objects will use material colors).
If GLTF vertex colors are widely interpreted as linear RGB by viewers I could convert ChimeraX colors from sRGB gamma 2.2 to linear RGB when writing GLTF. I'm not too keen on doing that because I think with 8-bit color components that is going to introduce visible jumps between adjacent colors since gamma 2.2 is much better adapted to non-linear eye brightness sensitivity.
Tom
Note:
See TracTickets
for help on using tickets.
GLTF viewer molecule image from Kristen