Skip to content

muhkartal/webGL-cosmicVisualizations

Repository files navigation

WebGL Cosmic Visualizations

License: MIT WebGL GLSL Pure JS

An interactive 3D visualization project featuring WebGL-powered fractal and particle simulations

DemoFeaturesScreenshotsTechnologiesGetting StartedStructure

Overview

WebGL Cosmic Visualizations offers high-performance 3D fractal and particle simulations rendered entirely in the browser. The project leverages GPU-accelerated rendering through WebGL and custom GLSL shaders to create mesmerizing cosmic landscapes and particle systems that respond to user interaction in real time.

Features

Mandelbulb Explorer

Interactive 3D fractal visualization with ray-marching techniques

  • Adjustable fractal parameters (power, iterations, bailout)
  • Multiple rendering quality options
  • Advanced lighting controls
  • Camera manipulation with mouse and keyboard shortcuts
  • Animated parameter transitions
  • Interactive cross-section views

Cosmic Particles

Fluid particle simulation with curl noise for beautiful cosmic effects

  • Galaxy formation with spiral arms
  • Multiple visual presets (nebula, galaxy, stardust, energetic flow)
  • Physically-inspired particle behavior
  • Thousands of interactive particles
  • Color gradient customization
  • Dynamic forces responding to mouse movements

Live Demo

Screenshots

truthAlign System Architecture Cosmic Particles
Mandelbulb Explorer with detailed lighting Cosmic Particles simulation with spiral formation

Technologies

Rendering

  • WebGL for GPU-accelerated graphics
  • GLSL Shaders for visual effects and computations
  • Custom fragment shaders for ray-marching implementation
  • Transform feedback for particle simulations

Mathematics

  • Fractal mathematics for Mandelbulb generation
  • Curl noise algorithms for fluid-like motion
  • Quaternion rotations for 3D camera control
  • Distance field calculations

Implementation

  • Pure JavaScript with no external dependencies
  • Responsive design using CSS Grid and Flexbox
  • Custom UI controls for parameter adjustments
  • Web Workers for non-blocking computations

System Architecture

The framework consists of four integrated modules that work together to improve factual consistency:

truthAlign System Architecture

Performance Optimizations

The project includes several optimizations to maintain high frame rates:

  • Adaptive quality scaling based on device performance
  • Temporal anti-aliasing for smoother visuals
  • Level-of-detail rendering for complex fractals
  • Frustum culling for particle systems
  • Instanced rendering for particle visualization
  • Texture-based lookup tables for complex calculations

Getting Started

Prerequisites

  • Modern web browser with WebGL 2.0 support
  • Local development server (Python's built-in server, Node.js http-server, etc.)

Installation

  1. Clone the repository:

    git clone https://github.com/your-github-username/webgl-cosmic-visualizations.git
  2. Navigate to the project directory:

    cd webgl-cosmic-visualizations
  3. Start a local server:

    # Using Python (Python 3)
    python -m http.server
    
    # OR using Node.js http-server (if installed)
    http-server
  4. Open your browser and visit:

    http://localhost:8000
    

Controls

Mandelbulb Controls
  • Left Mouse Button + Drag: Rotate camera
  • Right Mouse Button + Drag: Pan camera
  • Mouse Wheel: Zoom in/out
  • R Key: Reset view
  • Q/E Keys: Increase/decrease fractal power
  • +/- Keys: Adjust iteration count
  • Space: Toggle auto-rotation
Particle System Controls
  • Mouse Movement: Influence particle flow
  • Left Click: Create attraction point
  • Right Click: Create repulsion point
  • Mouse Wheel: Adjust force strength
  • 1-4 Keys: Select different presets
  • R Key: Reset simulation
  • P Key: Pause/resume simulation

Project Structure

webgl-cosmic-visualizations/
├── index.html               # Landing page
├── src/
│   ├── js/
│   │   ├── mandelbulb.js    # Mandelbulb fractal implementation
│   │   ├── cosmicParticles.js # Particle system implementation
│   │   ├── math/            # Math utility functions
│   │   │   ├── matrix.js    # Matrix operations
│   │   │   └── noise.js     # Noise functions
│   │   └── common.js        # Shared functionality
│   ├── css/
│   │   └── styles.css       # Application styles
│   └── shaders/
│       ├── mandelbulb/      # Mandelbulb shaders
│       │   ├── vertex.glsl  # Vertex shader
│       │   └── fragment.glsl # Fragment shader with ray-marching
│       └── particles/       # Particle system shaders
│           ├── compute.glsl # Particle physics computation
│           ├── vertex.glsl  # Particle rendering vertex shader
│           └── fragment.glsl # Particle rendering fragment shader
├── assets/
│   ├── icons/               # UI icons
│   └── fonts/               # Custom fonts
└── pages/
    ├── mandelbulb.html      # Mandelbulb Explorer page
    └── cosmic-particles.html # Cosmic Particles page

Browser Compatibility

Browser Supported Versions Notes
Chrome 90+ Full functionality, best performance
Firefox 88+ Full functionality
Safari 14+ May have performance limitations on some effects
Edge 90+ Full functionality

Future Development

Planned features for upcoming releases:

  • Additional fractal types (Julia sets, Menger sponge)
  • VR support for immersive exploration
  • Export functionality for high-resolution renders
  • Audio reactivity for visualizations
  • Additional particle presets and behaviors
  • Custom shader editor for experimentation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Inspired by various WebGL demos and fractal mathematics
  • Special thanks to the WebGL and GLSL community for resources and tutorials
  • Fractal formulations based on research by Daniel White and Paul Nylander
  • Curl noise implementation inspired by Robert Bridson's paper on fluid simulation

WebGL Cosmic Visualizations - Explore the beauty of mathematical cosmos

GitHubIssuesDemo

Developed by Muhammad Ibrahim Kartal | [kartal.dev]

About

A high-performance WebGL 2.0 visualization framework for interactive 3D fractals and particle-based cosmic simulations, powered by GLSL shaders and written in pure JavaScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors