Do any of you veterens have expirence with displaying and controling a 3d model with c++ programming code and maybe spicifically with vb6.0? Any literature on the subject you would like to recommend or any key words I could use with searching? How do I go about learning it? Thank you very much!
- 4 Contributors
- forum4 Replies
- 109 Views
- 8 Years Discussion Span
- comment Latest Post by punchinello
daviddoria 334
I use VTK for everything 3D (vtk.org). You ask for c++ and VB in the same sentence though - which would you prefer?
mike_2000_17 2,669
Well basically, for rendering it (displaying it) there are two main libraries, OpenGL and Direct3D. I am familiar with OpenGL, which also has a few possibly useful utility tools like GLUT (some extra functions, and cross-platform windows), GLUI (some functions for User Interfaces), and OpenInventor (for some tools to load models, display simple 3D objects and their 3D transformations). Basic tutorials for OpenGL from NEHE are very helpful to start, and it has example code mainly in C++, but also in about two dozen other programming languages.. it's all pretty much the same anyway. They will also show how to apply the translation and rotation transformations.
For moving 3D objects, there are two things to handle, translation and rotation. The former is a piece of cake, the latter can be a real nightmare. All renderers use homogeneous transformation matrices for both modelview (the motion of the 3D models) and projection (project models onto a 2D screen with a 3D look). So to learn about it, you should look into "representation of 3D rotations" and "the homogeneous transformation matrix", but I warn you, it's a bit of mathematics and geometry. I personally rely almost exclusively on quaternions for rotation, but there are options like the rotation matrix or Euler angles or Euler axis/angle which are also possible. It depends on what you want to do. For static pose of models, they are all pretty OK. If you want to do some movement (time integration of 3D rotational motion), then quaternions are the best choice by far, but they are a bit hard to grasp at first, in that case, the rotation matrix is also a good alternative.
Finally, what do you mean by 3D model? Do you want to control the movement of different parts of it and stuff? This will be quite a bit more math, look up "kinematic chains", "skeletal animation" and "rag-doll models". And techniques to render them include the old-school method of splitting the model into parts and figuring out their individual transformations, or a fancier method called "skinning" (which involves vertex shaders, a semi-advanced concept in 3D rendering). But there must be free libraries that accomplish all that already, that I am not familiar with (my knowledge of 3D game programming is a bit outdated). VTK does look very sweet!
Edited
by mike_2000_17: n/a
If you are talking about "pre-made" 3d models, such as .3ds, .obj, etc, your best bet is going to be: http://spacesimulator.net Otherwise, you can google search: Displaying .3ds with OpenGL/C++. (replace .3ds with the type of 3d file you are using)
(Please note: You are going to HAVE to learn OpenGL or Direct X at some point to be able to manipulate pre-made 3d models, or any other type of 3d models for that matter).
Edited
by PixelExchange: n/a
Sorry davi sir but I think I meant "vc6.0". Must have misspelled it. :P And thank you all! That's very kind of you! Your suggestions are so detailed and very helpful. Guess I'll try to start with those. Thanks again! :D