Sign in to follow this  

MESH programing

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

Hi, I have recently started programing in VC++ using DirectX. I have searched online and I am unable to find a good tutorial where I can learn mesh programing. All the places I have found that a .x file has to be loaded and manipulations has to be done only on that. I am looking for tutorial where I can create a mesh of my own with many points. I am able to design simple things like square, cube, pyramid...in 3D, but when I am thinking of extending it to many (lets say more than 600 vertices) its too hard to write a code. Can some one tell me where I can find one and if there is a video tutorial that would be an awesome place to learn. Thanks in advance.

Share this post


Link to post
Share on other sites
Data driven programming is a skill that I think will serve you quite well during your game programming endeavors. I would highly recommend using a program like Blender: Blender to make your 3d models and then load those into your game.

Basically you need to use a modeling program to create your 3d models. These models are saved as files (either binary or text) and then loaded by your engine. If your using a low level engine then usually some formats (like .X afaik) will be supported out of the box, but other formats will require you to write loading code (or use an existing lib/code base).

There are many other programs than Blender for 3d modeling, and some people don't like Blender because of its user interface. However if you take time to learn it and learn the hotkeys, then it is one of the "best" (good feature set, lots of output and input formats, well supported and well documented) free 3d modeling programs out there.

Share this post


Link to post
Share on other sites
Usually for models that are not geometric primitives, people use 3D modeling programs that enable them to manipulate vertices, textures etc. and save them into files which can be loaded into your program.

The problem is that different programs have different file formats in which they save information about the model. For example, 3DS max is a program that saves models as a .3ds file which a lot of people convert to .X files that can be easily used with DirectX. You just need to choose a program and format to work with.

There is no need to manually program vertices of a complex model, as programs have been made so you can manipulate this data visually and save it in a file to import to your program.

Share this post


Link to post
Share on other sites
Hey thanks for your reply,

yeah I have got that part. What I am trying to do is, taking few values (voltages) which I get from a camera through a data acquisition board. And trying to plot those values as a mesh terrain (3D) using DirectX. So I am not sure whether converting those values into .x files first and then loading them would actually work!!??

Is there a way where you can directly convert some of the given points in a .txt or .doc or .xls file to a 3D image in DirectX.

Thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by garywillams
Is there a way where you can directly convert some of the given points in a .txt or .doc or .xls file to a 3D image in DirectX.


Do you want to actually save the points, or just display them in real time?

If you want to display them in real time, have a look an any beginning tutorial to see how to manually draw polygons. It's really straight forward.

If you want to save them, just create a simple binary file that contains a count of polygons and 3 points per polygon, each point contains an x, y, and z floating point value. This isn't the most optimized solution, but would allow you to quickly load up a saved data set. Once you have this working, expand it to support triangle strips.



Share this post


Link to post
Share on other sites
Quote:
Original post by garywillams
Hey thanks for your reply,

yeah I have got that part. What I am trying to do is, taking few values (voltages) which I get from a camera through a data acquisition board. And trying to plot those values as a mesh terrain (3D) using DirectX. So I am not sure whether converting those values into .x files first and then loading them would actually work!!??

Is there a way where you can directly convert some of the given points in a .txt or .doc or .xls file to a 3D image in DirectX.

Thanks


Really any model format is just a bunch of numbers specifying the polygons for the model. You would just need to take your data and write a custom loader for it. One place to start might be to look at some terrain generators because they usually take a height map and generate 3d mesh data from that and it might be close to what you are trying to accomplish.

Share this post


Link to post
Share on other sites
Thank you all for your replies,

yes, I have used similar concepts and wrote a program. I used triangle strip and also triangle list separately.

Thats a big pain to tell DirectX about each and every pixel. As its a 3D programing, it becomes more laborious to write what are base vertices and what are sides.... Moreover as the values will be generating in real time, I have found that it is hard to tell DirextX about all those points.

So, I am looking for a function or algorithm where I can plot a mesh with more than 600 vertices.

For example, I am trying to create a mesh of the shape Gaussian function. In order to make it look a bit smother curve it took me 400 vertices and wrote a code using triangle list. Which is not advisable :( to write such a lengthy code. Is there any solution to make this code look simpler!!


Share this post


Link to post
Share on other sites
You're using loops and stuff right?


//psuedo code
for (int i = 0; i < pointCount; ++i)
lineStrip.PushPoint(dataPoint[i]);

DrawLinesTrip(lineStrip);


As you can see, these 3 lines of code scale pretty extensibly with the size of the data set. Be it 5 points, or 5000 points.

Also D3D has no problem drawing hundreds of thousands of triangles and lines.

Share this post


Link to post
Share on other sites

This topic is 3047 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this