Texture coordinates...

Started by
4 comments, last by needto 20 years, 6 months ago
I''m loading my models from an ASE file, ASCII format exported from 3DSMAX. To draw something i use indexed primitives, and each of my vertices has a U and V coordinate. But in the file is also an indexed array of texture coordinates, and the number of TexCoords is greater than my number of vertices, so one vertex can have different UVs in different faces! So how should i render to display everything correctly, maybe there is a way to create an indexbuffer for UVs? Using Direct3D8 Thanks in advance
Advertisement
You simply have to add a new entry into your indexed array. One entry for each of the TexCoords. You''ll also have to change the index itself, to reflect the new entry.

~~~~~
"Go on then" - benjamin bunny.
Download and play Slime King I.
~~~~~Screaming Statue Software. | OpenGL FontLibWhy does Data talk to the computer? Surely he's Wi-Fi enabled... - phaseburn
Thanks, that should solve the problem i think, but isn''t there some other way? It makes basically using of indexed primitives useless, because the number of texCoords is almost equal to number of faces * 3...

Anyway, can someone point me to some tutorial on that topic (loading ASE or 3DS models for D3D), i just can''t come up with an algorithm for these damn texture coords, want to see how people are doing this...
This is really the only way.

3dsmax stores position, normal and texcoord indices separately internally.
You need to split the vertices into many if there's any difference between their content.

All popular .x exporters do this (2 that i know of).
See Microsoft's x exporter source for info on how this is accomplished, the theory can be applied to any format.

-Nik

[edited by - Nik02 on October 7, 2003 2:37:55 PM]

Niko Suni

Thanks for the help guys

Anyway, i ended up using non-indexed primitives... Seems DP is not much worse than DIP

You still need to split the vertices, regardless of whether you draw them indexed or non-indexed.

I suggest drawing using indexed primitives, if you don''t have a really good reason not to use them. They save memory, and because single vertex can be used multiple times, enables on-chip t/l cache usage.

-Nik

Niko Suni

This topic is closed to new replies.

Advertisement