Archived

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

Emagen

displaying .3ds model in Directx8

Recommended Posts

Hi I just finished my program to parse a .3ds model and I am trying to display the model in Directx. I have a simple teapot model that I want to display, with the vertices stored in a directx8 vertex buffer. I tried to display it using the DrawPrimitive function and displaying it as a TriangleList or TriangleStrip or TriangleFan, however the model looks really messed up. It resembles the teapot but the lines are not connected correctly. I am trying to display it as a wireframe first and then a solid. Can someone please help me display the teapot correctly. I know that the vertices are correct, but i am not sure how to display the model correctly. Any comments/code/links/etc whould help a lot. Thanks

Share this post


Link to post
Share on other sites
Hello!

I´m working on a similar project. Are you buiding up your 3D scene right? Do you consider the following:

- There may be several objects in a 3ds file.
- Every face or polygon have 3 vertex (9 floats). If you read the object chunk you will find the idname TRIFACE. When you fill your index buffer ignore every 4:th number couse this number isn´t a vertex number.

Good Luck!

When the stars are right they will awake...

Share this post


Link to post
Share on other sites
Um you might want to try converting the file to the standard .x format and displaying that. It''s a *lot* smaller than a 3ds file. (a simple cube is about 1k)
if you have the DX8 SDK look for the conv3ds.exe file. There is a test helper file that explains all the commands with it as well. Hope this helps in debugging the file.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I do agree that the .x file format is easier to work with than writing your own .3ds parser, but I''m not sure about the size. Every file i''ve converted from .3ds to .x has been on average about twice the size of the .3ds file. So if you can afford the size hit, opening .x files is quite nice.

Share this post


Link to post
Share on other sites
make sure that you convert to a binary .x file (if you don''t care about it being human readable). The size is much smaller than the text version. Also, if you really care about size, I have found that it is very easy to write an app that processes a .x file down to a slimmer format of your own design if you know your models always have certain attributes, etc.

Share this post


Link to post
Share on other sites
My own advice is try displaying something much simpler like a cube or square...as they are very easy to set up with simple draw primitive code its much easier to compare whats going on.

I am in the middle of making my own load and display functions for a 3ds file converted to an x file and thats how i started it.
I found a couple simple mistakes in my program that I couldnt decipher on a much more complex object. But i might guess that your triangle index is probably off.

Share this post


Link to post
Share on other sites