Archived

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

3d models: vertices and texture coords

This topic is 5171 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i''m developing a graphic engine with its own file format i wrote an export plugin for 3d studio max, and i discovered that max holds vertex info and texture coords info in two different structs.. so when i''m exporting a mesh from max i have access to those structures: vertex list face index texture coords list textured faces index the problem is that the vertex number and the texture coords number are not the same! for example a cube has 8 vertices and 12 faces, but it may have up to 36 texture coords (it depends from how you texture it).. but obviously my engine uses a vertex format that holds the xyz coords AND uv coords for every vertex. what you think i should do? i could is raise the number of vertices, creating duplicates, until there isn''t a 1:1 corrispondence between vertices and texture coords, and then import the vertices in my engine merging the xyz and uv data.. but it''s not easy stuff to do.. and should i do this when exporting to the file (so it is faster to load later) or when loading the model into the engine (so the file size is smaller)? if you have any ideas i''m listening

Share this post


Link to post
Share on other sites
Well, think about it a bit. Your texture coords are face-specific, not vertex-specific. This means that the texture coords for your 6-sided cube must be stored with the faces, not with the vertices, as a vertex will have one texture coord set for each face which references it...

[Insert witty signature here]

Share this post


Link to post
Share on other sites
quote:
Original post by Arcibald Wearlot
hmm but i'm using D3D so i'm forced to store texture coord data into a flexible vertex format struct.. as far as i know there's no way to store texture coords into a "face" structure
Is that some requirement of D3D? OK, I think I know what you mean. You have to store the vertiecs in an array, and you have to store the texture coords in a array, to feed to D3D, right? Well, in that case, each face will have have an array of vertex indices, and an array of texture coord indices? Is this what you mean? Display lists, or something like that? Perhaps someone with the D3D knowledge could chip in here, because I work with OpenGL, and I know about display lists there, but they might be different in D3D...

[Insert witty signature here]

[edited by - iNsAn1tY on October 15, 2003 6:38:17 PM]

Share this post


Link to post
Share on other sites