Computer Science Canada Cannot Generate 3D spherical Model. |
Author: | copthesaint [ Sat Mar 24, 2012 6:18 pm ] | ||
Post subject: | Cannot Generate 3D spherical Model. | ||
I have been spending the last week trying to figure out how to generate 3D Spheres for my remake of my asteroids game Ive been working on. However I am having trouble with the faces. What this class does is first get the amount of vertices for the sphere then it sets the values of x, y, and z for the vertices, then with that information it creates faces "triangles" for the points. The generator has to be dynamic so that when The Quality increases or decreases, then the amount of faces change for the sphere. I've spent alot of time trying to get just one side of the sphere to appear however I have been getting poor results every way Ive been trying to do this. This is my third time remaking this class. In the .exe Ive added, Ive changed a few of the values from below. The quality is set to 8 just so more points are created so I can show more faces, and set (quality - 2) *for creating points* to 5 just so you can see how it shows the triangles further down. I really need some help, I defiantly need another opinion.
|
Author: | Zren [ Sat Mar 24, 2012 7:58 pm ] |
Post subject: | RE:Cannot Generate 3D spherical Model. |
The keyword you're looking for is 'mesh'. And you can't really say "only use this many vertices". You might run into situations where there aren't enough, or too many. The smallest 3D shape is a tetrahedron (4 sided dice). Sphere's seem to start with a 8 sided diamond made of triangles for better symmetry though. That's probably since all the starting points are on the axes. Imagine breaking up each of it's triangles into 3 (1 new vertice in the middle) or 4 (triforce) smaller triangles. For a sphere, each point would be pushed sphereRadius away from the origin of the sphere. http://sol.gfxile.net/sphere/index.html ![]() From there, you could just randomize everything like: * radius * skip a triangles to break up (make sure you don't skip many at the higher depths) * shift the angle to the point from sphere origin a bit. |
Author: | copthesaint [ Sat Mar 24, 2012 9:43 pm ] |
Post subject: | RE:Cannot Generate 3D spherical Model. |
Ahh, I understand Thank you zren hadnt thought of it that way. I will try thanks. |