Import any 3D OBJ or STL file into vpython
Which contains vertices, normals and texture elements.
vt 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
and that box with the texture is displayed in the demo program.
So you should compare the milk_blender.mtl file with the box.mtl file contents.
and see if you can get your milk_blender.obj file to load with the demo program
try modifying this by adding the line
box7 = Wavefront(‘milk_blender.obj’)
and also add lines at the end
boxes.append(obj_to_triangles(box7))
boxes[-1].visible = True
boxes[-1].up = vec(1,1,1)
boxes[-1].pos = vec(8,-2,0)
Then run the file
python vpython_load_obj_test.py
and see what it produces. You might need to modify your milk_blender.mtl file to have the same fields as box.mtl in the example.
For instance box.mtl has a line
map_Kd box.png
but your mtl file doesn’t have a line like this.
John
Read more here: Source link
