Quake 2 BSP Import
This Quake 2 BSP importer allows creating static world geometry with, i.e. TrenchBroom and a more recent ericw-tools (such as one of the 2.0.0 alpha releases from https://github.com/ericwa/ericw-tools/releases).
The basic idea is that:
- Install the package and look at
Setup.assetin Unity, which automates the following:- Install
TrenchBroom~/KVToolsTBto inside TrenchBroom’s user directory (Linux:$HOME/.TrenchBroom/games/KVToolsTB) - Adjust
CompilationProfiles.cfgto point at ericw-tools QBSP. - Copy
TrenchBroom~/KDCBSPGameRoottoAssets/of your Unity project.- Note that your game root may actually be anywhere; KDCBSP intentionally does not care about this. This style is used for easy onboarding, but more experienced users may find it prudent to treat different projects as ‘mods’ on a single game root that exists outside of any Unity project, using symlinking.
- Regardless of this,
Assets/KDCBSPGameRoot/DefaultWorkspaceConfig.assetis the hardcoded default workspace config.
- Regardless of this,
- Note that your game root may actually be anywhere; KDCBSP intentionally does not care about this. This style is used for easy onboarding, but more experienced users may find it prudent to treat different projects as ‘mods’ on a single game root that exists outside of any Unity project, using symlinking.
- Install
- Add images to the game root textures tree to add materials in TrenchBroom
- Add entries to the workspace config to add materials in Unity
- BSP files (compiled using the relevant button in TrenchBroom) are imported as prefabs.
- There are plenty of options for customizing the import depending on the situation.
Detailed Notes
- You need a dummy entity in each world ‘cavity’ you care about (at least one) so the map compiler knows the inside and outside.
info_player_startis provided for this purpose.
- Lightmapping and occlusion is not imported;
lightandvisare unused. - Entities are not really supported, but the BSP compiler may have ‘built-in’ entities. See https://ericw-tools.readthedocs.io/en/latest/qbsp.html#compiler-internal-bmodels.
- On some versions,
func_detail_illusionarydefaults to"_mirrorinside" "1". Make sure to explicitly change it to 0, or it’ll horribly break light baking!!! - If the Unity material is None, triangles will not be created. This is one of the two useful ways to use
common/sky(the other being a skybox material, perhaps with a custom shader with emission). - Special materials (note: The meanings are primarily assigned using
ericw-toolsmetadata.wal_jsonfiles):- If looking for
skip/caulk: These are Q1 and Q3 names ofcommon/nodraw. common/areaportal: Areaportals are not presently used. This is included for completeness. Ideas have been thrown around of splitting meshes by this.common/clip: Invisible collision. Distinct fromnodrawin that it has no effects on BSP/sealing/face-cutting etc.common/hint: Just manipulates BSP splitting. (We usually never care, and this is included only for completeness.)common/noclip: Extremely special custom tool for this importer, used to integrate multiple BSPs or BSP and traditional content. (See below.)common/nodraw: Invisible, but BSP compiler treats it as if it was opaque. Player can’t walk through it. Seals the map.- Use for surfaces that always face away from the player but that would traditionally still be considered ‘visible’.
- You do not need to
nodrawthe exterior of the map. Assuming the map isn’t ‘leaking’, the BSP compiler will automatically delete the exterior faces.
common/origin: Controls brush-model origin. Included only for completeness.common/sky: More-or-less regular material intended to be setup by mapper. Traditionally reserved for skybox.common/trigger: Seenodraw. The ‘can’t walk through it’ property is usually resolved by being part of an appropriate brush entity, but these aren’t supported. Included only for completeness.
- If looking for
- While most materials act as per ‘usual BSP standards’, the
common/noclipmaterial is special. It’scommon/nodrawwithout collision.- This means it:
- Still seals leaks like
common/nodraw, so you can use it at the map’s edge (which is the intended purpose) - Still cuts faces like
common/nodraw - Still doesn’t display anything like
common/nodraw - But the player can walk through it (and immediately become ‘out of bounds’ relative to the current map!)
- Still seals leaks like
- This is the ideal glue between
.mapfiles or between.mapand modelled content. - This separation may be necessary to split larger maps into individual lightmaps.
- This separation is required for occlusion culling, whether trigger-based or Unity occlusion.
- Technically, it carries
SOLID | CURRENT_0contents flags (CURRENT_0is used as a marker by the importer to mean ‘not actually solid’), andNODRAWface flags.
- This means it: