Mastering the Basics of Unreal Engine 4: BSP Geometry
In the article before this you learned about the Unreal Engine 4 (UE4) UI, how to navigate and the basics of the interface. In this article we'll dive deeper into the game engine and you'll learn about BSP Geometry and how to use it inside of UE4. If this is your first time using UE4 it's recommended that you start with the UI article.
BSP (Binary Space Partitioning) geometry is a tool in UE4 for very basic level design. BSP geometry is used to quickly block in a level and play test the level. You can think of the BSP geometry as the place holder for the level until the art department is finished creating the assets to be used in the game. While the BSP geometry can be used for the permanent level it's really just meant to be a temporary solution at the very early stages of level design because BSP geometry is much more expensive in terms of computational performance.
The great thing about using BSP geometry is that it's easy and extremely fast to setup, you can get your basic level setup and test the gameplay mechanics as well as the lighting, and easily modify the layout if something isn't working. Once you have the static meshes created you can quickly replace the BSP geometry with the finished assets.
Additive and Subtractive
When working with BSP geometry you have two different brush types to work with. It's also important that you understand BSP brushes and BSP geometry are essentially the same thing.
When BSP geometry is created and selected the first set of parameters you'll see in the Details panel are the Brush Types. There's additive and subtractive. An additive brush is basically a solid, filled-in space, when adding elements to your level this is the main brush type you'll be using.
The subtractive brush is basically a hollow space. When you change an additive brush to a subtractive brush you'll see that the geometry becomes invisible except the edges. You use the subtractive brush to remove solid space, like windows and doors, as you'll find out a little bit later in this article.
Let's walk through the process placing a few BSP pieces in our project as well as some of the basic editing tools.
If you look at the Mode panel you'll see you have a few different options for placing elements in your game. Right now you want to be within the Place mode. The Place mode allows you place things in your project such as lights, start points, etc. It's also where you'll find your BSP geometry. With the Geometry tab selected there'll be a few different BSP options, you have the basic geometry types like a Box, Cone, Cylinder as well as couple more complex shapes like staircases. For this we're going to create a very simple room, so select the Box geometry and drag it right into the game.
Next, go over to the Details panel with the box selected and under the Brush Settings change the Y-value to 400. This will increase the length of the box.
Next, go to the Brush Settings and check the Hollow check box. This will hollow out the box with some thickness to it. By default the thickness is set to 10 but we're going to change this to 20.
Now you need to setup a doorway in order to be able to walk into the room, so with the box selected Edit>Duplicate or just press Ctrl+W. This creates a duplicate of the first box, when you duplicate something it becomes offset from the box you duplicated from, just so that you can easily see that it was duplicated. Go ahead and move it back into place directly over the first box, and go into the Brush settings and uncheck the Hollow option.
With the second box selected change the X-value in the Brush Settings to 10, so it matches the thickness of the walls.
No go to your top view by pressing the shortcut Alt+J. For this you want to move the second box directly onto the outside of the first box. So change the movement snapping to increments of 5, and move the doorway directly on top of the walls for the room.
If you go to your perspective view, the doorway should be placed like you can see from the screenshot.
With the door frame still selected go to the Brush Settings and under the Brush Type change it from Additive to Subtractive. You should now see that where the door frame BSP geometry was has been cut out making a nice doorway.
While this is looking good, we need to make it look more like a doorway, so go to Geometry Editing mode by selecting the arrow on the Modes panel.
With geometry editing mode turned on you should now see that your box has turned blue. This lets you select the vertices, edges and faces on the box, just like you would in a 3D application. What you want to do is select the vertices along the bottom of the door way, you can select multiple vertices by holding down Ctrl. You now want to move the vertices up until they snap along the floor of the room.
Now repeat this same step for the four vertices along the top of the door frame, this time you'll translate them down until it's about the height that you want your door frame to be.
Finally, you can select the entire door frame and press "R" to go into activate the scale to and scale the door frame in to make it a little less wide.
As you can tell just from doing this quick exercise, BSP geometry is a great way to quickly block in a level. By utilizing both additive and subtractive brush types you can easily create rooms and different elements in your level.
The BSP geometry really let's you get the layout of your level how you want early on before any assets are completed, through testing and iterating you'll have the levels structured finished and ready to be filled in by the static meshes.
While BSP geometry is generally only used for a game's rough level layout there are times when you can use it as permanent filler geometry. If there's a very small area on your level that needs to be filled in, like a gap, you can use BSP geometry to fill in this space without having to create an entirely new asset. If the BSP geometry is simple enough and used very sparingly it won't have a big impact on performance.
Be sure to visit the Digital-Tutors library for project-based training in Unreal Engine 4.