Bounding Tutorial

Anything to do with Drakan level editing and modifications, post it here! Also this is the place to tell us about your new levels and get player feedback.
Post Reply
User avatar
shoprat
Dragon
Posts: 150
Joined: Thu Jun 07, 2012 8:52 pm
Location: USA

Bounding Tutorial

Post by shoprat »

Bounding Tutorial

Unfortunately the [Tutorial.zip], [Sword.zip] the example pictures weren't archived with the text of the post. If you make a simple cube with the modeler, you should be able to use that as you follow the bounding example. If the cube is to be put in the level, you may want to reconsider the bounding order. For example, if the player will never touch the sides (as in a custom stairstep / rectangular slab) it would be better to bound the top as the MOST likely collision surface.

-------------------------------------------------

Love it or hate it, you still got to do it. Bounding, admittedly, isn’t everyone’s favorite thing to do, but it’s critical to game play. Bounding models enables the engine to detect the boundaries of your model/s, providing the player with accurate collision response.


EDIT____

Size/Position – Similar to model frame, but this will allow you to size and reposition your bounding spheres and boxes for a perfect fit.
Build Polygon List –
Generate Parent –
Generate Midpoint Sibling –
Copy as Sibling - Copies the selected bounding box or sphere as a sibling.
Move Up -
Move Down -
Delete Reassign Node –
Recompute Main Bounds – Resizes the main bounding box or sphere to encompass the entire object.
Align Box to Poly Normal –
Bound Selected Polygons - Places a bounding box/sphere around the selected polygons
Snap to Polygons -
Bound Boxes/Spheres – Toggles between bounding boxes and spheres


SELECTION____

Selected –
Hidden –
Select All –
Select None –
Select Children –
Show All – Renders all bounding hierarchies, even if they have been previously hidden.
Show Children –
Hide All –
Hide Children –
Expand Tree –
View Child Boxes as Solids – Using this can help you determine if you have properly covered the object you are bounding.

---------------------------------------------------

BOUNDING 101 - MODELS

Make sure you have the [Tutorial.zip] file downloaded and you've completed the texturing tutorial.

There are several types of methods when bounding models, or REO's. Bounding for characters, or REC's, is a different process and we'll cover that later. Models can be bound with either spheres or boxes.

In the following tutorial you will bound the arch you just textured in the texturing tutorial for placement in the game. To understand the basics of bounding you must first understand the nature of hierarchies. Creating bounding is creating a hierarchy of boxes or spheres that the computer will use for collision information. If your bounding does not cover your model correctly or you have problems with your hierarchy then you will not get the proper collision response in the game. There are rules and tell tell signs that will let you know if your bounding is correct. Study this tutorial carefully and bounding will be a piece of cake.

Why bound? If the computer had to check every polygon at every frame in the game the frame rate would be so slow the game would be unplayable. Creating bounding for objects enables the computer to check only those objects that are colliding and forgets about the rest. You can think of bounding as force fields in a way. Collision is only considered once a models bounding, or force field, has been penetrated.

Just a few quick notes:

Bounding Boxes do not collide with other bounding boxes. Bounding spheres can collide with other bounding spheres as well as bounding boxes. Translation: If you want to make new weapons for Drakan, bound the weapon models with spheres. Basically anything that is going to move in the game needs to be bound with spheres, like weapons, characters, boulders, barrels, etc. Houses, trees and other inanimate objects need only bounding boxes. "No what I'm say'n?" (In your best Sopranos accent)


Step 1____Surveying your model

Before jumping into bounding your model you must first create a plan of attack. It's important to review your model so you can approach the bounding process with the most efficient method in mind. Also make sure you have open the bounding window and have it arranged on your desktop so it can be referenced easily. Check out the Layout section under Surreal.Modeler for a reference picture on how to arrange your desktop. Our goal here is to have the character be able to walk through the arch but stop when hitting the walls. Lets start.

Step 2____Bounding from the top down

Under the Edit menu in the bounding window select "Bounding Boxes".[ Example 1.] You may notice the main bounding hierarchy change from a dotted sphere icon to a dotted box icon. If you enable "Show All" under the "Selection" menu in the bounding Hierarchy window you will see a box that outlines the entire arch. That is the parent bounding box that we will be adding children to. If you select the dotted box it will turn yellow and the box will highlight yellow in the 3-D view. This is helpful when you are reviewing you bounding.

When surveying our model we want to determine want is the least likely area the player will come in contact with and bound from the least likely polygons we may collide with to the most likely. In this case the top of the model is the least likely we will collide with, so we'll bound that first. Select the Top polygon on the model and the top most polygon on the underside of the arch. Why only these two? To have the bounding boxes align accurately to the area we are trying to cover it's always best to select the least amount of polygons. The top polygon provides enough information for the length and width while the lower polygon provides the depth.[Example 2].

Next select the parent hierarchy with your mouse in the Bounding Hierarchy window. You want to select it by clicking in the coordinate area next to the dotted box icon. A parent is selected when the coordinate box turns blue, like the box in the Example 1 picture. Now hit "c" on your keyboard. As we read earlier "c" is the keyboard shortcut for Bound Selected Polygons under the Edit menu. Your file should look exactly like the one in Example 3, and your hierarchy should look like Example 4. You just created your first bounding hierarchy. The bounding box you just created is the child of the box that surrounds the entire object.
[Example 3. Example 4.]

Moving on to the next bounding box we should select the 3 polygons that make up the inside of the arch and the center polygon that reaches from the arch to the upper corner of the box. Select the parent bounding box (the top of the hierarchy) and press "c". Your Cube.reo should now look exactly like the ones in Examples 5 and 6. Repeat the process on the other side of the box and well move onto bounding the sides of the arch.
[Example 5. Example 6.]

Now select the polygon that covers the outside length and width of the arch and the polygon on the inside parallel to the outside. Select parent hierarchy and press "c". Your file should now look like the ones in
[Example 7 and 8.]

Repeat the previous step on the opposite side of the Arch to complete the bounding. Great, your done. No lets revue the process a bit so we understand what just happened. In example 9 we can see the arch with completed bounding info, and our hierarchy is set up so the sides of the arch are first in the list while the top is at the bottom. Why does it matter what order the hierarchy is in? Well, it's just more efficient for the engine to determine what part of the model is being collided with so it doesn't have to check every poly in the model.
[Example 9. Example 10.]

Step 3____try it out in the game

Now for the final test load the model into the level editor and place it in the game. You may have to scale up the model in the level editor, but you should be able to run through it without a problem.

How do I know if the bounding is correct? Well, the most obvious of course is that you wont be able to penetrate the object. Another good test is what affectionately call the "camera freak out effect". Many time when the in-game camera zooms in close to Rynn's shoulders it's because she is colliding with something and the camera is having a hell of a time working out which way it should go, so the safest place is over Rynn's shoulder. If your camera "freaks out" like this when you approach an object then you know you need better bounding. Often time that means going through and conforming the bounding closer to the geometry.


BOUNDING LESSON #2 - WEAPONS

In this tutorial we will bound a weapon using spheres. As stated previously using spheres is the only way to bound moving objects in Drakan. Bounding with spheres is easy so enough with the intro, let's dive right in!

Download the [Sword.zip] tutorial, load up the modeler and follow along.

Step 1____Surveying your model

Note this is the same process we followed with the first tutorial. It's always best to get an image of the bounding in your head before diving in. When bounding weapons we want to think simply. A large parent sphere with as few children as possible will do the trick nicely. Take a look at the screens below, this is what we all should be seeing.
[Example 1.]

Step 2____Creating child bounding spheres

Select the main bounding sphere in the bounding window, the sphere icon should highlight yellow when selected, and copy the parent sphere (press "ctrl c" on the keyboard). You will notice another parent sphere has been created below the original. We want that to be our first child so click and drag the lower bounding sphere on to the top, all in the bounding window. You have just assigned a child to a parent. Your hierarchy should look like the one displayed in [example 2.] Now we want to resize the child so right click on the sphere in the bounding window and select size/position. Input the numbers you see in [example 3] and your model should look exactly like [example 4.]

Ok. Easy. Now we want to create another child so select the smaller bounding sphere under the main parent and hit "ctrl c" on your keyboard to copy the child. You hierarchy should now look like the one in [example 5.] Let's move the child on the top of the list to the tip of the sword blade. Again right click on the bounding sphere in the bounding window and select size/position. In the Z direction type in .19 and you will see the child sphere move to the end of the sword blade. You bounding spheres should now look like the ones in [example 6.]

The last step is to fill in the gap created by the sphere at the base of the sword and the one at the end of the blade. With the two children selected. Both sphere icons highlighted as in example 5, right click and select select "generate midpoint sibling". You'll see a third sphere created between the two previous spheres, but it put the new sphere under one of you child spheres and we don't want that. So select the new child sphere and move it onto the main parent by clicking and dragging. You new hierarchy should look like the one in [example 7]

You're done! You bounding info should now look exactly like [example 8.] Save your model.

Step 3____try it out in the game

Load your new model in the game and enjoy. As in Lesson # 1 you'll know if you have the correct bounding information because you'll be able to collide with other objects in the environment. And in the case of a weapon you want it to be good. You may have noticed that the bounding spheres that cover the sword are significantly larger than the blade itself. When bounding other objects in the game we want our bounding info to conform much more to the actual shape of the object, but with weapons we need to be concerned about collision and the way to make sure our weapon collides with other objects is to make the bounding information bigger.

Post Reply