Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Diferent buffers in same 3D Model


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 wandersonp   Members   -  Reputation: 106

Like
0Likes
Like

Posted 22 November 2012 - 07:43 AM

Hello everyone, I´m struggling in a little problem.
I want load models exported from 3dsmax to my DX appllication.
but 3ds models have differents numbers of vertex, textureUV and normals.
like that obj file, a simple noise cube. 12 triangles, 8 vertex, 24 normals and 18 uv
I know how to load file with same size of vertex, uv and normals.

But how can I load diferent vertex buffers and combine them to a final indexed buffer to a mesh?
It is possible to do that in DX11?

#
# object Box001
#
v 0.4524 -0.4922 0.0625
v 0.4792 0.5078 0.0078
v -0.5208 0.5034 -0.0127
v -0.5476 -0.4966 0.0435
v 0.3906 -0.4820 -0.9375
v -0.6094 -0.4847 -0.9565
v -0.5934 0.5153 -1.0127
v 0.4066 0.5180 -0.9922
# 8 vertices
vn -0.0200 0.0559 0.9982
vn -0.0207 0.0553 0.9983
vn -0.0193 0.0566 0.9982
vn 0.0199 -0.0557 -0.9982
vn 0.0192 -0.0564 -0.9982
vn 0.0206 -0.0550 -0.9983
vn -0.0037 0.9999 0.0113
vn -0.0029 0.9999 0.0121
vn -0.0046 0.9999 0.0105
vn 0.9974 -0.0250 -0.0673
vn 0.9972 -0.0199 -0.0726
vn 0.9976 -0.0302 -0.0619
vn 0.0037 -0.9999 -0.0113
vn 0.0028 -0.9999 -0.0103
vn 0.0046 -0.9999 -0.0122
vn -0.9974 0.0251 0.0673
vn -0.9979 0.0194 0.0619
vn -0.9969 0.0308 0.0728
# 18 vertex normals
vt 0.0965 0.5834 0.0005
vt 0.0965 0.4166 0.0005
vt 0.2632 0.4166 0.0005
vt 0.2632 0.5834 0.0005
vt 0.4704 0.3806 0.9995
vt 0.3036 0.3806 0.9995
vt 0.3036 0.2138 0.9995
vt 0.4704 0.2138 0.9995
vt 0.4760 0.7819 0.0005
vt 0.3093 0.7819 0.0005
vt 0.3093 0.6151 0.0005
vt 0.4760 0.6151 0.0005
vt 0.6846 0.5834 0.9995
vt 0.5179 0.5834 0.9995
vt 0.5179 0.4166 0.9995
vt 0.6846 0.4166 0.9995
vt 0.8998 0.5834 0.9995
vt 0.7330 0.5834 0.9995
vt 0.7330 0.4166 0.9995
vt 0.8998 0.4166 0.9995
vt 0.4704 0.5834 0.0005
vt 0.3036 0.5834 0.0005
vt 0.3036 0.4166 0.0005
vt 0.4704 0.4166 0.0005
# 24 texture coords
g Box001
usemtl wire_148177027
f 1/1/1 2/2/2 3/3/1
f 3/3/1 4/4/3 1/1/1
f 5/5/4 6/6/5 7/7/4
f 7/7/4 8/8/6 5/5/4
f 8/9/7 7/10/8 3/11/7
f 3/11/7 2/12/9 8/9/7
f 5/13/10 8/14/11 2/15/10
f 2/15/10 1/16/12 5/13/10
f 6/17/13 5/18/14 1/19/13
f 1/19/13 4/20/15 6/17/13
f 7/21/16 6/22/17 4/23/16
f 4/23/16 3/24/18 7/21/16
# 12 faces

thanks

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31121

Like
0Likes
Like

Posted 22 November 2012 - 07:53 AM

Many model formats index each attribute separately, so you can have a different number of positions/normals/texcoords/etc in the file.
However, every graphics API treats a "vertex" as a unique combination of all it's attributes, so you've got to perform the conversion. Every model importer does this, yes.

I'm not familiar with that format so I'm just guessing, but the 'f' lines down the bottom seem to contain position/tex-coord/normal indices.
For each of those groups, you can get the corresponding attributes and output them to your vertex buffer.
e.g. for "4/23/16", write the 4th position, then the 23rd tex-coord, then the 16th normal into your buffer.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS