PTBakePublic betaDownload

PTBake

Path-traced lighting for Source maps.

Replaces VRAD in Hammer or Hammer++, using your GPU to bake lighting.

Download not available yetGet started

Windows x64

Abstract light study: a light installation in a shallow gallery alcove, with a warm vertical light bar, a cool overhead bar and a low plinth. Website artwork, not PTBake output.

Results

No bake captures are published yet.

Get the beta.

Public beta · Windows x64

One Windows executable with nothing to install. Choose it as Hammer's lighting compiler and compile as usual.

Download not available yet

Requirements

System
Windows, 64-bit
Minimum GPU
Supports Vulkan 1.0
Recommended
GPU with hardware ray tracingOptional. NVIDIA RTX, AMD Radeon RX 6000 or newer, Intel Arc.

Beta notes

  • ptbake.exe is not code-signed.
  • The first bake may take longer, including after a graphics driver update.
  • Heavy maps on slower or laptop GPUs can trigger a Windows GPU reset. The bake stops and writes a crash report.

Setup

Set up in Hammer or Hammer++

Choose PTBake as your lighting compiler, then compile maps through Hammer as usual.

  1. Download and extract PTBake. Place ptbake.exe in the same folder as hammer.exe or hammerplusplus.exe. That is usually your game's bin folder, but some installs keep the editor in a subfolder of bin: use the folder your editor actually runs from.

  2. Open Hammer or Hammer++. Go to Tools > Options.

  3. Select the Build Programs tab. If you have more than one game configuration, choose the one you want to use with PTBake.

  4. Change the RAD executable. Click Browse beside that field and select the ptbake.exe you extracted. This replaces the path to your current lighting compiler.

  5. Save your settings. Click Apply, then OK.

  6. Compile your map as usual. Keep the lighting (RAD) step enabled. Hammer will use PTBake to bake the lighting.

Keep your original lighting executable. To switch back, select it again in the RAD executable field.

Command-line usage
  1. Open a terminal in the folder with ptbake.exe and check the build:

    ptbake.exe -version

    It prints the version, source commit, build id and shader set. Include this in bug reports.

  2. Bake a compiled map in place:

    ptbake.exe -game <gamedir> <map.bsp>

    <gamedir> is the mod folder that holds gameinfo.txt, for example ...\Half-Life 2\hl2. The lit map replaces the input .bsp; add -output PATH to write it elsewhere.

Quality presets
PresetSamplesBouncesBlurUse
-fast6442Quick preview
(none)1024201Default
-final4096201Release bake

-samples, -bounces and -blur override a preset. More samples mean less noise and a longer bake. In Hammer, add a preset to the RAD step's parameters (Run Map, Expert mode).

Advanced options
  • -bounces N sets how many times light bounces between surfaces. The default is 20.
  • -rad bakes area lights from .rad texture lights. Experimental and off by default.
  • -adaptive turns on adaptive sampling. Experimental.

In Hammer, add them to the RAD step's parameters (Run Map, Expert mode).

It takes the VRAD step.

PTBake is a command-line compiler. It reads a compiled .bsp, bakes its lightmaps, prop lighting and ambient lighting on the GPU, and writes them back. The rest of your compile stays the same.

  1. 01

    Compile as usual

    Your geometry and visibility steps run as before. PTBake replaces only the VRAD step, in Hammer or in a build script.

  2. 02

    Bake on the GPU

    PTBake loads the map with the materials and models from the game folder you pass with -game, traces its lighting, and writes it back into the same .bsp.

  3. 03

    Test in game

    Hammer's Copy File step copies the lit map into the game, the same as after VRAD.

What it handles

Bounced light
Light reflects between surfaces, carrying their color into the surrounding scene.
Light from the sky
The sky texture contributes light and color to the scene.
Your existing lights
Supports light, light_spot, light_environment and light_directional. Named and switchable lights can still toggle in game. Set _light_radius for softer shadows.
Static prop lighting
Bakes lighting onto static props, with per-texel lightmaps for props using generatelightmaps in Garry's Mod and Source MP maps.
3D skyboxes
Sunlight, skylight and bounced light travel between your map and its 3D skybox.
Glass, foliage and water
Accounts for glass, water and cutout textures such as foliage when baking shadows and bounced light.
Ray tracing hardware is optional
Uses hardware ray tracing when available. GPUs without it can still bake using software tracing on the GPU.
LDR and HDR
Bake LDR, HDR or both. With -both, PTBake shares data between the two lighting modes to keep BSP size down.