5. Moving our geometry over to UnrealEd
5.A: Exporting our brush objects from Blender as .t3d
5.B: Importing our .t3d brushes and adding them as nonsolid in Ued
5.C: Creating world collisions for our geometry
5.D: BSP key steps summary (optional)
5.E: Collision volumes as a more robust collision solution
Next, we'll learn to export our brush models using Colin Basnett's .t3d exporter. Afterwards, we'll learn a few extra things we should do to preserve our brush health. Then, we'll create world collisions for our environment and put them into a group so we can select, hide or modify them quickly while in UEd. At any point, if we need to make changes to our geometry, we can just edit them again in our .blend file, re-export them and replace the corresponding brushes we have in Ued. At the start it can feel a bit tedious but I think eliminating the risk of BSP holes is worth it.
Exporting our brush objects from Blender as .t3d
Make sure that all your verts are on grid, that some of your BSP is nicely separated into a few different objects (this also helps with replacing parts later on) and unwrapped.
Next, we'll give our objects names, batch exporting our brush objects will give them the same file names as their object names. With an object selected, the name can be changed in the Object Properties tab, on the top field (Also name your bounding box!)
Once you've named all of your objects, select your bounding box and all of your map geometry, make sure not to select the generic human scale reference(s) as we won't need those as brushes (and they won't have their verts on grid).
Next, go to File > Export > Unreal T3D (multiple) (.t3d) you will notice another .t3d export option on your list but that only exports a single .t3d
Now that we've exported our brushes, let's make sure our Blender project is saved and we'll open UnrealEd.
Importing our .t3d brushes and adding them as non-solid in Ued
Open UnrealEd 2.2 and then choose File > New Additive which will open a blank 'open void' map. Then go to Brush > Import
Now, for every brush you import like this (without volume), you must choose 'Non-solid (contains gaps or holes)' and ignore 'Merge faces'.
The positive aspect for this is that it slightly increases BSP health though also makes the lightmaps on poly edges a bit more noticeable.
Now we're finally going to add this to the map, select 'Add Special Brush' and choose 'Non-solid' solidity.
Then click OK. You'll probably wish to use the inwards facing polys for the fake backdrop later on so make sure they're unlit (being unlit will stop the surface from generating lightmaps and preserve some performance).
Also make sure to set the ForceViewZone flag of imported brush surfaces, as this eliminates some remaining BSP issues that can possibly crop up.
Creating world collisions for our geometry
Next, select the brush you just added then right click. Go to Convert > To Static Mesh
Then a small window should appear specifying the package as Emitter. Instead we want to change this to create a new package for our world collisions (afaik myleveling them creates a few issues with sublevels), for my own convenience I've named the package TutorialCol and named the static mesh TutBoundBox, but your naming schemes are up to you!
Now we want to SAVE this mesh package, which is something we should also do methodically before we add any static meshes into our map (just incase a crash occurs before we save the mesh package). The default mesh saving location should be ..\Unreal\Meshes, this is where the game looks for .usm static mesh packages.
Now we add the mesh to the map. We want the brush origin point to be at x: 0 y: 0 z: 0 , in other words the center of the map. With this method, we shouldn't ever need to have to actually move our map brushes after importing them into Ued, if their origins were also in the center of the 3d space in Blender then the offset geometry will always be positioned where it needs to be, and saves alot of time.
If the static mesh does get added at a weird position, simply right click on it and Reset > Move To Origin
Now if we see the static mesh surface Z fighting (flickering) with the brush, this means it's positioned correctly.
The purpose of adding our world collisions to groups is so that we can hide them in the editor on demand, and also we can select all actors in the group at once to tweak their properties.
How to hide a group in the editor
Now that you know what you need to do when importing brushes and setting up their world collisions, if these key steps are carried out correctly, your map should not have any issue with BSP problems. If you want a summary of those key steps to recap at any time, they are included below:
BSP key steps summary (optional)
Somewhat a TL;DR
1. File > New Additive
2. Import .t3d as Non-Solid (contains gaps or holes) (Ignore Merge faces)
3. Right click red-brush then Polygons > Separate
4. Add special with Non-Solid solidity
5. Set all surf flags to ForceViewZone
6. Convert each brush to Static Mesh with Slider set far left (1) always
7. Keep your new mesh package saved, especially before adding any meshes into the map
8. Static mesh collisions must be at the same position as brushes
9. Add static meshes to a world collisions group which you can keep hidden
10. Set PathCollision and BlockAISight to True in the properties of your world collisions actors.
Collision volumes as a more robust collision solution
After importing more of our world geometry and setting up their world collisions as detailed in this section, we may notice that this sometimes won't be enough to prevent players and characters glitching through the map. Normally if the player is falling at a decent speed or sliding down ramps at certain angles, the engine sometimes won't have enough updates/ticks to keep track that the player is definitely within the world, so once we consider our level more 'finished' or ready to do some playtests, we may want to start placing collision volumes in the shape of our geometry.
First we need to go back to Blender and re-open our .blend project. I think the first place we should start with is creating a volume for our ground.
If these options for our duplication operation are still up, we can make sure the X: Y: and Z: are left on 0 for each value. If we ended up doing another action which would result in this being closed, we can keep the duplicate ground selected and then change our transform to X: 0, Y: 0 and Z: 0 at the top right of the 3d view in the dock able options:
Next, we want to rename our duplicated brush object to something we'll know how to tell the difference from the original. I'll just add VolCol at the end of mine.
Next, we'll want to add volume to our collision volume mesh. We can also do this with the Solidify modifier again like we did with the bounding box. Keep in mind not to make the thickness too high to avoid cutting into other rooms (if they happen to exist where you're increasing the thickness of solidify) but it still should be high enough in certain places to prevent the player from clipping through the world collisions, in most cases 64 units thickness should be enough.
Don't forget that the visual ground mesh will now be in the same place as the collision volume, if we ever plan to change what texture one shows in Blender (or their colour) then we will end up seeing Z fighting. We might want to change our collision volume to only appear as wireframe in Blender like we did with our bounding box much earlier in the tutorial.
Now we'll import the collision volume .t3d that we just exported from Blender, we can do this the same way we imported the rest of the geometry.
With our collision volume geometry now imported as the red brush, right click on Add Volume Brush:
A collision volume will be added, you might have to hide the red brush or change it to a default cube/move it around to see the yellow wires to indicate that our blocking volume was added successfully.
This ends the tutorial.
Thanks for reading!