I have a .vtu file with scalardata that renders fine in VTK viewers but the texture doesn’t export correctly to glTF format. I tested it with web viewers as well as F3D to ensure it’s not the viewer. It might be helpful to add that the glTF validator gives me a validation error:
Here is the part of code the exports it as glTF. It might be a bug or my lack of knowledge on how the model should be prepared. I suspect that I need to map the CellData to PointData before exporting to glTF but I’m not sure how to try that.
To make sure it is not happening because of my input file I tested the exporter with AssignCellColorsFromLUT example and I can recreate the issue.
Also tested from ParaView to make sure I have tested all the tools that I have access to. Here is the file exported form ParaView. It doesn’t even show up in F3D.
I will update this post and add the code once I figure out how to do it using vtkCellDataToPointData class.
import vtk
cell_to_point = vtk.vtkCellDataToPointData()
cell_to_point.SetInputData(polydata)
data = cell_to_point.GetOutputPort()
# you can use this data now to set up the mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(data )
mapper.SetColorModeToMapScalars()
mapper.SetScalarModeToUsePointData()
mapper.SetScalarVisibility(True)
# ... more code to set-up the mapper as you need
# ...
# update mapper - I'm not sure if this is required but I'll do it to be safe!
mapper.Update()