|
-
Sep 7th, 2011, 11:45 AM
#1
Thread Starter
Fanatic Member
3D object class.
Hi all,
I've always wanted to make a drawing program like Sketchup or AutoCAD, obviously just a lot simpler. I want to make this a long term project to be able to render the objects with a shade so that they seem 3D. I think I have been putting of this project because I don't really know how to accomplish the task of defining a curved object like a curve or ball.
My first idea was to create a structure similar to a point but it has X Y Z instead of only X and Y. Then i would create a class that represents a surface which would be an array of points(or lines) and then I would create a class that represents an object that would be an array of surfaces.
The problem with that design is that it doesn't support objects with curves like a ball. I could always divide it up into lots of smaller shapes like triangles or hexagons , but I don't really like that idea because it seems like a hack or cheating.
Any other ideas or suggestions ?
-
Sep 7th, 2011, 12:40 PM
#2
Re: 3D object class.
The reason for dividing 3D objects into triangles (or similar) is to make the calculations simple even for very complex objects.
Using equations to generate objects is implementable, and is commonly used for quadrics. But the second you need more complex objects (ie. objects that may intersect any given line more than twice), you're moving into areas, where you have to solve n-degree polynomials, in order to generate effect such as light/shadow etc.
Consider for instance an ellipsoid. It is easy to generate by the common equation. Now if we were to bend this ellipsoid, our equation would suddenly become extremely complex. Whereas bending an object consisting of triangles would be easy to implement.
Add to this gravity, lightmaps, transparency, materials etc., and you get something impossible to generate using formulae.
But very interesting results within the field of ray-tracing have been constructed using nothing more than quadrics and boolean operations upon them. Also chemical models use mainly spheres and cylinders to illustrate structures. But as a general application, using formulae to generate objects isn't feasible IMO.
Tom
#EDIT: There are also models called spatial-occupancy in which objects are divide into socalled voxels (similar to a picture and pixels). They are not used as much today - probably mainly in fields of weather-studies and similar. Most applications, I know of use triangle representations.
Last edited by ThomasJohnsen; Sep 7th, 2011 at 12:46 PM.
In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)
-
Sep 7th, 2011, 01:07 PM
#3
Thread Starter
Fanatic Member
Re: 3D object class.
If you put it like that it seems like triangle representation is the best way of representing objects. I'll do some more thinking and try implement something. If I am able to create a working example i'll be sure to put it into the code bank. I will also most likely be using XNA to render everything. I will leave this unresolved so that people can leave tips if they like.
-
Sep 7th, 2011, 01:32 PM
#4
Re: 3D object class.
 Originally Posted by BlindSniper
If you put it like that it seems like triangle representation is the best way of representing objects. I'll do some more thinking and try implement something. If I am able to create a working example i'll be sure to put it into the code bank. I will also most likely be using XNA to render everything. I will leave this unresolved so that people can leave tips if they like.
Just a headsup about XNA. Support for VB.Net was only recently added, and the vast majority of examples and source will be in C#.
#EDIT: Oh and before you start implementing you own classes for 3d-rendering, you should probably take a look at the XNA-mesh classes. If your implementation is very different, using XNA to generate graphical representaion of objects might not be the way to go, since conversions from one representaion to another could slow things down significantly.
#EDIT2: If you insist on keeping objects accurately curved, your representaions should most likely be based upon parametrized bicubic surfaces, such as Bezier, Hermite, splines or similar.
Last edited by ThomasJohnsen; Sep 7th, 2011 at 01:40 PM.
In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|