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


Supporting multiples vertex formats

Recommended Posts

Hi, I am currently working on my own 3dmodel formats (file and class/struct). However, I encountered the following design problem and I am seeking opinions about this since I don''t know what to do exactly. Also, maybe someone can point me to a better direction! Let''s say I have a 3dmodel that uses vertices holding the following information: X,Y,Z, NX,NY,NZ, TEX1_U,TEX1_V, TEX2_U,TEX2_V // for multi-texturing For hardware that supports multi-texturing, it''s all fine because I just load my 2 textures in 2 texture stages and pass the vertices above since I can set my FVF. However, when I can''t use multi-texturing on hardware, I''ll need to separate the data into two sets of vertices (one for each texture) thus replicating a lot of data. I am wondering if it wouldn''t be better to make up on the fly 2 DX FVF vertices using my own vertex format (the one above) every time I need to render. Thanks!

Share this post

Link to post
Share on other sites
Can you use the same set of vertices? I just ask this, because it would be easy to do what you are asking by setting your texture stages.

Device->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1);

This means to have your second texture stage read the second Tu and Tv. So if you have like,50,50);

The texture stage state would read from the second set!

Hope this helped!

Share this post

Link to post
Share on other sites

First of all, thanks for your reply...

Using multiple texture stages is only possible on hardware supporting more than 1 texture.

Maybe I need to specify that my mesh class is internally (to store the data) using a vertex format that''s matching the number of textures layer for the mesh... i.e. a mesh with 1 texture layer would use X,Y,Z,NX,NY,NZ,TEX1_U,TEX1_V while a mesh with 2 texture layer would use the same plus TEX2_U, TEX2_V. This implementation could be changed if needed of course...

My question is about how to deal with vertices data when falling back to multi-pass...

Should I "split" all meshes'' vertices defining 2 text. coord. sets into 2 "independant" vertex using each one 1 text. coor. set (thus duplicating a lot of data -> X,Y,Z,NX,NY,NZ)


Should I keep my meshes'' vertices intact and make the needed FVF vertex to feed DirectX (a mesh vertex will "generate" 2 DX FVF vertex for 2 pass rendering).


Share this post

Link to post
Share on other sites
No, you are not getting the point!

You do not have to use multiple texture stages at all with what I told you!

You just do this


This is only 1 texture pass!

Share this post

Link to post
Share on other sites