Texture Coords From ASE Files

Started by
3 comments, last by Jenison 20 years, 9 months ago
Ok ... I've loaded an ASE file and I've even plotted my texture coords on paper and everything seems to be in working order. However ... its not rendering correctly. Very distored texture ... and it looks like its going all over the place. What I have is a cube with a texture mapped to each side

	*MESH {
		*TIMEVALUE 0
		*MESH_NUMVERTEX 8
		*MESH_NUMFACES 12
		*MESH_VERTEX_LIST {
			*MESH_VERTEX    0	-1.000	-1.000	0.000
			*MESH_VERTEX    1	1.000	-1.000	0.000
			*MESH_VERTEX    2	-1.000	1.000	0.000
			*MESH_VERTEX    3	1.000	1.000	0.000
			*MESH_VERTEX    4	-1.000	-1.000	2.000
			*MESH_VERTEX    5	1.000	-1.000	2.000
			*MESH_VERTEX    6	-1.000	1.000	2.000
			*MESH_VERTEX    7	1.000	1.000	2.000
		}
		*MESH_FACE_LIST {
			*MESH_FACE    0:    A:    0 B:    2 C:    3 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 2 	*MESH_MTLID 1
			*MESH_FACE    1:    A:    3 B:    1 C:    0 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 2 	*MESH_MTLID 1
			*MESH_FACE    2:    A:    4 B:    5 C:    7 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 3 	*MESH_MTLID 0
			*MESH_FACE    3:    A:    7 B:    6 C:    4 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 3 	*MESH_MTLID 0
			*MESH_FACE    4:    A:    0 B:    1 C:    5 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 4 	*MESH_MTLID 4
			*MESH_FACE    5:    A:    5 B:    4 C:    0 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 4 	*MESH_MTLID 4
			*MESH_FACE    6:    A:    1 B:    3 C:    7 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 5 	*MESH_MTLID 3
			*MESH_FACE    7:    A:    7 B:    5 C:    1 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 5 	*MESH_MTLID 3
			*MESH_FACE    8:    A:    3 B:    2 C:    6 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 6 	*MESH_MTLID 5
			*MESH_FACE    9:    A:    6 B:    7 C:    3 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 6 	*MESH_MTLID 5
			*MESH_FACE   10:    A:    2 B:    0 C:    4 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 7 	*MESH_MTLID 2
			*MESH_FACE   11:    A:    4 B:    6 C:    2 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 7 	*MESH_MTLID 2
		}
		*MESH_NUMTVERTEX 36
		*MESH_TVERTLIST {
			*MESH_TVERT 0	1.000	0.000	0.000
			*MESH_TVERT 1	0.000	0.000	1.000
			*MESH_TVERT 2	0.000	0.000	0.000
			*MESH_TVERT 3	0.000	0.000	1.000
			*MESH_TVERT 4	1.000	1.000	0.000
			*MESH_TVERT 5	0.000	1.000	1.000
			*MESH_TVERT 6	0.000	1.000	0.000
			*MESH_TVERT 7	0.000	1.000	1.000
			*MESH_TVERT 8	1.000	0.000	0.000
			*MESH_TVERT 9	1.000	1.000	0.000
			*MESH_TVERT 10	0.000	1.000	0.000
			*MESH_TVERT 11	0.000	1.000	0.000
			*MESH_TVERT 12	0.000	0.000	0.000
			*MESH_TVERT 13	1.000	0.000	0.000
			*MESH_TVERT 14	0.000	0.000	1.000
			*MESH_TVERT 15	1.000	0.000	1.000
			*MESH_TVERT 16	1.000	1.000	1.000
			*MESH_TVERT 17	1.000	1.000	1.000
			*MESH_TVERT 18	0.000	1.000	1.000
			*MESH_TVERT 19	0.000	0.000	1.000
			*MESH_TVERT 20	0.000	0.000	0.000
			*MESH_TVERT 21	1.000	0.000	0.000
			*MESH_TVERT 22	1.000	1.000	0.000
			*MESH_TVERT 23	1.000	1.000	0.000
			*MESH_TVERT 24	0.000	1.000	0.000
			*MESH_TVERT 25	0.000	0.000	0.000
			*MESH_TVERT 26	0.000	0.000	1.000
			*MESH_TVERT 27	1.000	0.000	1.000
			*MESH_TVERT 28	1.000	1.000	1.000
			*MESH_TVERT 29	1.000	1.000	1.000
			*MESH_TVERT 30	0.000	0.000	1.000
			*MESH_TVERT 31	1.000	0.000	1.000
			*MESH_TVERT 32	1.000	1.000	1.000
			*MESH_TVERT 33	1.000	1.000	1.000
			*MESH_TVERT 34	0.000	0.000	0.000
			*MESH_TVERT 35	1.000	1.000	0.000
		}
		*MESH_NUMTVFACES 12
		*MESH_TFACELIST {
			*MESH_TFACE 0	8	9	10
			*MESH_TFACE 1	11	12	13
			*MESH_TFACE 2	14	15	16
			*MESH_TFACE 3	17	18	19
			*MESH_TFACE 4	20	21	22
			*MESH_TFACE 5	23	24	25
			*MESH_TFACE 6	26	27	28
			*MESH_TFACE 7	29	5	1
			*MESH_TFACE 8	30	31	32
			*MESH_TFACE 9	33	7	3
			*MESH_TFACE 10	34	0	35
			*MESH_TFACE 11	4	6	2
		}
 
the first vertecis in my array render are 0,2,3 3,1,0 ect ect then the texture coords in my array are 1,0 1,1 0,1 0,1 0,0 1,0 ect ect

			glBindTexture(GL_TEXTURE_2D, mGLTexture);
			glEnableClientState(GL_TEXTURE_COORD_ARRAY);
			glTexCoordPointer(2, GL_FLOAT, 1, mMapping);

			glEnableClientState(GL_VERTEX_ARRAY);
			glVertexPointer(3, GL_FLOAT, 0, mVerteci);
			glDrawElements(GL_TRIANGLES, mNumFaces, GL_UNSIGNED_INT, mFaces);	
 
I read somewhere that DX and ASE disagree on V coords? is this also the same with OGL? [edited by - jenison on July 2, 2003 1:42:32 PM] [edited by - jenison on July 2, 2003 1:47:27 PM] [edited by - jenison on July 2, 2003 1:48:31 PM]
Advertisement
You can not use glDrawElements() to render this data, as it uses one index to access all the array (vertex, normal, tex). The data you are sending has 36 texcoords and 8 vertex, which is why it looks messed up. To get around this i just duplicated the vertex and normal’s, and got rid of the index buffer.

I now use glDrawArray().

[edited by - FredFlint on July 3, 2003 8:44:41 PM]
that helps a lot ... thanks ...

Hi
I guess the problem you are facing has to do with the w texture coordinate. the ace you show give three texture coordinates, u,v and w. You discard the w coordinates, but in fact that coordinate affect the u,v.
This is how I fix the problem: before exporting the ace, export to 3DS and reset the scene, Then import the 3ds and then you can export to .ace. That operations will clear the w coordinate.
There must be another way to clear the w, but that works fine to me!
actually...I dont even get the W ... I wrote an export to take ASE files and convert them into something I can read through quickly.

The problem that hes saying and that I have verified is that glDrawsElements uses one index. So vertex n uses texture vertex n.

thus the number of verteci == number of texture verteci

I had 36 texture vertecies and only 8 of them were being used.

This topic is closed to new replies.

Advertisement