Video Maze V1
A Wolfenstein-style raycast maze tour, generated frame by frame
- images
Video Maze V1 is the most impressive of DJZ's procedural video trio, because it's not a flat drawing trick - it's a real raycaster. It generates a maze with a recursive-backtracker algorithm, then walks a first-person camera through it, casting rays into the maze grid and drawing shaded wall columns, the way Wolfenstein 3D did in 1992. All in numpy and cv2, no model, no GPU. The result is a first-person maze tour with actual geometry - turn corners, get depth-cued walls, hit dead ends.
How it works
Two distinct stages in the code:
Maze generation. generate_enhanced_maze uses a recursive backtracker (a carve_path function that digs passages and backtracks) to produce a perfect maze - every cell reachable, one unique path between any two points. maze_size (15–100) sets the grid; bigger is more complex but slower.
Rendering. cast_enhanced_ray is a genuine raycast: for each screen column, a ray is cast into the grid, stepped until it hits a wall, and the wall's distance determines the column height and shading. render_quality (standard/high/ultra) trades ray-step density against speed. Then wall_pattern (solid, gradient, brick, circuit) textures the walls and lighting_mode (dynamic/static/pulsing/ambient) shades them.
movement_speed (0.01–0.2) drives forward motion, rotation_speed (0.01–0.15) turns the camera, wall_height (0.5–3) sets the perceived wall height, and fov (30–120) widens or narrows the view.
Inputs and outputs
Required: width, height (128–4096, step 64), fps (1–60), max_frames (1–9999), then the maze params: maze_size, wall_height, fov, movement_speed, rotation_speed, color_scheme, wall_pattern, lighting_mode, render_quality. Output: images - a max_frames-long IMAGE batch.
Where it sits in a workflow
The raycaster's geometry is gold for the img2img move: feed the frames into a prompt like "neon-lit corridor" and the AI inherits a perfect, consistent 3D camera tour - no video-model camera prompting needed. It's also just a great background loop and a demo of what procedural generation can do in a node graph. Between the three procedural nodes (corridor, cube, maze), this is the one that most often gets a "wait, this runs locally?" reaction.
Install
Part of DJZ-Nodes by Drift Johnson. ComfyUI Manager → "DJZ-Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt
Restart ComfyUI. numpy/torch/cv2 - nothing extra.
Gotchas
This is the slowest of the three procedural nodes - raycasting is per-column work, and ultra quality at 1024² with a maze_size of 100 will make you wait. Start standard at 512² and scale up only if the output is worth it. Also, because the camera wanders the maze freely, the tour is not a clean loop - the corridor node loops, this one just explores. If you need a loop, you're picking the corridor. And as with the rest of the pack's procedural trio, no audio, no user color picker - you're on the six preset schemes.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 512128–4096 | — |
| height | INT | 512128–4096 | — |
| fps | INT | 301–60 | — |
| max_frames | INT | 3001–9999 | — |
| maze_size | INT | 3015–100 | — |
| wall_height | FLOAT | 1.20.5–3 | — |
| fov | FLOAT | 7530–120 | — |
| movement_speed | FLOAT | 0.050.01–0.2 | — |
| rotation_speed | FLOAT | 0.030.01–0.15 | — |
| color_scheme | COMBO | 6 options: neon, classic, rainbow, monochrome, sunset, cyberpunk | |
| wall_pattern | COMBO | 4 options: solid, gradient, brick, circuit | |
| lighting_mode | COMBO | 4 options: dynamic, static, pulsing, ambient | |
| render_quality | COMBO | 3 options: standard, high, ultra |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |