Hi all,
I exported a 8 vertex cube with a shader texture from a third party package to a wavefront Obj format.
The OBJ file contained a vt list of 42 uv pair coordinates. (see below)
I’m a newbie to opengl and learning texture mapping.
I’m having problems defining the texture array in openlg.
Currently, WIKI, Opengl has a graphic API that handles texture data in a way Carrara 5 OBJ file is not format to output. I’m a general purpose c# and c++ programmer learning graphics software rendering. I don’t want to learn custom UV mapping at this time. I know how to read the Carrara waveFront OBJ file v, vn, and f data. Also, the Material file data. I successfully parsed the obj and mtl files to render a cube with 2 difference material faces. Howerever, I’m not familiar enough to know all the ways opengl API input textures. But the most directed way is to reads in a texture map and overlay colors, in the form of an image map, at specific vertexes, or texCoord*.
So, my problem is translating the Carrara vt array in to something opengl understands. The first reply message is discussing advanced Carrara UV processing. Nevertheless, I appreciate it and will review it for future consideration. But it misses the intend of the original questions. Right now, I only want is to output a Carrara OBJ with a standard library texure and then read it in to opengl for simple rendering.
I did question this question with the follow concerns in the Carrara forum…
So, what is the uv pair in the vt export section parametizing?
Is the uv normalized range over the x, y, z span of the 3 faces vertexes?
The opengl image map is expecting a height, width and a parameter lile color to be specify in the image map.
How do the vt pairs specify the above?
Nevertheless, its really a waveFront import file question and this detial is hard to find.
The OBJ export file
Created By Carrara 5.0
mtllib Cube.Mtl
Number of vertices: 8
v 1 -1 -1.000143
v 1 -0.952445 1.000143
v -0.91973 -0.958356 0.999859
v -1 -0.905544 -0.983571
v -1 0.959717 0.999859
v -1 0.99142 -0.991999
v 1 0.95446 0.991431
v 1 1 -1.000143
Number of normals: 24
vn -0.022166 -0.999754 -0.000459
vn 1 0 0
vn -0.006256 -0.002193 -0.999978
vn 0.003075 -0.999713 0.023767
vn 1 0 0
vn -0.000162 0.004569 0.99999
vn -0.022571 -0.999745 -0.000849
vn 0.002046 0.002353 0.999995
vn -0.998354 -0.041781 0.039292
vn -0.047365 -0.998573 -0.024671
vn -0.999578 -0.021151 0.019891
vn -0.008495 -0.004443 -0.999954
vn -0.999595 -0.020734 0.019498
vn 0.004214 0.000176 0.999991
vn 0.002695 0.99987 0.015914
vn -1 0 0
vn -0.000687 0.999813 0.019324
vn -0.006252 -0.002189 -0.999978
vn -0.000813 0.99981 0.019451
vn 0.002057 0.002342 0.999995
vn 1 0 0
vn -0.004196 0.99973 0.02286
vn 1 0 0
vn -0.004072 0 -0.999992
Number of texture vertices: 42
vt 0.333333 0
vt 0.333333 1
vt 0 0.25
vt 0.333333 0
vt 0.333333 1
vt 0 0.25
vt 0.333333 0
vt 0.333333 1
vt 0 0.25
vt 0.666667 0
vt 0.666667 1
vt 1 0.25
vt 0.666667 0
vt 0.666667 1
vt 1 0.25
vt 0.666667 0
vt 0.666667 1
vt 1 0.25
vt 0.666667 0.25
vt 0.666667 0.25
vt 0.666667 0.25
vt 0.333333 0.25
vt 0.333333 0.25
vt 0.333333 0.25
vt 0.666667 0.5
vt 0.666667 0.5
vt 0.666667 0.5
vt 0.333333 0.5
vt 0.333333 0.5
vt 0.333333 0.5
vt 0.666667 0.75
vt 1 0.5
vt 0.666667 0.75
vt 1 0.5
vt 0.666667 0.75
vt 1 0.5
vt 0.333333 0.75
vt 0 0.5
vt 0.333333 0.75
vt 0 0.5
vt 0.333333 0.75
vt 0 0.5
g Cube
usemtl Texture_1
Number of Polygons: 6
f 1/1/1 2/10/4 3/19/7
f 5/25/13 6/28/16 4/23/11
f 6/29/17 5/27/15 7/31/19
f 8/39/23 7/35/21 2/14/5
f 7/34/20 5/26/14 3/20/8
f 1/9/3 4/24/12 6/30/18
usemtl Texture_0
Number of Polygons: 6
f 3/19/7 4/22/10 1/1/1
f 4/23/11 3/21/9 5/25/13
f 7/31/19 8/37/22 6/29/17
f 2/14/5 1/5/2 8/39/23
f 3/20/8 2/18/6 7/34/20
f 6/30/18 8/42/24 1/9/3
The mtl file
Created By Carrara 5.0
newmtl Texture_0
Ns 1160
d 1
Ni 0.001
illum 2
Ka 0.2 0.2 0.2
Kd 0.988296 0.445319 0.964858
Ks 0.56451 0.56451 0.56451
newmtl Texture_1
Ns 163
d 1
Ni 0.001
illum 2
Ka 0.2 0.2 0.2
Kd 0.972671 0.968765 0.078126
Ks 0.25 0.25 0.25