OpenAnatomy gltf changing mesh colors

I downloaded the latest preview release to try the updated OpenAnatomy GLTF export to view in 3Dviewer.net and Sketchfab. It works well but it’s changing my selected colors. For example, if I have an RGB of 177, 122, 101 for a segment (#b17a65), if I’m doing the correct calculation, the baseColorFactor in my gltf should be 0.4478708429, 0.1975164314, 0.1303522781, but instead it reads 0.347059, 0.2392155, 0.198039 (#9f867b). I can change this manually in the gltf and also in the Sketchfab viewer but just wanted to put it out there. The alpha is correct.

glTF uses PBR shading model. VTK only supported Phong model until VTK-8.2 (now it supports PBR as well) and this is what is currently used in Slicer.

Appearance generated by these models are quite different and material property parameters are quite different:

  • PBR parameters: base color (RGB), metallic (scalar), and roughness (scalar).
  • Phong parameters: color (RGB) and reflectance (scalar) for ambient, diffuse, specular reflection; and specular power (scalar).

It is not possible to reproduce the same appearance with these two models. VTK attempts to compute PBR parameters from Phong this way:

Unfortunately, this did not work very well - produced too bright, washed-out colors. It is also limited in that it does not take into account ambient and diffuse reflection factors.

I’ve tried to compensate for this in OpenAnatomy exporter here:

It was not a very sophisticated attempt. I did not look up how the glTF exporter computes the PBR values, just tried to darken the colors based on the ambient, diffuse, specular factors.

It would be nice if you could play around with the OpenAnatomy script to see if you can improve the results.

In the mid/long term, we’ll probably add support for PBR rendering in Slicer and improve VTK’s glTF exporter to allow writing out PBR parameters directly.

1 Like

I’ve submitted a fix to VTK that allows setting PBR parameters directly (by setting interpolation mode to PBR in the VTK actor properties), this fix is included in Slicer Preview Release from tomorrow. I’ve also updated SlicerOpenAnatomy extension to take advantage of this and copy PBR material properties directly to the output file. Therefore, for more accurate reproduction of color and surface appearance in glTF files, you can set model display properties to use PBR rendering. When using PBR interpolation it is also recommended to enable image-based lighting, as described here.

I’ve also updated export of non-PBR materials so that the color is made more saturated during export. This makes the color of the exported models more similar to the original appearance in Slicer.

2 Likes