3D Polygon Reduction Tutorial

Chat about the Genesis project and storyline
Bradster
Posts: 542
Joined: Sat Feb 09, 2002 12:43 pm

3D Polygon Reduction Tutorial

Postby Bradster » Sat Nov 30, 2002 3:29 pm

This tutorial is meant specifically for Andy to use with Cinema 4D, but any other onlookers are welcome to follow along and ask any questions. I had mentioned in my Escape Velocity thread that your Ocean Patrol Fighter could use some polygon cleanup. This thread is going to outline why you would want to do this and the steps you would take in doing it.Part One: Why Boolean Operations Are BadAt first, the boolean tool in C4D may appear to be a godsend. It allows you to take primitives (like cubes and spheres) and objects that you may have created manually and combine them or use one to carve a section from the other. When dealing with relatively simple scenes, using boolean operands is okay. They are okay to use in large scenes too in only a few cases. When booleans are applied to certain types of meshes, they can easily increase the complexity ten-fold.Here is one such example where using a boolean can greatly increase a mesh's complexity. I needed to carve some vents in the top hinge covers on the shoulders of my Dai-X model. Here is the original mesh that I had made by hand:I added to this a single null object with 6 simple cubes as its children. I scaled them and positioned them like this:I dropped the original mesh and the null with the cube children into a boolean object. I selected that boolean and chose the function "current state to object" and then "connect" to create a new complete mesh. This is what that mesh looks like:On a duplicate file, I took the original mesh and manually knifed the polygons, deleted ones, and bridged points to points to create new polygons. This is how that final mesh looks:Then end results look identical when rendered. As you can immediately see, though, the computer's boolean calculations are quite a bit inefficient. In fact, my handmade mesh is about five times more efficient than the computer-calculated mesh. The original mesh has 44 points and 44 polygons. The computer's mesh has 936 points and 924 polygons. The mesh I made has 156 points and 182 polygons. Now, this is a single boolean operation on a relatively tiny piece of a much larger scene. Imagine how rapidly the complexity would grow if I used booleans in *all* places I need to subtract from a mesh.Sure, a few hundred extra polygons don't matter in something small like this, but when you start working with thousands and tens of thousands of polygons and your mesh balloons into hundreds of thousands and millions of polygons when using these booleans, even the fastest CPUs will slow down when it comes to the basic screen display and then rendering the raytraces.So, what are the steps for cutting into meshes like I did? I'll cover a few techniques in the next section I write for this thread. In this example, I used the polygon selection tool, knife tool, point selection tool, and bridge tool. I'll explain them along with the extrude and extrude inner tools. These are the basic tools for manipulating meshes by hand. I have built almost everything of mine that you have seen so far by using these tools alone on the basic primitives like cubes, cylinders, and spheres.(Edited by Bradster at 3:40 pm on Nov. 30, 2002)

AndyThomas
Posts: 1657
Joined: Fri Dec 07, 2001 12:42 am
Contact:

3D Polygon Reduction Tutorial

Postby AndyThomas » Sat Nov 30, 2002 4:36 pm

That's interesting and I can see why it'd be more efficient. What I found with my X-Bomber mesh was that doing a lot of that sort of detail manually was very time consuming, which is why I was thinking of restarting and at least using symmetry to make life easier. I can't immediately think of anywhere, other than the rear jets, that I used a boolean on the Ocean Fighter but I can see where I might not have minimised polys etc. Isn't there a function that can do it for you to some degree? I'm sure I've seen one in the menus somewhere...
Andy Thomas - SFXB Webmaster and Forum Moderator

Bradster
Posts: 542
Joined: Sat Feb 09, 2002 12:43 pm

3D Polygon Reduction Tutorial

Postby Bradster » Sun Dec 01, 2002 9:08 am

Well, yes, there is a function that will reduce the number of polygons in an object. It's called the PolyReduction object and it's under the Plugins menu. I only recommend using this, though, for meshes that are so complex that they would simply take too long to clean up by hand. It's a fairly intelligent function that reduces polygons based on what points are coplanar or near to being coplanar. However, in areas that deliberately include lots of detail, that detail will quickly be lost. Overall, it's a decent tool, but it still doesn't come anywhere close to matching a human level of intelligence for judging where detail should be kept or removed.

Bradster
Posts: 542
Joined: Sat Feb 09, 2002 12:43 pm

3D Polygon Reduction Tutorial

Postby Bradster » Tue Dec 03, 2002 8:08 am

Part Two: Good Modeling Techniques for Low-polygon CountsOf course, as I alluded to above with the boolean explanation, the best way to reduce polygons is to initially work with as few as possible. Prevention from the start is always easier than doing a cleanup job afterwards. The main techniques for mesh manipulation include extruding polygons, knifing polygons, deleting polygons, and bridging points to create new polygons. I'll be using the Ocean Patrol Fighter as an example for each of these methods in this part.Section 2-A: Getting Started, ExtrudingThere are really only two ways to get a base mesh to work with. You can either use a primitive like a cube or you can use NURBS to build an object from splines. NURBS is an excellent tool for creating organic meshes that have lots of curves, but the simple cube primitive is sufficient for the work I'll be explaining here.Create a new scene and add a cube object. We're going to build the majority of the Ocean Patrol's hull from that simple cube. Skeptical? Good. I was too when I followed a lesson for sculpting my first human head out of a simple cube. This should be a little easier, though. ;)Before moving into the specific instructions, let's look at how we could make this from a cube. This is how I picture the process in my head. Usually before I start working on a mesh, I sketch some ideas on a pad of paper of *how* I'll try to make it. For this mesh, the initial cube would be the center piece of the fuselage. From that, we could add on to the sides and squash them down for the intakes. Then we could add on a piece to the front and squash it into the nose. Here's a sketch of how the process will go:Fuselage:Add intakes:Squash intakes:Add nose section:final state for main shape:Get it? Good. Now, let's get to work! Double click the Cube in the Object Manager and change the height to 100 m and width to 100 m. With the Cube still selected, click the Make Object Editable button or choose Make Editable from the Structure menu or press the 'C' key on your keyboard.Now that the cube is an actual mesh, we can select and manipulate its polygons and points. Choose the Use Polygon Tool and then the Live Selection tool. In the perspective view, select one of the narrow side faces. Rotate the view to the other side and then hold shift and select this side's polygon. As with word processors and other apps, the shift key adds to the current selection; so, both sides are currently selected.aside: You'll notice when you select polygons that a small yellow dot and line will point out from the center of each. This is pointing out so show the positive "normal" of polygon. Each polygon has two sides. When working with materials, you can set a texture tag to apply specifically to the front, back, or both sides of a polygon. The normals also determine which direction is positive or negative when doing things like extrude operations. The outward-pointing line indicates that you are seeing the front side of it here. In most cases, you want to have the front side of the polygons facing out. Whenever you make a primitive editable, all of the polygons' front sides will be facing out like this by default. When manually creating polygons, though, the normals may get twisted around. You can fix this by aligning or reversing it. I'll cover the details on this later.To add a new section from the selected polygons here, we use the extrude tool. Press the 'D' key or select extrude from the structure menu. By dragging left and right in the 3d view, you can quickly pull out the new polygons. Though, you will usually want a bit more precision. So, instead go directly to the Active Tool Manager. Change the offset setting to 110 and click apply. The preserve groups box and maximum angle don't really affect what we're doing now. Those are used for when you have a selection of several adjacent polygons. When the group is not preserved, it extrudes each polygon individually. When it is preserved, they pull out in a solid group together.Go to the Coordinates Manager now with the same two polygons selected. Also, switch your view (if you are using a single view) to the front view. With the Coordinates Manager, you can scale and move polygons just as you would whole objects. Change the Y scale (and others) to your likings. I used 40 m for the Y scale. After switching to the top view, I also reduced the Z scale to 150 m. To better match the angled shape of your original model, I also switched to the side view and moved the polygons 10 m in the Y direction and 10 m in the Z direction. We can fine tune any other details later. For now, you just want the basic shape.aside: I would recommend deleting the smoothing tag from the Cube object or reducing its angle limit to a small number like 5. Since we want these ship panels to appear flat, the shadowy gradient would just be a nuisance.Switch back to the Live Selection Tool and select the front center polygon that will be extruded for the nose. Extrude it by 130 m. Then use the Coordinates Manager to scale and move it into a better position as you did with the sides. Here are my settings:Of course, you'll note that the top part of the nose is tapered in your actual image here:We'll work on that bit of detail later with some individual point manipulation. This completes the first basic phase of this mesh's construction. Rejoice!(Edited by Bradster at 8:20 am on Dec. 3, 2002)

Bradster
Posts: 542
Joined: Sat Feb 09, 2002 12:43 pm

3D Polygon Reduction Tutorial

Postby Bradster » Tue Dec 03, 2002 8:16 am

Part Two: Good Modeling Techniques for Low-polygon Counts (continued)Section 2-B: Extrude Inner and Extrusions into Negative SpaceIn place of using boolean operations, the following section will explain how to carve out the intake section from the sides of the hull using more extrusions. Before we start that, though, it is very important that we get the sides of the ship shaped exactly as they need to be. Once we start doing more extrusions, it would be much more difficult to go back and change the basic shape. After looking at that picture of yours above, I decided my sides were too high and too wide. Here is how I readjusted them:Once you are comfortable with their placement, switch to the Live Selection Tool and select the polygons that will contain the intakes, the two polygons selected here:Now either press the "i" key or choose Extrude Inner from the Structure menu. As with the regular extrude tool, you can click and drag the mouse in the 3d view to make adjustments. I am still a proponent for precision, though. So, return to the Active Tool Manager. You'll note that the options are quite similar to the regular extrude. The key difference here is that where a normal extrude pulls into the relative Z axis, the extrude inner tool pulls into the relative X and Y axes, effectively making a ring of new polygons inside or outside the previous ones.Since we want new polygons inside the current one, we need to use a positive value. Enter an offset of 10 m and click Apply. You should now have a new polygon that is exactly the same shape as the previous one but trimmed inward by 10 m on all sides.Switch to the regular Extrude Tool again. Instead of pulling out new polygons forward into positive space as with the first steps of the Cube, we need to push back into negative space. Set the offset to -50 m and click Apply.Switch to the top view in wireframe mode and you'll see how far back and at what angle the new polygons are set. If you want to move the current polygons outward a bit to better align with the opening to the intakes, now would be the best time to do so. To align them perfectly, select the inner most single polygon of the port intake and set its X position to 100 m. For the polygon on the starboard intake, use -100 m.The intake struts will be added after some knifing and bridging in Section 2-C.

Bradster
Posts: 542
Joined: Sat Feb 09, 2002 12:43 pm

3D Polygon Reduction Tutorial

Postby Bradster » Tue Dec 03, 2002 11:25 am

Oh, I suppose I should mention that I really have little idea what your level of talent or expertise is with manipulating 3D on the lower levels like this. That's why I'm covering every little mundane detail. It's just that I'm rather used to people coming to me for computer advice and saying, "okay, now explain it to me as if I'm a child." No offense intended. Just do let me know if I'm babbling on too much about things you already know.I'll write up the bit on knifing and bridging later this evening. That'll smooth and curve out the nose and add struts to the engine intakes and will end part two. Part three will basically be a demonstration of using a boolean to join two objects and then manually cleaning up the excess that the boolean created by deleting points and bridging things back together in a cleaner manner.

AndyThomas
Posts: 1657
Joined: Fri Dec 07, 2001 12:42 am
Contact:

3D Polygon Reduction Tutorial

Postby AndyThomas » Tue Dec 03, 2002 6:25 pm

I need to read through that again slowly but I wouldn't worry about it being too basic. The way I'm building things is more akin to lego in style - because I don't know how to use some of the tools I'm doing things that appear convoluted to you but which are the only way I can think of to do things. For example, your creation of the intakes is much cleaner than mine. The way I did it, simply because I'd come across it before, was to make a profile of the intake using a spline, then extruded that to the length I wanted before making it editable. I then added polygons to close off the back and the front, altered the sweep and that was it - with the addition of a symmetry function to mirror it on the opposite side.The irony is that it must look as if I used Booleans or something, but for example the nose which you've done there I did out of a single cube by dragging points around inside it etc. This is why I want to go back to my X-Bomber model once I better understand how to do things efficiently. It'll probably be less frustrating as well.Anyway, many thanks for taking the time out to put these tutorials together - they're very clear. Hope you had a good thanksgiving, BTW...
Andy Thomas - SFXB Webmaster and Forum Moderator

Bradster
Posts: 542
Joined: Sat Feb 09, 2002 12:43 pm

3D Polygon Reduction Tutorial

Postby Bradster » Wed Dec 04, 2002 2:09 pm

I was actually curious about how you made the nose. I could tell (I thought so, at least) that the wings and sides were made with NURBS and symmetry, but the nose had me perplexed.Actually, it wasn't that long ago that I was in your shoes. A couple of years ago when I started making that very first X-Bomber, I was using exactly the same techniques as you are probably using now. My old X-Bomber had over 55,000 polygons and was grossly inaccurate all over. My new one, on the other hand, has a mere 7,600 polygons and looks much better too.Oh, and thanks. I had a pleasant, mostly uneventful Thanksgiving weekend with the family. (Edited by Bradster at 5:43 pm on Dec. 4, 2002)

Bradster
Posts: 542
Joined: Sat Feb 09, 2002 12:43 pm

3D Polygon Reduction Tutorial

Postby Bradster » Wed Dec 04, 2002 5:41 pm

Part Two: Good Modeling Techniques for Low-polygon Counts (continued)Setion 2-C: Knifing, Deleting, and Bridging Back TogetherThis section covers an array of new functions; so, I'll be using lots of pictures along the way for clarification. In this section, we'll taper the top of the nose section to better fit the picture of the original ship. Section D will use the same techniques describes here, but will instead use them to add the intake struts.First, lets hide the parts of the mesh that we won't be working with for now. With the Cube (or whatever you may have changed its name to) selected in the Object Manager, switch to the Use Polygon tool and then the Rectangle Selection tool. Go to the Active Tool Manager and be sure the "Only Select Visible Elements" box is not checked. If it is checked, it will only select the elements that are immediately visible in the front; elements behind them would not be selected. We want *all* polygons in the region to be selected. From the top 3D view, select the side parts of the mesh as seem here:From the Selection menu, choose Hide Selected. The polygons vanish! We'll get them back later. Now, do the same to the polygons on the other side. You should be left with only the fuselage and the nose section. You can switch to the perspective view now and rotate around the object to see how nicely this tool completely hides the polygons. Being able to hide parts of a mesh like this can be very helpful in cases where you are working on details and the view is obstructed by another part of the same mesh.Still in the perspective view, switch to the Live Selection tool. The Only Select Visible Elements box should be checked because we only want to select the polygons immediately in front. Now, select the top polygons over the fuselage and nose. We're about to use the knife tool between these two polygons and selecting them makes sure that the knife will not go through any other polygons behind them.Switch to the top view again. Press the 'K' key or select Knife from the Structure menu. Now, click and drag the cursor over the following two places and the mesh will add points and polygons where the polygons touch.Now, select the middle four polygons and choose Untriangulate... from the Structure menu (and click OK).aside: There are two kinds of polygons you can work with in C4D: triangles and quadrangles. The latter is simply available to ease model construction by the end user. I always prefer working with quads. When the mesh is actually rendered, though, each quadrangle is broken into two triangles. The processing time needed to split them at render is negligible. Quadrangles are also advantageous if using Hyper NURBS because the Hyper NURBS function will attempt to create quads anyway.If you want your ship to be symmetrical; so, you'll need to be sure the points that you just knifed are the same distance from the origin. Switch on the Use Points tool and use the Live Selection tool to pick one of the two points. Check the Coordinates Manager for its X value. Then check the other point. I set mine at 30 m and -30 m.Now, switch back to Use Polygons tool and switch to the perspective 3d view. With the Live Selection tool, select these two polygons:This is what we are going to change in order to make the nose section narrower at the top. So, press the delete key to delete these polygons. Also, so that you don't accidentally select their points in the next step, select and hide the back and bottom polygons of the fuselage here:Switch back to the Use Points tool again. We are now ready to create new polygons with the bridge tool. With the bridge tool, you click one point and drag to a second. Then click another point and drag to another second. The tool creates a polygon that "bridges" the two sets of points. It can be used to create triangles or quadrangles. Bridges the following points in this order:Now, rotate the view and do the same to the other side of the nose. Then, rotate the view around the whole thing and examine exactly what you just did. It's just beautiful in its simplicity, no? ;)Still using the Points Tool, switch to the Live Selection tool and select the two points that make the top part on the end of the nose. To make this end narrower also, I changed the X size from 25 m to 15 m in the Coordinates Manager.We're finished with the basic shape of the nose except for one thing. Remember what I mentioned about polygon normals? One of the ways they can point the wrong direction is when you manually add in polygons. Most likely, if you added the polygons on the starboard side in the same order you used on the port side, the starboard ones are reversed relative to everything else. This happens because C4D determines the normal of a new bridged polygon based on the direction you create it. Anyhow, here's how you can check and fix that. Switch on the Use Polygons tool and the Live Selection tool. In the perspective view, select all four of the new polygons you made. Rotate the view to see if any of the yellow normal indicators are not pointing out from the hull. If any are, you can either select them manually and choose Reverse Normals from the Structure menu or you can select all the polygons and choose Align Normals from the same menu.That completes the work on the nose section. If you want to add a recess to the front for its laser, use the same extrude inner technique I explained in the previous post. To see the rest of the mesh that you hid earlier, switch to the Use Polygons Tool and choose Unhide All from the Selection menu.(Edited by Bradster at 5:43 pm on Dec. 4, 2002)

AndyThomas
Posts: 1657
Joined: Fri Dec 07, 2001 12:42 am
Contact:

3D Polygon Reduction Tutorial

Postby AndyThomas » Wed Dec 04, 2002 7:42 pm

I haven't actually tried working through it yet, but I get it.  So whereas I added a nose to the fuselage, your version actually creates the impression of the fuselage behind the nose by taking a wedge out of the perpendicular nose cone and creating the two new faces to mend the gap.  Yup, it's very neat.  I particularly like the polygon extrusion concept - I knew there had to be an easier way of hollowing out a structure or giving something walls etc, but I've tended to dive in based on what I used to know about 3D work rather than taking the time to learn the basics.  It's a far cry from Imagine for the Amiga...Additional: right, I've had a little play and oh boy would that have made life easier when I was trying to do some aspects of the X-Bomber. One question though Brad - I know in the above example you're keeping the whole thing very "together", but when would you stop doing identical things to both sides manually and start using symmetry?
Andy Thomas - SFXB Webmaster and Forum Moderator


Return to “Genesis on SFXB”

Who is online

Users browsing this forum: No registered users and 1 guest

cron