• Advertisement

Archived

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

Importing 3DSMAX asc files into usable geometry question

This topic is 6445 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

Ok, I am exporting data from 3dsmax 3.0 using the export ASC scene format. The format breaks the geometry into vertices per scene, and then face definitions. To create a "square" it exports 4 vertices and 2 face definitions. The problem is that the face definitions do not conform to the triangle strip method used in DX7. The face definitions tell me to connect faces 2,1,4 and then 3,4,1. The problem is that if you trace this out on graph paper you will notice that the definition tracks back over itself. How do you sort the exported file into usable data? Is there another way besides triangle strips? Thanks, webmaster@arrogantgod.com

Share this post


Link to post
Share on other sites
Advertisement
how about using trianglelist instead of trianglestrip?

Share this post


Link to post
Share on other sites
Does that adversely affect the program in any way?

I realize that triangle strips are more efficient memory wise.

The book I was using for DX7 did not mention triangle lists either. I will check the SDK for info on it.

Thanks,
AG

Share this post


Link to post
Share on other sites
I would just stick with making a list of vertices, and then an index of faces and which vertices they use. I think it will be hell trying to put the triangles into strips, especially with some of the wierd stuff MAX can do. What does it export in an .ASC file as compared to an .ASE? I''ve always done ase, never even seen the asc. Maybe I''ll mess with it...

-BacksideSnap-

Share this post


Link to post
Share on other sites
I am using Triangle Lists now with DrawPrimitive().

The only problem is that the object now renders out non-smooth.

How do I get the object to render smoothly? Will DrawIndexedPrimitive() fix this?

Thanks,
AG

Share this post


Link to post
Share on other sites
Non-smooth?, maybe its just the model(All I can think of).

Share this post


Link to post
Share on other sites
hey arrogantgod... Do you mean smooth shading? The model is going to render the same way whether you use strips, fans, or a list like you already are. If I could see comparison screen shots I might get a better idea of what you want. I''m pretty sure you''re looking for smooth shading though.

-BacksideSnap-

Share this post


Link to post
Share on other sites
I mean smooth shading. The faces do not render smoothly across one another. In 3ds max I have smoothing turned on before I collapse the geometry for export.

I have gouraud shading turned on too.

The D3DIM documentation says that if you want flat shaded models use Triangle Lists because it is a list of non-connected triangles. It says to use TriangleStrips for smooth shaded objects because it is a list of connected triangles.

The problem is that it is near impossible to convert a disconnected triangle list into a triangle strip. So there has to be another method.

The model renders out just like the documentation suggests, I can see the "facets" of the object. When running other examples using strips I dont see the facets.

How can I fix this problem?

Thanks,
AG

Share this post


Link to post
Share on other sites
Direct3D shades the Modeldata with the help of Normal Vectors, so you need to specify the correct normals. I am using the .ASC Format too, and i know that it doesn''t save the Normal information, so i recompute the necessary Normal Vectors.
This has nothing todo with strips, lists or Fans. Those are only different Ways of storing the vertexData. It depends on the FVF (Flexible Vertex Format) you are using, you need atleast the D3DFVF_XYZ and D3DFVF_NORMAL to render automaticly smoothed Triangles.

Lars

Share this post


Link to post
Share on other sites
Could you please explain how you go about computing the normals? Maybe include a small sample on doing 3 faces?

Thanks,

AG

Share this post


Link to post
Share on other sites
I know exactly how to compute triangle normals, and how to ''average'' two normals to create smooth shading across edges etc etc - the problem is I don''t want to spend a lot of time coding ANOTHER editor/convertor. (See my D3D Utilities... thread).

Surely someone must have some tools they''re willing to share?

Failing that, how would you like to help me write an X-file editor? I only need to cover 3 criteria (again see the other thread) but maybe you''ll have other needs we can incorporate too.

Later

Matt



Check out my project at:www.btinternet.com/~Matthew.Bennett

Share this post


Link to post
Share on other sites
Hi!
Calculating normals actually isn't that complicated. I do it at the time when I load the objects. For each triangle (stored in a face structure, that has three vertices in it), I use this function.

    
int findNormal(FACE *face)
{
VERTEX a, c, R;
float length;

// We sort of move the face in the origin (temporarily)..

a.x=face->v1.x-face->v2.x;
a.y=face->v1.y-face->v2.y;
a.z=face->v1.z-face->v2.z;

c.x=face->v3.x-face->v2.x;
c.y=face->v3.y-face->v2.y;
c.z=face->v3.z-face->v2.z;

// Count the cross product R of the aquired vertices a and c

R.x=(c.y*a.z) - (a.y*c.z);
R.y=(c.z*a.x) - (a.z*c.x);
R.z=(c.x*a.y) - (a.x*c.y);

// Then scale R to length of 1

length=(float)sqrt((pow(R.x,2) + pow(R.y,2) + pow(R.z,2)));
R.x=R.x/length;
R.y=R.y/length;
R.z=R.z/length;

// And that's our normal

// store it in the face struct

face->normal=R;

return 1;
}


Hope that helps, at least a little

Jarkko

Edited by - jalaine on June 27, 2000 4:25:20 AM

Share this post


Link to post
Share on other sites

  • Advertisement