top of page

Originally a branch of the BSP Decompiler project, the BSP Importer for Unity3D allows you to import compiled BSP files into the Unity3D engine as meshes. This allows you to build levels for Unity using a different toolchain if it fits your workflow. It also enables you to import other preexisting levels from these engines into Unity.

Levels can be loaded within the Unity editor itself, or can be loaded within a game at runtime. If loaded into the Unity editor, the meshes can be saved into the project automatically. These meshes can then be used in any way within Unity, and can be placed into a scene as part of an already existing level.

 

Entities retain their attributes from the source map, and geometry-based entities  (like doors and platforms) have their own set of meshes that are distinct from the world. The user can also hook into a callback when a GameObject is created for an entity, providing them with the attributes of the entity to use for their own purposes.

bsp importer.jpg

The process has some limitations, however. The importer uses vertex lists and surface definitions in order to build the meshes. If a mesh does not use vertices (for example, triggers rely entirely on collision data) then it will not be imported into Unity.

Some other features supported include support for Quake III's Bézier Patches. Bézier patches allow for a perfectly smooth curvature to be defined in a level and may be used for things like arches and pillars. However, in order to render these they must be run through a process called tesselation, where a series of triangles are generated that match the curve. These triangles are then rendered by the video hardware.

 

One advantage of the tesselation process is it can generate more triangles for additional detail, or fewer triangles for weaker hardware. I also use it to generate a low-poly mesh collider for the patch, while the rendered mesh may be much higher in detail.

 

The level of detail produced by tesselation is completely controllable and may be added as a setting within the game, giving control to the user.

Textures must be in JPG, PNG or TGA formats to be imported along with geometry. Any other image formats will have to be converted into one of these for use with the importer. Currently there is no support for translating shaders or materials from the original engine into Unity, however there may be rudimentary support for this in the future. Props and models are not imported by this tool, but they can be converted through other means and imported into a Unity project separately.

​

The source code for this project is currently available on GitHub and can be used by simply checking out the Git repository and submodules into Unity. It can be used with a Unity personal license, and has been tested to work with Unity 3.4.0 up to 2019.2.0a13. It depends on a submodule called LibBSP, a library I developed to read data from the myriad different BSP formats. Support for more games mostly depends on the ability of LibBSP to read their maps. As LibBSP improves and reads more formats, the importer should be able to handle them with little to no extra work.

Unity3D BSP Importer

All IPs shown on this page are the property of their respective owners and are shown here for exhibition purposes only.

bottom of page