How do you create perfect circles and spheres?



1 Introduction



Circles and spheres are common shapes, yet, they can be rather tricky to make if you don't know or have any techniques. This tutorial will help make circle and sphere-making simple and fast of any size you want with detailed guides to go by with an organized layout. Circles are quick to make, but spheres take longer mainly from having to create all those faces. In the various images I have around, clicking on them brings a full-size version (1600x1200 pixels). To prevent unwanted stretching, I've shrunk them down to half the size via the HTML image width and height attributes. They are all PNG format which keeps true color in tact and PNG does better than JPG in compression with these screenshots.

2 Creating the perfect circle



2.1 Introduction to the perfect circle



If you were to just plot the points normally, it's extremely difficult to make that perfect circle, taking several minutes of guessing and checking. This technique allows for making perfect circles so exact that it's hard to believe! When I refer to an x-stage circle, I'm referring to the number of vertices making up the circle. An 8-stage circle is basically an octagon. A 20-stage circle consists of 20 vertices around it. The more stages you use, the more polygons you'll have, but the finer it'll look. The number of polygons used is equal to the stage number. The accuracy is based on the square. That is, if you double the stage number, your circle will appear four times finer if they're of the same size. A 60-stage circle, even filling up the entire screen at 1600x1200 is so close to perfect it's extremely difficult to pick out any "vibrations" when rotating it from a straight down view directly over the center. With how MED is designed, there are 22 circle stage values available. With a little logic and wise use of mathematics, this can be more than 50*.

2.2 Know what you want to make



Circles are the easiest things to make using this technique. Plotting the point and getting them for even a 60-stage circle takes less than a minute if you're moderately fast. Let's consider making a salt shaker with a 60-stage circle. The top part of the circle will be half as big as the bottom part, the base. In this example, 8 quants is one inch. The salt shaker's top will be one inch and the bottom will be two inches (radius; 2 inch top and 4 inch bottom diameters).

2.3 Plotting the points



To begin plotting the points, you need to change some options in MED. First, set the snap to a reasonable value. In our example, the salt shaker has a one-inch radius at the top and 8 quants is one inch on this scale which means the circle needs to have a radius of 8 quants. Set the snap to 8. For the rotational value, first, you need to know the stage number. We're going to do a 60-stage circle in this example. To find out what rotational value you need to use, just take 360 (as from 360 degrees to a full circle) and divide by the stage number. Or, for quick reference, refer to this chart:

Circle stage and rotation snap chart
stagerotation
snap
stagerotation
snap
stagerotation
snap
stagerotation
snap
3**30 (4x)*4**45 (2x)5** and ***36 (2x)6**30 (2x)
8459***4010361230
15***24182020182415
3012361040945***8
6067259041203
18023601


Table footnotes:
* The 4x and 2x relate to the number of steps you advance at this rotation level. Because MED doesn't allow for higher than 45 degree snaps, the next best is to use a lower snap but in bigger jumps. This is only needed for stage values less than 8.
** I advise against using this because the value is too small and it would look dorky, unless used on very small objects or from LOD.
*** I partially advise against using this if your circle is part of a partial cone, such as the salt shaker shape, otherwise you may get distortions or odd effects. If you really want to use it, cut the rotation value by 1/4, select the vertices in the center and rotate them one unit to fix it.
I advise that you don't use this unless you are using very large objects like a fountain.

Also, importantly, make sure the "rotation center" value is on "origin". This drastically increases the precision and it's much better than any of the other two options plus you can have your object precentered (as for collision detection using bounding boxes). This is how the options should be set (the other stuff doesn't matter at this point):



Once you're finished setting the options, it's time to plot three vertices. First, plot the center vertice at the origin. This vertex is essential later on. Then, at the top, create one vertice at either 8 or 16 quants straight up (it don't make a difference, I prefer the big one at the top) then the other size to the right. Now, build a face that connects these three vertices (which way it faces doesn't make a difference at this point). At this point, you should have something resembling this:



Now, enter vertex mode from here and use the select tool to mass-select everything (or use the select all option). Then go to edit > copy selected. Then go edit > paste. Switch to the rotate tool and rotate the object one step (where it changes it's position just once). Upon rotating you should see something like this:



Now, keep going to edit > paste and rotating the pasted object again until you form the full circle. A shortcut would be to, when you get to the 1/4 mark (except in the case of stage numbers that are not even (use half mark for these)), when the next step should place the outer vertice along the axis. When here, just mass-select everything (with select all) copy it, then paste it and attach it so that it is one step from intersecting.



Then, you can just finish your circle from here. This creates an awesome saw-blade effect and the top view in MED looks like a very interesting pattern.

2.4 Building the faces



Now it's time to build the faces. Now to clean up a little. Enter face mode again, select all and press the delete key. Answer yes to whether you want to delete the faces but answer no for deleting isolated vertices. If you accidentally answer yes to the second question, you can just undo your action and try again. Now, return to vertex mode and select all again. Select the merge option to merge the center copied vertices in exactly the same spot into one vertice. From here, begin building your faces. A finished product after building the faces would yield this. Look how good of a circle that is!



Now, to finalize the shape of the salt shaker, we'll have to move the center circle of vertices outward. We'll have our salt shaker 6 inches high, which is 48 quants in the scale we're using. Don't forget to reposition the object so it is centered for optimal collision detection. This is a view of the final result. If you were to rotate that, you couldn't even see anything in the way of distortions!



2.5 Skinning



Skinning circles is like skinning any other odd shape. When you make your skin image, it's done in any other way. What I'd do for this particular example is to change to face mode, mass-select everything at the top (from either of the bottom windows), open the skin editor, change the skin size to about 256x128 (must be powers of 2), convert it to true color, then create MD2 mapping from the top with tolerance at 90. This places a circle on your skin image. Switch back to the main MED window, and click on the invert selection tool to mass-select the rest of the model. Go back to the skin editor window and create another MD2 mapping from the top with the same tolerance. Then, I'd mass-select everything in the skin view, go to 4x mag, place the two circles right next to each other, center them, then scale them to as big as possible, but with some clearance on the sides (at least two pixels). Then, I'd use the select tool to mass-select everything in the center in the ring-shaped one then scale it down to the minimum (to prevent heavy vertical stretching). then export the image as a BMP (I like BMP files). From there, just skin your model as you'd like it. If you plan on making an ellipse (also known as an "oval"), have the skin double the width or height (depending on how you want it stretched), then, when done placing the points, reduce the skin size to what you'd normally use and go from there.

2.6 The ellipse (oval)



At this point, I don't have any effective method for creating ellipses (or ovals). The only thing available is to stretch it along the axis you want to stretch it using an action like this:

action stretch_circle2x
{
	my.scale_x = 2; // stretches the model along the x axis to twice the width, you may use scale_y and/or scale_z instead
	my.polygon = on; // enable polygon collision
}
However, instead of my.scale_x, you can use my.scale_y and/or my.scale_z as well. If you need to stretch it along the x and z axes, just add the lines as needed separately.

Just attach the action to the model you want as an ellipse. The action only runs once.

3 Creating the perfect sphere



3.1 Introduction to the perfect sphere



Spheres are, by far, the most difficult objects to make just by plotting points around and adjusting. However, using my technique, plotting the points of the sphere can be done in less than 90 seconds in most cases as the process of making them (using the only technique I have) is nearly identical to that of making circles. Afterall, a sphere is just a 3D version of a circle with its points equidistance from the center. The stage method is also the same with circles. A 20-stage sphere is a sphere with 20 vertices going around it (not the total, but the circle). Unlike circles, spheres have cubic accuracy. That is, a 20-stage sphere is 8 times finer than a 10-stage sphere and a 60-stage sphere is 27 times finer than a 20-stage sphere.

3.2 Planning the perfect sphere



Just like with the perfect circle concept, planning the perfect sphere is basically the same. Know your dimensions you want and decide which stage values to use. I would advise not using spheres with a stage value of more than 40, except for very large objects like planets. Here's a table explaining some of the relationships between the stage number, and number of polygons. The basic formula for the number of polygons is "n2 - 2n" where n is the base number. The formula only works when the stage number is even.

Sphere stage and poly count chart
stagepoly
count
stagepoly
count
stagepoly
count
stagepoly
count
3* and **44*85* and **50?6**24
8489**120?108012120
15**250?182882036024528
3084036122440***152045** and ***3000?
60***348072***504090792012014160
18032040360128880


Table footnotes:
* I advise that you avoid using this unless you're using very small objects.
** Avoid using odd numbers as they are confusing to work with and you end up with all kinds of "dents" and things. Use even numbers for the stage. The ones with the odd numbers are only estimates.
*** I advise that you avoid using this unless you're using very large objects.
These objects should never be used if you wish to make your game available to those with low-end systems, unless used very sparingly (okay in space games).
You cannot use something this big as you'll run into errors and problems if loaded directly into MED or the engine. If you really want to use this size, break it up into 8 pieces, 4 on the top and 4 on the bottom).

Let's say that we want to make a high-quality basketball (having a diameter of 12 inches or radius of 6 (radius of 48 quants) and a stage 20) on the same scaling (8 quants is one inch).

3.3 Plotting the points



A basketball's diameter is about 12 inches or so ± 1 inch. Let's just call it 12 inches. Stage 20 uses a snap of 18. Also, set the move snap to 16 (or leave it at 8). Place a vertex at the origin then place another one straight up on the top view (the top left window) at the position of 48. Switch to vertex mode, use select all, then go edit > copy selected. From here go edit > paste. Change to the rotate tool and rotate the object one step. Go edit > paste again and rotate it another step past the last one and keep repeating until you form a full circle. You can apply the same shortcut as with circles: once you get a quarter of the way around, just use select all on those objects and copy them. Then attach the vertices again from there. Up to this point, the process is nearly identical to that of making circles. However, the next part is different. At this point, we should see something like this:



Now for the part that's different. Using the select tool, form a box around the center area then delete the vertices in this area and answer yes to the deletion question. Select everything again, copy it, then paste it. Then, in either of the bottom windows (I prefer the bottom right), rotate the object in here. Paste it again and rotate it once more. Continue pasting and rotating until a circle is formed in the view you're using. You must use the same window every time or you'll get unexpected effects. Then, when you're done, use the select all feature and merge the vertices. When done, you should have something like this:



3.4 Building the faces



Spheres take extra time to build the faces. In fact, if you double the stage number, you'll have to spend almost four times as long building the faces for your object (it's slightly over 4, but not much). Because all those other vertices can be very confusing when building faces (and the more you have, the worse it gets), the hide and unhide tools on the far left come in handy for this. First, select, from the top view, the left-most vertices. You must select two columns of vertices. Then, on the left side, two icons below the "show bones" icon, you'll see something of a bluish triangle. If you were to put the mouse arrow over it, you should see "hide unselected". Click this tool to hide the unselected vertices leaving only the most important ones. Then, when you're done building the faces for each of these, use the tool positioned two below the "hide unselected" one which brings up "show all" when you put the mouse arrow over it. Click it to show all. Now advance to the next set of vertices to the left. When selecting, you should use the ones the faces were defined in previously. An example of a selection would be this:



As shown in this screenshot of my progress, you can see how I've selected the next set of vertices. One column of them has faces connected to them while the one to the left doesn't. This makes it much easier to build the faces.

3.5 Skinning



Skinning a sphere may seem challenging. You could stick with regular MDL mapping from the front or side (useful with sky spheres and sky domes). Or, in the case of a basketball, you can use MD2 mapping. Using this is very difficult, but, if you're wise, you should be able to do it. For starters, think 45°. If a surface is greater than 45°, don't include it. If you can't split it based strictly on 45°, such as in the case of 20, make the top and bottom parts the smaller ones (less than 45°), the left and right more than 45° up to where the top part went, and the front and back less than 45° taking up the remainder of the model. To figure out 45°, think of this. The rotation snap is 18, right? Between each vertice is 18 degrees. To go small, select from a deviation of 2 (36°) on each side. to go large, select from a deviation of 3 (54°) on each side. The deviation starts with the outermost edges of the objects (such as the top-most point, left-most point), etc.. When skinning ellipsoids, have your skin "squished" a little to provide more square-looking texels.

3.6 Ellipsoids (egg-shapes)



Like ellipses (ovals), I don't have a technique on how to make ellipsoids. The best alternative is to just stretch it via script.

action stretch_circle2x
{
	my.scale_x = 2; // stretches the model along the x axis to twice the width
	my.polygon = on; // enable polygon collision
}
However, instead of my.scale_x, you can use my.scale_y and/or my.scale_z as well. If you need to stretch it along the x and z axes, just add the lines as needed separately.

4 Conclusion



If you run into any problems that I haven't mentioned already, let me know. Either PM me or send me an E-mail (Go to the main index of my site and scroll to the very bottom to find the link).

If you want to see the effects without having to do them, you can download them if you want (6.62 KB).

Footnotes:
* To make a circle or sphere with a different stage value than listed on the table (the ones on the table are the easiest to work with), you need a little logic and some math skills. For example, if you want a 16-stage circle, base it off of the 8-stage circle. Then, when making your object, use the snap of 45 to form the basic 8, then, reduce the snap to either 22 or 23. When you're done positioning your object, return the snap to 45, reposition it so you can advance one step at 22 or 23, then put the rotation snap back to 22 or 23 and repeat for all other sides. For weirder values such as 26, it's more difficult and complicated. I advise using the ones listed on the table as they're quick and easy to make as well as exact. There's plenty of choices available.