Skip to content
← All work

02VOXEL.ENGINE/Web Game

AMAR PRITHIBI

A Minecraft-inspired procedural 3D voxel sandbox engine built from scratch in Three.js and WebGL.

Role
Graphics Programmer & Solo Developer
Stack
Three.js / WebGL / JavaScript / Perlin Noise
Year
2026
Status
Active

01Context

An exploration into 3D procedural terrain generation, chunk management, and WebGL rendering optimization in browser environments.

02Problem

Rendering thousands of individual cube meshes naively in Three.js causes extreme draw call overhead and rapidly drops frame rates below playable levels.

03Constraints

  1. 01Must maintain 60 FPS in modern desktop browsers
  2. 02Real-time block modification (raycasted block placement and destruction)
  3. 03Dynamic chunk loading and memory recycling around player position

04Architecture

A chunked voxel engine where terrain heightmaps are evaluated via 2D/3D Perlin noise and converted into optimized polygonal meshes.

Procedural Noise Generator
Multi-octave noise function creating elevation, biome variation, and cave cutouts.
Chunk Manager
16x16 horizontal chunk column loader handling coordinate transforms and neighbor queries.
Raycast Interaction Controller
Precise voxel boundary hit detection for single-block removal and placement.

05Decisions

D1Custom procedural generation in JavaScript instead of loading static pre-baked models

Why

Enables arbitrary world exploration and dynamic destruction of voxel elements in real time.

Result

Complete freedom in world shaping and minimal initial asset download.

D2Pointer Lock API for first-person FPS style camera navigation

Why

Provides intuitive, immersive mouse navigation matching standard 3D desktop gaming paradigms.

Result

Precise look-around physics and natural movement mechanics.

06Trade-offs

Client-side generation vs server chunk streaming

Gained

  • +Completely serverless, zero hosting compute costs
  • +Instant response to local edits

Gave up

  • −Heavier CPU utilization on client threads during initial chunk generation

07Performance

  • ↯Chunk-based geometry updates localized to modified regions only
  • ↯Frustum culling native to Three.js camera rendering pipeline
  • ↯Optimized animation loop with delta-time capped physics integration

08Challenges

  • #Handling boundary conditions when a block on a chunk border is destroyed, requiring adjacent chunk geometry rebuilds
  • #Managing memory garbage collection spikes when rapidly flying across chunk boundaries

09Learnings

  • →Draw call reduction is the single most critical factor in browser 3D graphics.
  • →Separating the logical voxel coordinate grid from the rendering mesh coordinates simplifies physics and raycasting significantly.

10Retrospective

Offloading chunk mesh compilation to Web Workers and implementing Greedy Meshing algorithms to merge coplanar block faces into unified quads would drastically reduce vertex counts.

Next project · 03

CLASH FORGE →

A specialized resource optimizer and upgrade calculator for Clash of Clans Hero Equipment economics.

CLASH FORGE Thumbnail