Archived

This topic is now archived and is closed to further replies.

needto

Texture coordinates...

Recommended Posts

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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites