As a person that has a lot of passion in making video games and as a person that is going for a bachelors in game programming, one of the things I've always question myself out of curiosity is how complex is it really in creating bounding boxes for a model. After taking the course "Physics with Programming" as a future game programmer, a lot of things came up to mind as I learned about how in depth you can get with collision detection and collision resolution. One of the things I remember asking in my Physics with programming class was if we had a polygonmesh, would it be possible to detect collision and resolve collision for that polygonmesh with considering every single polygon on that model? Now as you begin to think about the question you have to consider how complex of a model where talking about because in the game run loop, with every tick you're checking for collisions. Considering this you can see if we have a deluge of polygons on a model, it could potentially slow down the processor on your computer due to the high volume of frequent collision checks. Due to this reason, we create bounding boxes for our models.
Now you may ask yourself what is a bounding box and how is this suppose to relate to 3ds max? Well first off, a bounding box can be a simple shape or multiple shapes that cover an object. These shapes that are used to cover the polygonmesh are typically for collision detections. So as you can see with something like this we can prevent a number of collision checks occurring in the game run loop with using bounding boxes. The whole point of a bounding box is to be used for collision detections as well as be used for simplifying the amount of collision checks in a game run loop. After learning about this is my Physics with programming class I begin to question, well how do we even create bounding boxes for a model? Somewhere in Unreal Engine 3 I remember that they had a built in automatic system that creates bounding boxes for you.
As you can see above, the green line that forms a box is the bounding box that covers the static mesh, being the door. In the second photo you can see Unreal's built in system that allows you to create a very simple bounding box for your model. Which is cool and all but it creates some issues. Some of the issues going this route where you decide to use Unreal's built in bounding boxes are that you won't get as precise bounding boxes that match your model. So, have you ever played a game before where you collide with a wall or fence and it looks like you're not even touching the wall or fence yet? Well the reason behind this is because of the way the bounding box was set up. As you look at the picture's above you can see how our simple bounding box is literally a box which creates a problem for our door because our doors shape isn't a box. Looking up at the top right and top left corners of the door, there's a huge area where the bounding box covers. So if for some crazy reason a player manage to hit those spots (oddly enough) it would look unrealistic because they would be hitting a random area of space and not the actual door. Due to this reason, you typically want to create your own bounding boxes using 3ds max because then you can get as precise as you want.
Now crazy as this is going to sound, I didn't think it was going to be this simple but it is. Creating bounding boxes on 3ds max is insanely easy and I really want to emphasize on that. From taking my Physics with programming course I was thinking things were going to get really complicated but it doesn't! Let's say you created a model on 3ds max and give it a name such as "ToonTree". All you have to do is literally make shapes covering your model to what you think best fits and name those shapes "UCX_ToonTree". So those bounding shapes you creates should have the name of the model you made starting with "UCX_".
After that exporting and importing, Unreal Engine 3 recognizes these shapes as bounding boxes, so when you import into Unreal, those shapes you made to cover your object won't appear but will be there as bounding boxes. The great thing about going this route is you can literally make these bounding boxes match the shape of your model as close as you want. You basically have more control. Another great thing is the fact the these bounding boxes can be illegal geometry and overlapping each other. So you don't have to worry about man.... Gotta make sure these stay as quads or triangles.
The first model I made with bounding boxes on 3ds max was actually a cartoonish tree.
When making the bounding box, I purposely tried getting it to the shape of my model as close as possible to give me some practice although my model was 164 polygons.
Now keep in mind, when creating bounding boxes, you don't want to go crazy with the polygons and you definitely don't want to grab a character model's polygons and hold shift while scaling to create an exact copy letting that be the bounding box. When creating bounding boxes you want to keep in mind that it should be not high on polygons. One of the things I do recommend is when creating models, definitely do some experiments when creating bounding boxes, have some boxes overlap and even try to make a bounding box match your shape in the least amount of polygons. Doing so will allow you to become more of an expert in creating bounding boxes for models.
No comments:
Post a Comment