Daniel Gray

Thoughts, Notes, Ideas, Projects

← Back to home

Fog Visualization

Fog visualization is a key component of atmospheric effects in 3D scenes. This page explores the techniques and implementations used to create realistic and stylized fog effects.

Overview

Fog adds depth, atmosphere, and mood to 3D scenes. In the 3D background system, fog is implemented using GPU-based particle systems for optimal performance.

Implementation Techniques

Particle-Based Fog

The fog system uses point sprites rendered as particles:

  • GPU-based animation: All movement calculations happen in the vertex shader
  • Per-particle attributes: Each particle has its own size and position
  • Sine wave motion: Creates organic, floating movement patterns

Shader Implementation

The fog shader uses custom vertex and fragment shaders:

// Vertex shader animates particles on GPU
pos.y += sin(time + position.x * 0.1 + position.z * 0.1) * 0.1;

This approach ensures:

  • No CPU overhead for animation
  • Parallel processing of all particles
  • Smooth performance even with hundreds of particles

Visual Aesthetic

The fog system creates an atmospheric effect inspired by Chinese landscape paintings:

  • Organic clustering: Random positioning creates natural fog banks
  • Gentle floating: Sine wave animation creates smooth, organic motion
  • Depth perception: Fog adds atmospheric perspective to the scene
  • Minimalist style: Matches the overall aesthetic of the background

Performance Considerations

Fog visualization is optimized for performance:

  • GPU-based animation (no CPU updates)
  • Efficient point sprite rendering
  • Configurable particle count
  • IntersectionObserver pauses when not visible

Related Articles

Related Content

Atmospheric Effects and Fog Systems

Atmospheric Effects and Fog Systems

Atmospheric Effects and Fog Systems The mist system uses custom shader materials with per-particle attributes to create an atmospheric fog effect reminiscent of Chinese landscape paintings. Each mist ...

Rain Visualization

Rain Visualization Rain effects add dynamic weather elements to 3D scenes. This page explores techniques for creating realistic and performant rain visualizations. Overview Rain visualization involves...

Snow Visualization

Snow Visualization Snow effects create winter atmospheres in 3D scenes. This page explores techniques for rendering snowflakes and snow accumulation. Overview Snow visualization involves creating part...