Nodes/DJZ-Nodes/Video Maze V1
ComfyUI Node

Video Maze V1

A Wolfenstein-style raycast maze tour, generated frame by frame

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Video Maze V1
    • images
    width512
    height512
    fps30
    max_frames300
    maze_size30
    wall_height1.2
    fov75
    movement_speed0.05
    rotation_speed0.03
    color_scheme
    wall_pattern
    lighting_mode
    render_quality

    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.

    Categorysd

    Inputs (13)

    NameTypeDefaultDescription
    widthINT512128–4096
    heightINT512128–4096
    fpsINT301–60
    max_framesINT3001–9999
    maze_sizeINT3015–100
    wall_heightFLOAT1.20.5–3
    fovFLOAT7530–120
    movement_speedFLOAT0.050.01–0.2
    rotation_speedFLOAT0.030.01–0.15
    color_schemeCOMBO6 options: neon, classic, rainbow, monochrome, sunset, cyberpunk
    wall_patternCOMBO4 options: solid, gradient, brick, circuit
    lighting_modeCOMBO4 options: dynamic, static, pulsing, ambient
    render_qualityCOMBO3 options: standard, high, ultra

    Outputs (1)

    NameTypeDescription
    imagesIMAGE