How alchemist0823/three.quarks works
three.quarks is a TypeScript particle-system and real-time VFX library for three.js. Its main workflow is to configure a particle system with emission shapes, value generators, and behaviors; simulate particles; then register systems with a batched renderer for scene rendering. The repository also provides JSON effect loading, WebGPU rendering, React Three Fiber integration, and a node-based VFX subsystem. Edges reflect the README and the supplied excerpts or source-index references; unsampled implementation details are not inferred.
Main entry points: ParticleSystem.ts Particle system · BatchedRenderer.ts WebGL batching · WebGPUBatchedRenderer.ts WebGPU renderer · QuarksLoader.ts JSON effect loader
Components 21
Particle simulation
- Particle system
packages/three.quarks/src/ParticleSystem.ts - Particle state
packages/quarks.core/src/Particle.ts - Particle behaviors
packages/quarks.core/src/behaviors/Behavior.ts - Emitter shapes
packages/quarks.core/src/shape - Value generators
packages/quarks.core/src/functions/ValueGenerator.ts - Math primitives
packages/quarks.core/src/math
Rendering backends
- WebGL batching
packages/three.quarks/src/BatchedRenderer.ts - Render batches
packages/three.quarks/src/VFXBatch.ts - Particle materials
packages/three.quarks/src/materials/ParticleMaterials.ts - Shader effects
packages/three.quarks/src/shaders - WebGPU renderer
packages/three.quarks/src/webgpu/WebGPUBatchedRenderer.ts - Color compositor
packages/three.quarks/src/webgpu/QuarksCompositor.ts
Runtime integrations
- JSON effect loader
packages/three.quarks/src/QuarksLoader.ts - Effect utilities
packages/three.quarks/src/QuarksUtil.ts - R3F provider
packages/quarks.r3f/src/QuarksContext.tsx - R3F system hook
packages/quarks.r3f/src/hooks/useParticleSystem.ts - R3F effect hook
packages/quarks.r3f/src/hooks/useQuarksEffect.ts
Node VFX
- VFX node graph
packages/quarks.nodes/src/nodes/NodeGraph.ts - WebGPU compiler
packages/quarks.nodes/src/nodes/WebGPUCompiler.ts - Node WebGPU renderer
packages/quarks.nodes/src/WebGPURenderer.ts
Other components
- Effect author
Connections 27
- Effect author → Particle system: configures
- Particle system → Particle state: updates
packages/quarks.core/src/Particle.ts - Particle system → Emitter shapes: emits from
- Particle system → Particle behaviors: applies
packages/quarks.core/src/behaviors/Behavior.ts - Particle system → Value generators: samples
- Particle state → Math primitives: uses
packages/quarks.core/src/Particle.ts - Effect author → WebGL batching: registers systems
- WebGL batching → Particle system: updates
- WebGL batching → Render batches: renders through
- Render batches → Particle materials: uses
- Particle materials → Shader effects: uses
- Effect author → JSON effect loader: loads effects
- JSON effect loader → Effect utilities: registers effects
- Effect utilities → WebGL batching: adds systems
- Effect author → R3F provider: wraps components
packages/quarks.r3f/src/QuarksContext.tsx - R3F provider → WebGL batching: creates and updates
packages/quarks.r3f/src/QuarksContext.tsx - R3F system hook → R3F provider: gets renderer
packages/quarks.r3f/src/hooks/useParticleSystem.ts - R3F system hook → Particle system: creates
packages/quarks.r3f/src/hooks/useParticleSystem.ts - R3F effect hook → JSON effect loader: loads effects
packages/quarks.r3f/src/hooks/useQuarksEffect.ts - R3F effect hook → WebGL batching: registers systems
packages/quarks.r3f/src/hooks/useQuarksEffect.ts - Effect author → WebGPU renderer: selects backend
- WebGPU renderer → Particle system: renders systems
- Effect author → Color compositor: chooses compositing
- Color compositor → WebGPU renderer: composites output
- Effect author → VFX node graph: creates graph
- VFX node graph → WebGPU compiler: compiles graph
packages/quarks.nodes/src/nodes/WebGPUCompiler.ts - WebGPU compiler → Node WebGPU renderer: provides GPU program