[Mapping] Making circles of any radius

Started by vampirefrog, March 18, 2009, 06:33:40 AM

Previous topic - Next topic

vampirefrog

Intro

Hi all! I'm writing a series of articles about sauerbraten editing.

If you're just starting to build/edit in sauerbraten, i suggest reading the intro here. Eventually we might even write a new, more up-to-date and smoother intro to sauerbraten.

If you have comments/suggestions, feel free to post replies, and I will try to update the tutorial(s) for maximum learning benefit.

Before you start, you might wanna set sauerbraten in windowed mode. To do this, type /fullscreen 0
    right after starting sauerbraten. Then move back and forth between the "sauerbraten engine" window and the browser with
ALT+TAB.

I'm going to describe the techniques I use to make circles in sauerbraten. I call them circles, but in fact they're cylinders, because they're in 3D.

First, let's look at the ways in which you can make a circle:

  • By eye
  • By using a helper texture
  • Using mapmodels
Making circles by eye

To make circles by eye, you need a bit of patience. You only need to make one eigth of the circle, then you copy it around to make a quarter, then you copy that quarter around four times to make the circle. Let's try one out:

Let's start with 3x3 cubes. This will be a quarter of the circle, and later we'll copy it around.



Now select one of the vertical edges by middle-clicking and dragging.



Now turn your mouse wheel up two times:



Now let's select and delete the other cube:



Now let's select the edge of the middle cube:



And turn mouse wheel up to move it all the way:



Now we have an eigth of the circle. All we have to do is copy it around:

Select:



And copy it somewhere away from the original. A few cubes away is fine.



Now be sure the upper face of the selection is selected (right click on it), and then press R+scroll to rotate it 90 degrees:



Now you'll say "yay! the other eigth is done too!". NO!. Remember this rule, it always applies when you're making one eigth of the circle and copying it around: you rotate, then u flip on one of the axes. You have to look carefully to figure out which axis to flip on. In our case, we select the side shown in the image below, then press X to flip it:



And move it in place of the cubes textured blue (on the right):



And NOW we have a quarter of the circle:



Use C and V to copy and paste, and duplicate it once:



Now you have two options: since the selection is square, rotating it will not cause any damage around, so you can use R+scroll until it comes into place, or you can select one of the sides and press X to flip it once. In practice you can use both, but remember that when editing tight places, rotate is dangerous. If you go wrong you can always press U to undo (and I to redo). I'm going to flip it by selecting the side shown below and using X.



Now we have half of the circle:



And we need to copy it:



And flip it (like we did with the quarter). Now we should have a basic circle:



Now what does that look like?



A circle? WRONG!! Let's look at it at a different angle:



That's not a circle! That's a frickin rounded-off square! We're making a circle by eye here. Sure, what we have so far might work, but the finer eye will notice that it's not a real circle. Of course, you can't have a real circle, since you have to approximate it with polygons. Furthermore, you can't use too many polygons. If you use the same circle over and over, and it has a lot of polygons, the FPS will surely go down. Well, that being said, what's left for us to do in our example? Well, make it more like a circle by fine editing it. Use middle-click to select edges and bring them a bit closer to the center of the circle, until you think it's better. Note that you only have to do this on one quarter of the circle, and then copy it around, just like previously discussed. Let's look at what my results were:



Looks a bit better, but you can still notice that it's a bit square. It's not perfect, but it's alright for now. We're going to learn how to make circles that are more accurate a bit later.

It is time to save your map. Type:[/list]/savemap circles. I recommend working on the same map, so you will know where your circles are. Later on, you can copy the circles from this map, and paste them in the map you're working on.

Now you might ask, ok, what if i want a bigger or a smaller circle? Well, in a similar fashion, use patience and your eye to "carve" it out of a square.

Here's another circle, as a bonus:

Begin with 4x4 cubes:



Next up, select the indicated edge with middle click and drag:


Scroll the mouse wheel twice up, to bevel the selected cubes by two units:



In the same fashion, select the remaining edge and move it all the way:



Now go around and select the indicated edge:


And bevel it by two units, just like you did above:


Now you have a quarter of the circle:


Copy it around:


And there you have it, a very simple circle:


Here are some more example images:



Don't be impressed! These can all be done with patience and refinement of the initial result.

Making circles using a helper texture

When u ask someone in coopedit 'how do u make a circle', the guy will say something like 'with practice and patience'. Well, that might be true, but you also might use a few extra tools.

While trying to make circles that are closer to roundness, I got the idea of using a helper texture -- that is -- if the surface you're working on has a texture which is the image of a circle, then it is possible to shape the cubes along the circle. That proved to be most useful.

Let us now make a circle texture. We can use either Photoshop or GIMP or whatever you wish. I used a php script to generate a 512x512 png image with concentric circles:



Now we're going to be using custom textures, so I recommend you keep them in your own folder. I use a folder called vfrog, and I'll be using that for this tutorial. So right click on the image and Save As <your sauerbraten installation directory>/packages/vfrog/circles01.png.

Now that we have the image in the game directory, we can easily access it from inside sauerbraten. If you're already running sauerbraten, you don't have to restart it.

Type:
/texture 0 "vfrog/circles01.png"

Now press F2 to see the texture list, and go to the last tab, and you should see our new texture:



Now that we have it, we should start using it. First, let's see what the texture looks like in game:



We can use any radius, and any gridsize. Let's try a 5 cube radius (a 10x10 sphere). We begin from the center, and we select a line of 5 cubes:



Now we extend the selection so it's 5x5 cubes:



Now let's raise it. Press 7 to see the grid lines:



Now we don't need the background texture, so let's change it to something else:



Now let's begin shaping around the green circle:

Select the edge shown below, and scroll up until the edge of the cube is nearest to the circle contour. In this case, scroll up once:



Now move on to the next edge. Scroll until the edge of the cube is closest to the edge of the circle (in this case, scroll up three times:



We repeat this action until we have one eighth of the full circle.

Scroll the next edge all the way:



Now remove the two extra cubes:



Now you can scroll the next cube all the way:



And now you have 45� of one circle, or one eighth. Copy it around so you get 90 degrees, like I showed you earlier:





Now copy the quarter circle around, to make a full circle:





Now that's a pretty nice circle:



Okay, now I'll show you another method, which includes quirky cubes. Basically this means you're going to be deforming cubes in such a way that they make a good circle/cylinder, but they leave a hole. This hole can be ignored, if the inside of the circle is never visible. I find this technique to be quite useful. I've been using it for a while, and it allows you to make more perfect shapes, like spheres and donuts and many other shapes, which usually would be impossible to make without using quirky cubes.


To be continued l8r

jammerx2


Apollo

Vampi, If you want I could make a tutorial on domes.
Id make sure it was good.

If I could rearrange the alphabet, I'd put your sister and I side by side.

Heav’n hath no rage like love to hatred turn’d, Nor Hell a fury, like a woman scorn’d.

jammerx2

I would like a tutorial on domes, it would help me make spheres that actually look like a sphere.