Help with texture coordinates?
Posted: Wed Apr 13, 2005 9:48 pm
I have been trying to utilize the UV texture functions of my modeler to apply materials evenly to tripled vertices, etc. and I have been stuck for a while due to my own ignorance
The following is a simple exported obj file of a cube with UV textures applied to it:
####
#
# OBJ File Generated by LightWave3D
# LightWave3D OBJ Export v2.2
#
####
# Object: Cube.lwo
#
# Vertices: 8
# Points: 0
# Lines: 0
# Faces: 6
# Materials: 6
#
####
o Cube.lwo
# Vertex list
v -2.5 -2.5 0
v -2.5 -2.5 -5
v -2.5 2.5 -5
v -2.5 2.5 0
v 2.5 -2.5 0
v 2.5 -2.5 -5
v 2.5 2.5 -5
v 2.5 2.5 0
# Face list
g
usemtl xminus
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
f 4/-1 3/-2 2/-3 1/-4
g
usemtl yminus
vt -2.000000 0.500000
vt 3.000000 0.500000
vt 3.000000 5.500000
vt -2.000000 5.500000
f 2/-1 6/-2 5/-3 1/-4
g
usemtl zplus
vt -2.000000 -2.000000
vt 3.000000 -2.000000
vt 3.000000 3.000000
vt -2.000000 3.000000
f 3/-1 7/-2 6/-3 2/-4
g
usemtl yplus
vt -2.000000 0.500000
vt -2.000000 5.500000
vt 3.000000 5.500000
vt 3.000000 0.500000
f 8/-1 7/-2 3/-3 4/-4
g
usemtl zminus
vt -2.000000 -2.000000
vt -2.000000 3.000000
vt 3.000000 3.000000
vt 3.000000 -2.000000
f 5/-1 8/-2 4/-3 1/-4
g
usemtl xplus
vt 0.500000 -2.000000
vt 0.500000 3.000000
vt 5.500000 3.000000
vt 5.500000 -2.000000
f 6/-1 7/-2 8/-3 5/-4
# End of file
When I run this through the model tool I get this:
mesh #
# vertices: 8
# normals: 0
# texcoords: 4
# faces: 6
vertex -2.500000 2.500000 5.000000
vertex -2.500000 2.500000 0.000000
vertex -2.500000 -2.500000 0.000000
vertex -2.500000 -2.500000 5.000000
vertex 2.500000 -2.500000 0.000000
vertex 2.500000 -2.500000 5.000000
vertex 2.500000 2.500000 0.000000
vertex 2.500000 2.500000 5.000000
texcoord 2.500000 5.000000
texcoord 0.000000 2.500000
texcoord 2.500000 2.500000
texcoord -2.500000 0.000000
face
vertices 0 1 2 3
texcoords 0 1 2 3
matref xminus
endface
face
vertices 2 4 5 3
texcoords 0 1 2 3
matref yminus
endface
face
vertices 1 6 4 2
texcoords 0 1 2 3
matref zplus
endface
face
vertices 7 6 1 0
texcoords 0 1 2 3
matref yplus
endface
face
vertices 5 7 0 3
texcoords 0 1 2 3
matref zminus
endface
face
vertices 4 6 7 5
texcoords 0 1 2 3
matref xplus
endface
end
Two things that I noticed right off the bat:
1) The "vt" components of my exported obj file only have 2 vertices (assuming that these are U and V coords). I haven't figured out how to get the modeler to remedy this. I plead third degree ignorance on UV mapping.
2) The converted bzw file uses the same texcoords for all faces. I assume this is due to my modeler's obj output structure?
If anyone could enlighten me on what the "vt" component of an obj file describes, it would help a great deal. I am capable of creating my own conversion program if I know the basics of how to translate the "vt" components into texture coordinates. I am sorry for my lack of knowledge with texture mapping
Thanks!
The following is a simple exported obj file of a cube with UV textures applied to it:
####
#
# OBJ File Generated by LightWave3D
# LightWave3D OBJ Export v2.2
#
####
# Object: Cube.lwo
#
# Vertices: 8
# Points: 0
# Lines: 0
# Faces: 6
# Materials: 6
#
####
o Cube.lwo
# Vertex list
v -2.5 -2.5 0
v -2.5 -2.5 -5
v -2.5 2.5 -5
v -2.5 2.5 0
v 2.5 -2.5 0
v 2.5 -2.5 -5
v 2.5 2.5 -5
v 2.5 2.5 0
# Face list
g
usemtl xminus
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
f 4/-1 3/-2 2/-3 1/-4
g
usemtl yminus
vt -2.000000 0.500000
vt 3.000000 0.500000
vt 3.000000 5.500000
vt -2.000000 5.500000
f 2/-1 6/-2 5/-3 1/-4
g
usemtl zplus
vt -2.000000 -2.000000
vt 3.000000 -2.000000
vt 3.000000 3.000000
vt -2.000000 3.000000
f 3/-1 7/-2 6/-3 2/-4
g
usemtl yplus
vt -2.000000 0.500000
vt -2.000000 5.500000
vt 3.000000 5.500000
vt 3.000000 0.500000
f 8/-1 7/-2 3/-3 4/-4
g
usemtl zminus
vt -2.000000 -2.000000
vt -2.000000 3.000000
vt 3.000000 3.000000
vt 3.000000 -2.000000
f 5/-1 8/-2 4/-3 1/-4
g
usemtl xplus
vt 0.500000 -2.000000
vt 0.500000 3.000000
vt 5.500000 3.000000
vt 5.500000 -2.000000
f 6/-1 7/-2 8/-3 5/-4
# End of file
When I run this through the model tool I get this:
mesh #
# vertices: 8
# normals: 0
# texcoords: 4
# faces: 6
vertex -2.500000 2.500000 5.000000
vertex -2.500000 2.500000 0.000000
vertex -2.500000 -2.500000 0.000000
vertex -2.500000 -2.500000 5.000000
vertex 2.500000 -2.500000 0.000000
vertex 2.500000 -2.500000 5.000000
vertex 2.500000 2.500000 0.000000
vertex 2.500000 2.500000 5.000000
texcoord 2.500000 5.000000
texcoord 0.000000 2.500000
texcoord 2.500000 2.500000
texcoord -2.500000 0.000000
face
vertices 0 1 2 3
texcoords 0 1 2 3
matref xminus
endface
face
vertices 2 4 5 3
texcoords 0 1 2 3
matref yminus
endface
face
vertices 1 6 4 2
texcoords 0 1 2 3
matref zplus
endface
face
vertices 7 6 1 0
texcoords 0 1 2 3
matref yplus
endface
face
vertices 5 7 0 3
texcoords 0 1 2 3
matref zminus
endface
face
vertices 4 6 7 5
texcoords 0 1 2 3
matref xplus
endface
end
Two things that I noticed right off the bat:
1) The "vt" components of my exported obj file only have 2 vertices (assuming that these are U and V coords). I haven't figured out how to get the modeler to remedy this. I plead third degree ignorance on UV mapping.
2) The converted bzw file uses the same texcoords for all faces. I assume this is due to my modeler's obj output structure?
If anyone could enlighten me on what the "vt" component of an obj file describes, it would help a great deal. I am capable of creating my own conversion program if I know the basics of how to translate the "vt" components into texture coordinates. I am sorry for my lack of knowledge with texture mapping
Thanks!