[vtkusers] How to display the obj file with several textures?
戴弘學
sd016808 at gmail.com
Fri Nov 21 02:41:55 EST 2014
I can display the obj file with one texture, but when the obj file contains
several textures then I don't know how to show it.
I have grouped the vt and f to the submesh corresponding to their texture
image.
The obj file is like below:
# 3 vertex textures in submesh 0
vt 0.36366 0.99907
vt 0.3628 0.99587
vt 0.36312 0.99569
# 3 vertex textures in submesh 1
vt 0.66907 0.98525
vt 0.66794 0.98268
vt 0.66887 0.98108
# 5 vertex textures in submesh 2
vt 0.65914 0.98112
vt 0.65258 0.97826
vt 0.65581 0.97424
vt 0.65254 0.97451
vt 0.65581 0.97424
...
# The material will be used for mesh 0
usemtl material_0
# Faces
f 1/1/1 3/2/3 2/3/2
f 7/4/7 9/5/9 8/6/8
f 10/7/10 12/8/12 11/9/11
# The material will be used for mesh 1
usemtl material_1
# Faces
f 61/323269/61 63/323270/63 62/323271/62
f 67/323272/67 69/323273/69 68/323274/68
f 70/323275/70 72/323276/72 71/323277/71
...
The mtl file is like below:
#
# Wavefront material file
#
newmtl material_0
Ka 0.2 0.2 0.2
Kd 0.8 0.8 0.8
Ks 1 1 1
d 1
Ns 75
illum 2
map_Kd 0.png
###
newmtl material_1
Ka 0.2 0.2 0.2
Kd 0.8 0.8 0.8
Ks 1 1 1
d 1
Ns 75
illum 2
map_Kd 1.png
###
newmtl material_2
Ka 0.2 0.2 0.2
Kd 0.8 0.8 0.8
Ks 1 1 1
d 1
Ns 75
illum 2
map_Kd 2.png
###
newmtl material_3
Ka 0.2 0.2 0.2
Kd 0.8 0.8 0.8
Ks 1 1 1
d 1
Ns 75
illum 2
map_Kd 3.png
...
Do I need multi-texturing? But I only have 4 texture units, it is not
enough.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141121/929b2bed/attachment.html>
More information about the vtkusers
mailing list