I want to know how to colour the exported models

Hello everyone,
I find that the exported models have no color(STL format).How can I make exported models have colors,because I find many people can make colorful models.
Thanks to you all.

So, the STL standard format does not support colors. If you want to preserve color information when exporting, try exporting in another format such as OBJ.

Thank you for your answer,but when I export obj format, it still has no color.What is wrong with my operation?

Perhaps something like this will work: Script repository — 3D Slicer documentation

When you export to OBJ, you get two files, a .obj file which has the mesh information, and a .mtl file with the same base name which has the “material” information, which includes color. When you want to load into another program which can handle OBJ files, you need to load both the .obj and .mtl files. Depending on the program, the color may automatically be applied to the mesh in this case, or you may need to apply the loaded material to the loaded object.

I would recommend the SlicerOpenAnatomy extension for this. It can export models with color, transparency, hierarchy, and names preserved, to OBJ and glTF format.

Thank you, I have downloaded the extension, but I can’t click “export” after choosing model and format.

You need to select a segmentation or a folder that contains model(s).

Exporting a single model is not really meaningful (you can then simply save it instead of using OpenAnatomy exporter module), but if you want to do that anyway then go to Data module, create a folder, and drag-and-drop your model into that.

1 Like

THANK YOU! I have spent a lot of time on this :sob:

But I still have a small question, when the Tr in MTL is 1, I can’t see my model.Only when I manually change Tr to 0 can the color be displayed normally.Is there a solution to this problem?

Just a guess, but it would not be surprising if Tr stood for transparency, with 1.0 fully transparent (invisible), and 0.0 fully opaque. In that case, it would be the correct behavior if objects with Tr 1.0 were not visible at all.

Hello everyone,
I have a question regarding to this topic.
I would like to export coloured model into the MSOffice software (Word, PP). How can i do that?
I have got that STL cannot carry any colors. But my OBJ exports are also colorless in PP.
If I’m using an online 3D viewer, there are no any problems with colors both for GLTF and OBJ.

And one more question on axes of exported files. If I’m using an STL in PP, model is shown in coronal plane (I mean antero-posterior view) and that’s OK. But if I’m using an OBJ, it is shown in axial plane (superio-infeior view) and this disturbs all the rotations of the model. Maybe I can export an OBJ file with coronal plane in default?

Thanks!

I would recommend the SlicerOpenAnatomy extension this. It can export colors d segmentation to OBJ or glTF.

Dear Andras,

I have used this extension already, but OBJ export is colorless all the same. It’s colorless only in the MS Office soft.

This is how it looks like.

Hi, did you solve this problem ?
Thanks

OBJ files contain only geometrical information, not color information directly. However, they can be saved with associated .mtl files which describe a material texture or color to apply to the object. Slicer saves these .mtl files when you export to OBJ. Many applications that load OBJ files automatically look for an associated .mtl file in the same folder with the same name and, if present, apply that material automatically. Other applications may require you to separately load the material file and apply it to the loaded object.

Thank you for your reply.
I am trying to import the mtl file in Unity but still no luck.

I have put the mtl file in the assets folder and configured the materials accordingly but the color just wont show.

I don’t think Unity can import material for obj file from mtl file. You may be able to convert to fbx and import that; or you can export to glTF from Slicer (using OpenAnatomy extension) and try if you can import it into Unity.

Thank you for your reply. Exporting to glTF did work.
For anyone wondering, glTF requires an extra step to be imported in unity