Color is not correct in binary stl

When loading an stl the binary format appears in red color.
But if I load a stl in ascci format it appears in the correct color.
Example of how I load the stl:

const reader = vtkSTLReader.newInstance();
await reader.setUrl(this.stl, { binary: true });
const vertebraMapper = vtkMapper.newInstance();
vertebraMapper.setInputData(reader.getOutputData());
const vertebraActor = vtkActor.newInstance();
vertebraActor.setMapper(vertebraMapper);
vertebraActor.getProperty().setOpacity(0.6);
vertebraActor.getProperty().setColor([0.88, 0.84, 0.73]); // rgb(225, 214, 186)

color

1 Like

Does your binary STL have color info? I’m not familiar with the STL format, but I am noticing that the binary reader is adding an extra data array to the cell data, while the ASCII one doesn’t. @Sebastien_Jourdain

Stl format has no color data.

I was having the same issue. Make sure you initialize the wrapper with scalarVisibility set to false like this:

const mapper = vtkMapper.newInstance({ scalarVisibility: false });

Found this detail from the STLReader example https://kitware.github.io/vtk-js/examples/STLReader.html