Overview
A detailed guide on how to fix your map’s cubemaps being broken (or completely black) in the most recent Source engine branch (such as Episode 2, etcetera).
Introduction
Since the conversion of Episode Two (and other Source-based games) to the most recent engine branch – the one running on SteamPipe – attempting to build cubemaps for a map may result in the cubemaps not being saved properly, or always appearing as black.
This happens (as far as I am aware) because of there already being cubemap textures in the map when it is compiled – they are, however, completely black. We can fix the problem by deleting these textures, and then building cubemaps (thus they then save properly).
Forewarning
You should only use this method if building cubemaps in whichever branch of the engine you’re using isn’t working.
If you’ve compiled your map with -StaticPropLighting, this method will unfortunately remove any shadowing on props and have their lighting revert to origin-based. I’m not sure why this happens, but it’s infuriating at best.
Compile your map
You may compile your map as you would normally – and if you wish to have HDR on your map, ensure that you also compile with HDR lightmaps.
Download PakRat
PakRat is a Java utility that can inspect the contents of a BSP file. We’ll be needing this to look in the BSP file and delete the existing cubemaps so that the engine can therefore write to the map with your actual cubemaps.
You can download PakRat here.[www.bagthorpe.org]
Open up your map in PakRat
Navigate to where your compiled map is (this is usually in ep2/maps/), and open it with PakRat.
You should (hopefully) be start at the window where you can inspect your map’s contents.
Delete the pre-existing cubemap textures
Scroll down until you can find a bunch of VMT files that have numbers (actually world co-ordinates) in their name, and delete them.
Again, scroll down even further until you can find a bunch of texture files that seem to have numbers (actually world co-ordinates again) in them.
These are the offending textures, and if you are to open them up inside PakRat, you can see that they are nothing but completely black. We want to get rid of these – so select them all and click the ‘Delete’ button.
Optionally, if your map is HDR enabled, make sure you look for and delete similar looking textures that have the ‘.hdr.vtf’ extension instead.
Save your new BSP file
Make sure to go to File and select Save BSP; your changes are not saved to disk automatically. Ensure that you save with the same name.
Preparation for building cubemaps
Before you actually get around to building your cubemaps, ensure that you’ve done the following for optimal generation:
- Turn off specular lighting using mat_specular 0
- Turn on cubemap building using building_cubemaps 1
- Toggle between HDR levels using mat_hdr_level <level> (only necessary if your map has HDR – you’ll need to build cubemaps both for LDR and HDR)
Build your cubemaps as normal
You can go ahead now and build your cubemaps in the engine as normal – and if you’ve followed everything correctly, they should now properly be saved. You must restart the game however if you want to see the new textures.
Please note that some users have reported that you must set building_cubemaps to 1 before actually running the build_cubemaps command. I haven’t experienced this issue myself, but if you can’t get your cubemaps to build properly – it’s worth a shot.
Optionally, if your map is HDR enabled, make sure to build cubemaps for HDR lighting – as well as non-HDR lighting.