Re: OBJ Model Texturing Problems
Posted by
Demoscene Passivist on
Nov 16, 2011; 7:30pm
URL: https://forum.jogamp.org/OBJ-Model-Texturing-Problems-tp3513440p3513685.html
The source code looks just fine as far as I can tell. For a complete example on how to use the loader take a look here (guess u have already found the example by urself):
GL2_UVUnwrap.java
Looking at the trunk of the palm tree its like that every polygon uses the same part/whole texture. So it seems the model ur loading is missing the texure coordinates for the polygons. It don't know what tool ur using to create and export the models, but e.g. if u use Blender u have to explicitly enable texture coordinates when exporting to wavefront file format.
A complete exported model with normals, texture coordinates, vertices and faces should look like this (a simple cube):
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -1.000000
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
vt 0.000000 0.000000
vt 0.000000 -1.000000
vt -1.000000 -1.000000
vt -1.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
vt 1.000000 0.000000
vt -1.000000 1.000000
vn 0.000000 0.000000 -1.000000
vn -1.000000 -0.000000 -0.000000
vn -0.000000 -0.000000 1.000000
vn -0.000001 0.000000 1.000000
vn 1.000000 -0.000000 0.000000
vn 1.000000 0.000000 0.000001
vn 0.000000 1.000000 -0.000000
vn -0.000000 -1.000000 0.000000
f 5/1/1 1/2/1 4/3/1
f 5/1/1 4/3/1 8/4/1
f 3/1/2 7/5/2 8/6/2
f 3/1/2 8/6/2 4/7/2
f 2/1/3 6/5/3 3/4/3
f 6/5/4 7/8/4 3/4/4
f 1/1/5 5/5/5 2/4/5
f 5/5/6 6/8/6 2/4/6
f 5/5/7 8/8/7 6/1/7
f 8/8/7 7/4/7 6/1/7
f 1/1/8 2/2/8 3/3/8
f 1/1/8 3/3/8 4/4/8
... the "vt" lines are the texture coordinates wich have to be exported from u modeling tool to get correct texturing.