Message Boards Message Boards


Put a texture onto a 3d model?

Posted 8 months ago
10 Replies
4 Total Likes

I am currently getting a mangled model whenever I try and add a texture. The obj file was obtained from exporting the heart model provided by wolfram. Any help would be appreciated.

ListSurfacePlot3D[Import["C:\\Users\\Ellis\\Documents\\theheartP4.obj", "VertexData"], 
 PlotStyle -> Texture[ExampleData[{"ColorTexture", "CheetahFur"}]]]

mangled model

10 Replies

Welcome to Wolfram Community! Please make sure you know the rules:

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your posts and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

enter image description here

Which model of the heart was used? There is a 3D model

AnatomyData[Entity["AnatomicalStructure", "Heart"], "Graphics3D"]
Posted 8 months ago

The heart object that I used was the model from wolfram, but I still had a mangled end result.

You can add more options

ListSurfacePlot3D[Import["C:\\Users\\Ellis\\Documents\\theheartP4.obj", "VertexData"], 
PlotStyle -> Texture[ExampleData[{"ColorTexture", "CheetahFur"}]], MaxPlotPoints -> 35, Mesh -> None, PlotRange -> All]
Posted 8 months ago

I originally had those options used, changing the max plot points only changed how intricately the model was mangled.

Import["C:\\Users\\Ellis\\Documents\\theheartP4.obj", "VertexData"], 
PlotStyle -> Texture[ExampleData[{"ColorTexture", "CheetahFur"}]], 
MaxPlotPoints -> 35, Mesh -> None, PlotRange -> All]

enter image description here

I have also used a few different models in case somehow the vertex data was incorrect prior to projecting a texture onto it.

Posted 8 months ago

First get the data from the Wolfram database:

heartModel = AnatomyData[Entity["AnatomicalStructure", "Heart"], "Graphics3D"];
furryTexture = Texture[ExampleData[{"ColorTexture", "CheetahFur"}]];


    PlotStyle -> furryTexture

enter image description here

Posted 8 months ago

Thank you! Also, do you know what was messing up my earlier attempts? How could I do this with any model that can be imported?

Posted 8 months ago

Dont know exactly what went wrong for you. But it probably has something to do with ListSurfacePlot3D/VertexData versus RegionPlot3D/DiscretizeGraphics. Compare these two examples:

shuttleModelA = ExampleData[{"Geometry3D", "SpaceShuttle"}];

enter image description here

shuttleModelB = ExampleData[{"Geometry3D", "SpaceShuttle"}, "VertexData"];
ListSurfacePlot3D[shuttleModelB, MaxPlotPoints -> 50]

enter image description here

On the other hand, the example from the textbook shows quite a good result using ListSurfacePlot3D


Posted 8 months ago

The texture on the bunny works, because the rendering of the basic model works with ListSurfacePlot3D, in this case. If the model rendering is not good the application of a texture will not improve the situation.

With ExampleData["Geometry3D"] it seems generally to be better to use RegionPlot3D/DiscretizeGraphics compared to the alternative ListSurfacePlot3D/VertexData.

Examples with the Klein Bottle:

RegionPlot3D@DiscretizeGraphics@ExampleData[{"Geometry3D", "KleinBottle"}]

enter image description here

ListSurfacePlot3D@ExampleData[{"Geometry3D", "KleinBottle"}, "VertexData"]

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract