UDN
Search public documentation:

ConvertingBspBrushesIsSuboptimal


Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

Building Hardware Brushes from Converted BSP Brushes is Double-Plus Ungood

Document Summary: A technical discussion of the cons involved in converting BSP Brushes to static meshes. Suitable for intermediate to advanced artists and level designers.

Document Changelog: Last updated by Tom Lin (DemiurgeStudios?), for document summary. Original author was Andrew Scheidecker (EpicGames).

Overview

Feel free to build your static meshes out of converted BSP, but I can guarantee you that it will be significantly slower than the same geometry made in 3dsmax with welded vertices/smoothing groups (or the equivalent in other modelling packages).

This is because 3D cards that use hardware T&L rely on a "vertex cache" for much of their speed. The concept of the vertex cache is that when you send a big batch of triangles to the 3d card for it to process, many of the vertices will be shared between triangles. The card takes advantage of this by keeping the last couple vertices it transformed around in the vertex cache (the number of vertices in the cache varies between cards: 16 on a Geforce 2, 24 on a Geforce 3, etc). Before it tries to transform each vertex, it checks to see if it's in the cache, and if so it simply uses the cached vertex.

Unreal optimizes static mesh data for this by ordering triangles to maximize the number of vertices the card finds in the cache, thus reducing the number of vertices the card has to transform to render the triangles.

Unfortunately, vertices can only be shared between triangles if their position, texture coordinates and normal are identical.

Position usually isn't a problem, but sometimes(mostly when you perform CSG operations in Unreal), you'll see small cracks between edges. This is caused by imprecision moving vertices slightly. When this happens the position can no longer be shared.

Texture coordinates are a little more difficult, as even if it looks like they match exactly in UnrealEd? because of texture tiling, they'll often be unsharable.

With normals, you can always use the "staticmesh smooth" command to set all the triangles in the mesh to the same smoothing group. However, you frequently want a combination of sharp and smooth edges, so it's best to set up smoothing groups in your 3d package.

Between mismatching texture coordinates and the lack of vertex sharing, it makes it very difficult to make optimized meshes from BSP geometry.

This is the same reason that BSP brushes hardware brushes don't have LODs.