Exporting GLTF, use display color

Hi everyone,

I wanted to make use of the GLTF export option named “Use display color when no material is set” but I have no success, independently if I set the material to Default, or by Layer with the layer’s material being Default.
Can you provide a sample .3dm file containing an object that would actually export its display color when exported to gltf ?
I attach my 3dm file I am using to test if you want to reproduce. I am using latest Rhino 8.6.
image
31334_temp.3dm (25.4 KB)

Cheers

Hi Loïc - this looks broken to me, thanks.
RH-81576 Export gltf - color setting is ignored

-Pascal

1 Like

Hi Pascal,

Any update on this ?
I would really appreciate the feature.
Otherwise, is there a way to explicitly create a material from display color using python ?
Here is the python export script i use. I would like to get a GLTF with the display color from object as material.
Maybe you could help me adjusting this script to achieve this ?

#! python 3
import scriptcontext as sc
import Rhino
import time
from datetime import datetime

options = Rhino.FileIO.FileGltfWriteOptions()
options.UseDisplayColorForUnsetMaterials = False
options.MapZToY = True
exported_files = []
if enabled is not None:
    if enabled is not False:
        for i,source in enumerate(sources):
            start = time.time()
            doc = Rhino.RhinoDoc.OpenHeadless(source)
            opened = doc is not None
            if opened:
                opening_time = time.time()
                Rhino.FileIO.FileGltf.Write(destinations[i],doc,options)
                exported_files.append(destinations[i])
                doc.Dispose()
                end = time.time()
                print(f"Exported {destinations[i]} Iteration {i} {opened=} in {opening_time - start}s, total : {end - start}s")
            

Hi Loïc - that has been fixed in 8.8
RH-81576 File IO: glTF export ignores object display colors

-Pascal

1 Like