A real-time 3D visualization tool that combines procedural patterns using boolean algebra operations, rendered as animated layered sculptures. Created for Genuary 2025 - January 7th prompt: Boolean algebra.
This project explores boolean algebra through generative art by:
- Generating two procedural noise patterns (Pattern A and Pattern B)
- Combining them using boolean operations (AND, OR, XOR, NOT)
- Rendering the result as a 3D layered sculpture with depth animation
The boolean operations treat pixel brightness as binary values (above/below threshold), creating striking geometric compositions where mathematical logic becomes visual art.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INTERFACE β
β βββββββββββββββ βββββββββββββββ ββββββββββββ βββββββββββββ ββββββββββββββ β
β β Pattern A β β Pattern B β β Operator β β Threshold β β 3D Settingsβ β
β β Select β β Select β β Select β β Slider β β Panel β β
β ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββ¬ββββββ βββββββ¬ββββββ βββββββ¬βββββββ β
βββββββββββΌββββββββββββββββΌββββββββββββββΌββββββββββββββΌββββββββββββββΌβββββββββ
β β β β β
βΌ βΌ β β β
βββββββββββββββββββββββββββββββββββββββ β β β
β PATTERN GENERATION (PixiJS) β β β β
β ββββββββββββββββ ββββββββββββββββ β β β β
β β Texture A β β Texture B β β β β β
β β (1024Γ1024) β β (1024Γ1024) β β β β β
β ββββββββ¬ββββββββ βββββββββ¬βββββββ β β β β
β β β β β β β
β ββββββββββ¬βββββββββ β β β β
β βΌ β β β β
β ββββββββββββββββββββββββββββββββββ β β β β
β β BOOLEAN SHADER (WebGL) βββΌββΌββββββββββββββ β
β β ββββββββββββββββββββββββββββ β β β β
β β β Ab = step(threshold, A) β β β β β
β β β Bb = step(threshold, B) β β β β β
β β β β βββΌββ β
β β β AND: Ab * Bb β β β β
β β β OR: max(Ab, Bb) β β β β
β β β XOR: abs(Ab - Bb) β β β β
β β β NOT_A: 1.0 - Ab β β β β
β β ββββββββββββββββββββββββββββ β β β
β ββββββββββββββββ¬ββββββββββββββββββ β β
β β β β
β βΌ β β
β ββββββββββββββββββββββββββββββββββ β β
β β Boolean Result Texture β β β
β β (1024Γ1024) β β β
β ββββββββββββββββ¬ββββββββββββββββββ β β
βββββββββββββββββββΌββββββββββββββββββββ β
β β
βΌ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β 3D RENDERING (Three.js) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β LAYER STACK β β β
β β βββββββ βββββββ βββββββ βββββββ βββββββ βββββββ β β β
β β β 0 β β 1 β β 2 β β 3 β β 4 β Β·Β·Β· β N β β β β
β β βfrontβ β β β β β β β β βback β β β β
β β ββββ¬βββ ββββ¬βββ ββββ¬βββ ββββ¬βββ ββββ¬βββ ββββ¬βββ ββββΌββ
β β β β β β β β β β
β β βΌ βΌ βΌ βΌ βΌ βΌ β β
β β Rolling texture update (each frame shifts textures back) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ β
β β ANIMATION ENGINE β β
β β Wave | Pulse | Cascade | Breathe | None β β
β β - Per-layer Z offset animation β β
β β - Alpha/opacity modulation β β
β β - Scale pulsing effects β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ β
β β SHADER MATERIAL (per layer) β β
β β - Tint color gradient (start β end) β β
β β - Alpha falloff (depth fade) β β
β β - Transparent black/white regions β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β OrbitControls β β
β β Interactive 3D camera rotation/zoom β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Two patterns are generated independently using GPU shaders via PixiJS. Available pattern types:
| Category | Patterns | Description |
|---|---|---|
| Classic Noise | Perlin, Simplex, Value | Traditional noise functions with FBM (fractal brownian motion) |
| Advanced Noise | Ridged, PingPong, Domain Warp | Complex noise variations for organic textures |
| Cellular | Voronoi | Cell-based patterns with multiple distance functions |
| Procedural | Flow Field, DLA | Algorithmic patterns (particle-based) |
| Input | Webcam | Live or snapshot camera input |
All noise patterns are powered by FastNoiseLite ported to GLSL shaders for real-time performance.
The core of this project - two grayscale patterns are combined using boolean logic:
// Threshold converts continuous values to binary
float Ab = step(threshold, A.r); // 1.0 if A >= threshold, else 0.0
float Bb = step(threshold, B.r);
// Boolean operations
AND: Ab * Bb // Intersection - only where BOTH are white
OR: max(Ab, Bb) // Union - where EITHER is white
XOR: abs(Ab - Bb) // Exclusive OR - where ONLY ONE is white
NOT_A: 1.0 - Ab // Inversion of pattern AThe threshold slider controls the binary cutoff point, dramatically changing the visual output.
The boolean result is extruded into 3D space as a stack of textured planes:
- Rolling Texture Update: Each animation frame, the current pattern is pushed to the front layer, and all other layers shift backward (creating a temporal depth effect)
- Alpha Falloff: Layers fade in opacity as they recede
- Tint Gradient: Color can shift from front to back layers
- Transparency: Black and/or white regions can be made transparent for sculptural effects
| Mode | Effect |
|---|---|
| Wave | Sinusoidal Z-position oscillation through the stack |
| Pulse | Scale pulsing with phase offsets per layer |
| Cascade | Sequential wave with opacity modulation |
| Breathe | Organic expansion/contraction of layer spacing |
| None | Static layer positions |
src/
βββ main.js # Application entry point & UI orchestration
βββ index.html # UI layout and styling
βββ booleanOps.js # Boolean algebra shader implementation
βββ threeScene.js # Three.js scene setup (camera, lights, controls)
βββ threeExtrude.js # Layer stack creation & animation engine
βββ patterns/
β βββ noise.js # Basic random noise
β βββ perlin.js # Perlin noise (FastNoiseLite)
β βββ simplex.js # Simplex noise (OpenSimplex2)
β βββ voronoi.js # Voronoi/Cellular patterns
β βββ fastnoise.js # Advanced noise types (Ridged, PingPong, etc.)
β βββ flowfield.js # Flow field particle system
β βββ dla.js # Diffusion-limited aggregation
β βββ webcam.js # Webcam input handling
βββ lib/
β βββ fastnoiseShader.js # FastNoiseLite GLSL shader wrapper
β βββ fastnoise.glsl # FastNoiseLite port to GLSL
βββ utils/
βββ noiseHelpers.js # Noise utility functions
- PixiJS (v7) - 2D WebGL rendering for pattern generation and boolean shader
- Three.js (v0.182) - 3D WebGL rendering for layered sculpture
- FastNoiseLite - Noise generation library (GLSL port)
- Vite - Development server and build tool
- Node.js 18+
- Modern browser with WebGL2 support
# Clone the repository
git clone https://github.com/msurguy/genuary-boolean-algebra.git
cd genuary-boolean-algebra
# Install dependencies
npm install
# Start development server
npm run devOpen http://localhost:5173 in your browser.
npm run build
npm run preview # Preview the production buildThe app uses a local font picker package via file:./jsfontpicker.
To refresh the bundled Google Fonts catalog (for newly added fonts like Doto):
cd jsfontpicker
npm run update:google-fonts
cd ..
npm installThen rebuild the app:
npm run build- Select Pattern A and Pattern B from the dropdowns
- Choose a Boolean Operator (AND, OR, XOR, NOT A)
- Adjust the Threshold to control the binary cutoff
- Tune Pattern Parameters in the expandable sections
- Configure 3D Settings:
- Layer count and spacing
- Alpha and falloff
- Transparency for black/white regions
- Tint colors
- Select Animation Mode and adjust speed/amplitude
- Interact - drag to rotate, scroll to zoom
- Export - save the current view as PNG
Genuary is an annual event where artists create generative art every day in January based on community prompts. This project was created for:
January 7, 2025: Boolean algebra
Boolean algebra - the mathematics of true/false, 1/0, on/off - forms the foundation of digital computation. This project visualizes boolean logic as art, turning abstract mathematical operations into tangible, sculptural forms.
MIT License - feel free to use, modify, and share.
Created with PixiJS, Three.js, and a passion for generative art.