Skip to content

Commit 9ee0091

Browse files
committed
Rename vmt-lightpreview to vmt-preview and update HDR flag
Renames the 'vmt-lightpreview' tool and all related references to 'vmt-preview' across documentation, CMake, and source files. Updates the HDR lightfile_t enum value from 'lithdr' to 'hdr' and adjusts all code and documentation to use the new flag and tool name. Also introduces a SaveLightmapProgress helper for intermediate BSP writes.
1 parent 92d2be1 commit 9ee0091

12 files changed

Lines changed: 142 additions & 89 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ VibeyMapTools (VMT) is a BSP compilation toolset for Quake engine mapping. It is
2121
| `vmt-bspinfo` | BSP information utility | `src/bspinfo/` |
2222
| `vmt-bsputil` | BSP manipulation utility | `src/bsputil/` |
2323
| `vmt-maputil` | Map file Lua scripting | `src/maputil/` |
24-
| `vmt-lightpreview` | Real-time preview GUI | `src/lightpreview/` |
24+
| `vmt-preview` | Real-time preview GUI | `src/lightpreview/` |
2525

2626
## Repository Structure
2727

@@ -42,7 +42,7 @@ VibeyMapTools/
4242
| |-- bspinfo/ # vmt-bspinfo source
4343
| |-- bsputil/ # vmt-bsputil source
4444
| |-- maputil/ # vmt-maputil source
45-
| `-- lightpreview/ # vmt-lightpreview tool
45+
| `-- lightpreview/ # vmt-preview tool
4646
|-- tests/ # Test suite (maps/ subdirectory contains test .map files)
4747
|-- CMakeLists.txt
4848
|-- README.md
@@ -88,7 +88,7 @@ cmake --build build --target package
8888
### Dependencies
8989

9090
- **Required**: C++20 compiler, CMake 3.14+, Intel Embree 4.x, oneTBB
91-
- **Optional**: Qt6 (for vmt-lightpreview), CUDA/OptiX (GPU lighting), Intel OIDN (denoising)
91+
- **Optional**: Qt6 (for vmt-preview), CUDA/OptiX (GPU lighting), Intel OIDN (denoising)
9292

9393
## Code Conventions
9494

@@ -222,7 +222,7 @@ CMake generates `version.hh` in `build/include` for compile-time version info.
222222

223223
- **Tool naming**: Executables use `vmt-` prefix, but source directories do not (e.g., `src/qbsp/` builds `vmt-bsp`)
224224
- **Submodules**: Run `git submodule update --init --recursive` after cloning
225-
- **Qt6**: Only needed for `vmt-lightpreview`, disabled by default
225+
- **Qt6**: Only needed for `vmt-preview`, disabled by default
226226
- **Embree/TBB**: Required dependencies; set `embree_DIR`/`TBB_DIR` if CMake cannot find them
227227

228228
## Contact

BUILDING.md

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Same workflow, new name, extra toys. If you used ericw-tools, this should feel i
1414
| `bspinfo` | `vmt-bspinfo` |
1515
| `bsputil` | `vmt-bsputil` |
1616
| `maputil` | `vmt-maputil` |
17-
| `lightpreview` | `vmt-lightpreview` |
17+
| `lightpreview` | `vmt-preview` |
1818

1919
**Still the same (legacy comfy mode):**
2020
- Quake II + Remaster support stays put (`-q2bsp`, `-lightgrid`, `-world_units_per_luxel`) 🧠🎮
@@ -39,7 +39,7 @@ Same workflow, new name, extra toys. If you used ericw-tools, this should feel i
3939
- **Intel Embree 4.x + oneTBB** (required for `vmt-light` builds)
4040

4141
### Optional extras (spicy toppings)
42-
- **Qt6** (for `vmt-lightpreview`)
42+
- **Qt6** (for `vmt-preview`)
4343
- **NVIDIA CUDA Toolkit** + **OptiX SDK 7.x** (GPU raytracing)
4444
- **Intel Open Image Denoise (OIDN)** (AI-based lightmap denoising)
4545

@@ -82,7 +82,7 @@ cmake --build . --parallel
8282
```bash
8383
# Install dependencies via Homebrew
8484
brew install cmake embree tbb qt@6
85-
# Qt6 is only needed for vmt-lightpreview
85+
# Qt6 is only needed for vmt-preview
8686

8787
# Clone and build
8888
git clone --recursive https://github.com/themuffinator/VibeyMapTools.git
@@ -111,16 +111,51 @@ If CMake cannot find them, pass the package config paths:
111111
cmake .. -Dembree_DIR=/path/to/embree/lib/cmake/embree-4.x -DTBB_DIR=/path/to/tbb/lib/cmake/tbb
112112
```
113113

114-
### NVIDIA OptiX (GPU Raytracing)
114+
### NVIDIA OptiX (GPU Raytracing) ?
115115

116-
1. Install CUDA Toolkit from https://developer.nvidia.com/cuda-toolkit
117-
2. Download OptiX SDK from https://developer.nvidia.com/designworks/optix/download
118-
3. Set environment variable:
119-
```powershell
120-
$env:OPTIX_ROOT_DIR = "C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.7.0"
121-
```
116+
This enables the `-gpu` path in `vmt-light` (OptiX-backed raytracing). If OptiX isn't found, `-gpu`
117+
falls back to Embree and prints "GPU Raytracing compiled out."
122118

123-
CMake will detect OptiX and enable GPU support.
119+
**1) Install the prerequisites**
120+
- NVIDIA GPU + recent driver
121+
- CUDA Toolkit (from https://developer.nvidia.com/cuda-toolkit)
122+
- OptiX SDK 7.x (from https://developer.nvidia.com/designworks/optix/download)
123+
124+
**2) Set OptiX SDK path**
125+
Point `OPTIX_ROOT_DIR` at the OptiX SDK root (the directory that contains `include/optix.h`).
126+
127+
Windows (PowerShell):
128+
```powershell
129+
$env:OPTIX_ROOT_DIR = "C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.7.0"
130+
```
131+
132+
Linux/macOS (bash/zsh):
133+
```bash
134+
export OPTIX_ROOT_DIR=/opt/optix/OptiX_SDK_7.7.0
135+
```
136+
137+
**3) Reconfigure + rebuild**
138+
```bash
139+
cmake -B build -DCMAKE_BUILD_TYPE=Release
140+
cmake --build build --config Release
141+
```
142+
143+
**4) Verify OptiX is detected**
144+
In CMake output you should see:
145+
- `CUDA found. Checking for OptiX...`
146+
- `OptiX found at <path>`
147+
148+
**5) Run with GPU tracing**
149+
```bash
150+
vmt-light -gpu mymap.bsp
151+
```
152+
153+
If you still see "GPU Raytracing compiled out", OptiX headers were not found. Double-check the
154+
`OPTIX_ROOT_DIR` value and that `include/optix.h` exists.
155+
156+
**Troubleshooting**
157+
- If CUDA isn't found, set `CUDAToolkit_ROOT` or install a matching Toolkit version for your GPU driver.
158+
- If the build system caches a failed OptiX lookup, delete `build/` or clear the CMake cache.
124159

125160
### Intel OIDN (AI Denoising) 🤖
126161

@@ -134,7 +169,7 @@ cmake .. -DOpenImageDenoise_DIR=/path/to/oidn/lib/cmake/OpenImageDenoise
134169

135170
| Option | Default | Description |
136171
|--------|---------|-------------|
137-
| `ENABLE_LIGHTPREVIEW` | ON | Enable Qt-based `vmt-lightpreview` |
172+
| `ENABLE_LIGHTPREVIEW` | ON | Enable Qt-based `vmt-preview` |
138173
| `DISABLE_TESTS` | OFF | Skip building tests |
139174
| `DISABLE_DOCS` | OFF | Skip docs build |
140175
| `VIBEYMAPTOOLS_ASAN` | OFF | Enable AddressSanitizer for all targets |
@@ -153,7 +188,7 @@ After a successful build, you'll find in `build/`:
153188
| `vmt-bspinfo` | BSP information utility |
154189
| `vmt-bsputil` | BSP manipulation utility |
155190
| `vmt-maputil` | Lua scripting for .map workflows |
156-
| `vmt-lightpreview` | Realtime lighting preview (experimental) |
191+
| `vmt-preview` | Realtime lighting preview (experimental) |
157192

158193
## ✅ Running Tests
159194

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Formerly ericw-tools, now with extra sparkle ✨🎧🛠️
4646
<td>Lua scripting for .map workflows</td>
4747
</tr>
4848
<tr>
49-
<td><b>vmt-lightpreview</b></td>
49+
<td><b>vmt-preview</b></td>
5050
<td>Realtime lighting preview (Qt)</td>
5151
</tr>
5252
</table>
@@ -65,7 +65,7 @@ Same bones, new polish. If you used `qbsp/vis/light` before, your muscle memory
6565
| `bspinfo` | `vmt-bspinfo` |
6666
| `bsputil` | `vmt-bsputil` |
6767
| `maputil` | `vmt-maputil` |
68-
| `lightpreview` | `vmt-lightpreview` |
68+
| `lightpreview` | `vmt-preview` |
6969

7070
**What stayed the same (cozy mode):**
7171
- Classic compile flow: `bsp -> vis -> light`
@@ -77,6 +77,8 @@ Same bones, new polish. If you used `qbsp/vis/light` before, your muscle memory
7777
- `vmt-` prefix on every binary so ericw-tools can live side-by-side 🧹✨
7878
- Semantic versioning + tag-driven releases with CI-built packages 📦🚀
7979
- Build metadata + `version.hh` for scripting and diagnostics 🧾🛠️
80+
- Improved Half-Life support (updated behavior + smoother compatibility) ??
81+
- Numerous bug fixes and improvements across the toolchain ?????
8082

8183

8284
## 🚀 Quick Start
@@ -97,7 +99,7 @@ vmt-light -gpu -extra4 -bounce 2 -denoise mymap.bsp
9799
- 🤖 AI denoising with Intel OIDN (`-denoise`)
98100
- 🎛️ Stochastic sampling (`-stochastic`) for complex scenes
99101
- 🔁 Incremental lighting (`-incremental`) for fast iteration loops
100-
- 🌈 HDR lightmaps (`-lithdr`) for engines that support it
102+
- 🌈 HDR lightmaps (`-hdr`) for engines that support it
101103

102104
## 📦 Downloads
103105

@@ -111,24 +113,24 @@ vmt-light -gpu -extra4 -bounce 2 -denoise mymap.bsp
111113

112114
## 🧪 Building from Source
113115

114-
```bash
115-
git clone --recursive https://github.com/themuffinator/VibeyMapTools.git
116-
cd VibeyMapTools && cmake -B build -DCMAKE_BUILD_TYPE=Release
117-
cmake --build build
118-
```
119-
120-
macOS 10.15+ prep: `brew install cmake embree tbb qt@6` (Qt6 only needed for `vmt-lightpreview`)
121-
122-
<details>
123-
<summary><b>Requirements</b></summary>
124-
125-
- CMake 3.14+
126-
- C++20 compiler (MSVC 2019+, GCC 9+, Clang 10+)
127-
- macOS 10.15+ (Catalina) recommended for Apple builds
128-
- Embree 4.x + oneTBB (required for `vmt-light`)
116+
```bash
117+
git clone --recursive https://github.com/themuffinator/VibeyMapTools.git
118+
cd VibeyMapTools && cmake -B build -DCMAKE_BUILD_TYPE=Release
119+
cmake --build build
120+
```
121+
122+
macOS 10.15+ prep: `brew install cmake embree tbb qt@6` (Qt6 only needed for `vmt-preview`)
123+
124+
<details>
125+
<summary><b>Requirements</b></summary>
126+
127+
- CMake 3.14+
128+
- C++20 compiler (MSVC 2019+, GCC 9+, Clang 10+)
129+
- macOS 10.15+ (Catalina) recommended for Apple builds
130+
- Embree 4.x + oneTBB (required for `vmt-light`)
129131

130132
**Optional extras:**
131-
- Qt6 (for `vmt-lightpreview`)
133+
- Qt6 (for `vmt-preview`)
132134
- CUDA + OptiX SDK (GPU raytracing)
133135
- Intel OIDN (AI denoising)
134136

WIKI.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Welcome to the VibeyMapTools documentation hub. This page is your neon sign to t
2222
| **vmt-bspinfo** | [bspinfo.rst](docs/bspinfo.rst) | BSP information utility |
2323
| **vmt-bsputil** | [bsputil.rst](docs/bsputil.rst) | BSP manipulation utility |
2424
| **vmt-maputil** | [maputil.rst](docs/maputil.rst) | Map file Lua scripting tool |
25-
| **vmt-lightpreview** | [lightpreview.rst](docs/lightpreview.rst) | Real-time lighting preview (experimental) |
25+
| **vmt-preview** | [lightpreview.rst](docs/lightpreview.rst) | Real-time lighting preview (experimental) |
2626

2727
### Full Documentation
2828
The complete documentation is available in the [`docs/`](docs/) folder and at **github.com/themuffinator/VibeyMapTools**.
@@ -34,7 +34,7 @@ The complete documentation is available in the [`docs/`](docs/) folder and at **
3434
Same workflow, new name, bonus polish. The big changes are mostly naming + release tooling:
3535

3636
- `qbsp/vis/light` -> `vmt-bsp/vmt-vis/vmt-light`
37-
- All binaries are `vmt-` prefixed to differentiate from ericw-tools (including `vmt-maputil` and `vmt-lightpreview`)
37+
- All binaries are `vmt-` prefixed to differentiate from ericw-tools (including `vmt-maputil` and `vmt-preview`)
3838
- CI-built packages + semantic versioning
3939
- Quake II + Remaster support is unchanged (`-q2bsp`, `-lightgrid`, `-world_units_per_luxel`)
4040
- Upstream docs still apply: https://ericwa.github.io/ericw-tools/ 📚
@@ -49,7 +49,7 @@ Same workflow, new name, bonus polish. The big changes are mostly naming + relea
4949
| `bspinfo` | `vmt-bspinfo` |
5050
| `bsputil` | `vmt-bsputil` |
5151
| `maputil` | `vmt-maputil` |
52-
| `lightpreview` | `vmt-lightpreview` |
52+
| `lightpreview` | `vmt-preview` |
5353

5454

5555
---
@@ -92,7 +92,7 @@ Keeps caches so you can relight fast without reprocessing everything.
9292
### Bounce Lighting (`-bounce N`) 💡
9393
Simulates indirect illumination by bouncing light off surfaces. Higher values = more realistic but slower.
9494

95-
### HDR Lightmaps (`-lithdr`) 🌈
95+
### HDR Lightmaps (`-hdr`) 🌈
9696
Generates high dynamic range lightmaps for engines that support it.
9797

9898
### Surface Lights (`_surface`) 🌟

docs/lightpreview.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
================
2-
vmt-lightpreview
2+
vmt-preview
33
================
44

55
Real-Time Lighting Preview — GUI tool for interactive BSP compilation and visualization
@@ -8,7 +8,7 @@ Real-Time Lighting Preview — GUI tool for interactive BSP compilation and visu
88
Description
99
-----------
1010

11-
:program:`vmt-lightpreview` is a graphical tool that unifies :doc:`qbsp`, :doc:`vis`,
11+
:program:`vmt-preview` is a graphical tool that unifies :doc:`qbsp`, :doc:`vis`,
1212
and :doc:`light` with a 3D viewport for visualizing the output in real-time.
1313

1414
.. note::
@@ -52,7 +52,7 @@ Usage
5252

5353
.. code-block:: bash
5454
55-
vmt-lightpreview mymap.map
55+
vmt-preview mymap.map
5656
5757
The tool will automatically compile the map and display it in the viewport.
5858
Changes to lighting parameters can be previewed interactively.

src/include/light/light.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ enum class lightfile_t
183183
// write .lit (version 2) file
184184
lit2 = 4,
185185
// write .lit (version LIT_VERSION_E5BGR9) file with HDR lighting
186-
lithdr = 8,
186+
hdr = 8,
187187
// write LIGHTING_E5BGR9 BSPX lump
188188
bspxhdr = 16,
189189
// bitmask for all HDR formats
190-
all_hdr_formats = (lithdr | bspxhdr)
190+
all_hdr_formats = (hdr | bspxhdr)
191191
};
192192

193193
enum class luxfile_t

src/light/light.cc

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ light_settings::light_settings()
350350
&experimental_group, "writes both rgb and directions data into the bsp itself"},
351351
hdr{this, "hdr",
352352
[&](const std::string &, parser_base_t &, source) {
353-
write_litfile |= lightfile_t::lithdr;
353+
write_litfile |= lightfile_t::hdr;
354354
return true;
355355
},
356356
&experimental_group, "write .lit file with e5bgr9 data"},
@@ -506,7 +506,7 @@ void light_settings::light_postinitialize(int argc, const char **argv)
506506
logging::print("BSPX colored light output requested on command line.\n");
507507
if (write_litfile & lightfile_t::lit2)
508508
logging::print(".lit (version 2) colored light output requested on command line.\n");
509-
if (write_litfile & lightfile_t::lithdr)
509+
if (write_litfile & lightfile_t::hdr)
510510
logging::print(".lit (HDR) light output requested on command line.\n");
511511
if (write_litfile & lightfile_t::bspxhdr)
512512
logging::print("BSPX HDR light output requested on command line.\n");
@@ -799,6 +799,22 @@ static void FindModelInfo(const mbsp_t *bsp)
799799
Q_assert(modelinfo.size() == bsp->dmodels.size());
800800
}
801801

802+
static void SaveLightmapProgress(bspdata_t *bspdata, const fs::path &source)
803+
{
804+
SaveLightmapSurfaces(bspdata, source);
805+
806+
if (light_options.litonly.value()) {
807+
return;
808+
}
809+
810+
// Write a converted copy so the active lighting data stays in generic format.
811+
bspdata_t write_bsp = *bspdata;
812+
if (!ConvertBSPFormat(&write_bsp, write_bsp.loadversion)) {
813+
Error("Failed to convert BSP for intermediate write");
814+
}
815+
WriteBSPFile(source, &write_bsp);
816+
}
817+
802818
/*
803819
* =============
804820
* LightWorld
@@ -883,7 +899,7 @@ static void LightWorld(bspdata_t *bspdata, const fs::path &source, bool forcedsc
883899

884900
// Save progress after direct lighting
885901
logging::print("Saving progress after direct lighting...\n");
886-
SaveLightmapSurfaces(bspdata, source);
902+
SaveLightmapProgress(bspdata, source);
887903

888904
if (bouncerequired && !light_options.nolighting.value()) {
889905

@@ -909,7 +925,7 @@ static void LightWorld(bspdata_t *bspdata, const fs::path &source, bool forcedsc
909925

910926
// Save progress after each bounce pass
911927
logging::print("Saving progress after bounce pass {}...\n", i);
912-
SaveLightmapSurfaces(bspdata, source);
928+
SaveLightmapProgress(bspdata, source);
913929
}
914930
}
915931

src/light/write.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ void SaveLightmapSurfaces(bspdata_t *bspdata, const fs::path &source)
13371337
bspdata->bspx.entries.erase("LIGHTING_E5BGR9");
13381338

13391339
// lit/lux files (or their BSPX equivalents)
1340-
if (light_options.write_litfile & lightfile_t::lithdr) {
1340+
if (light_options.write_litfile & lightfile_t::hdr) {
13411341
WriteLitFile(bsp, g_ctx->faces_sup, source, LIT_VERSION_E5BGR9, lit_filebase, lux_filebase, hdr_filebase);
13421342
}
13431343
if (light_options.write_litfile & lightfile_t::lit) {

0 commit comments

Comments
 (0)