React Accretion Shaders
React accretion with raymarching and refraction. Cosmic disk effects for Next.js with TypeScript and shadcn/ui—free code.
Powered by
Building accretion disk effects?
Join our Discord community for help from other developers working with raymarching and cosmic effects.
Need stunning accretion disk effects with realistic refraction and turbulence? Most developers struggle with complex 3D raymarching or can't achieve the intricate turbulence patterns of cosmic phenomena. This React accretion component uses GPU raymarching with polar coordinates to create authentic accretion disk visualization with refraction effects.
Copy-paste TypeScript component that creates mesmerizing accretion disk effects with raymarching algorithms, turbulence refraction, and polar coordinate transformations. Advanced cosmic physics with customizable parameters. Built for Next.js applications with shadcn/ui design system. GPU-accelerated—smooth cosmic disk rotation.
React accretion with raymarching and refraction
Cosmic accretion disk with turbulence, refraction effects, and polar coordinate mapping:
Original shader by XorDev - "Accretion"
Perfect for React 19, Next.js 15, and modern TypeScript projects. Accretion effects generated entirely on GPU using raymarching with polar coordinate transformations. Customizable speed, turbulence, depth, brightness, and color shifting. Full shadcn/ui compatibility with Tailwind CSS styling.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/accretion-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/accretion-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/accretion-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/accretion-shaders.json
Usage
import { AccretionShaders } from "@/components/ui/accretion-shaders";
export default function CosmicAccretion() {
return (
<AccretionShaders
speed={1.0}
turbulence={1.2}
depth={1.0}
brightness={1.1}
colorShift={1.0}
>
<div className="relative z-10">
<h1>Content over accretion disk</h1>
</div>
</AccretionShaders>
);
}
Why accretion disk effects require advanced techniques
Simple 2D rotation effects can't capture the complex 3D structure of accretion disks. Static turbulence patterns lack the dynamic flow of cosmic matter. Most approaches can't handle the polar coordinate transformations needed for disk geometry. Traditional methods struggle with the refraction effects that make matter appear to bend and flow.
GPU raymarching solves this with authentic 3D space traversal. Polar coordinate transformations create natural disk geometry. Multi-layer turbulence functions simulate magnetic field interactions. Refraction effects from adding the raymarch iterator create unique visual distortions. Distance-based coloring provides realistic brightness falloff.
This React accretion component uses professional astrophysical visualization techniques. Raymarching traces paths through 3D space. Polar coordinates naturally model disk structures. Turbulence layers create complex matter flow patterns. Tanh tone mapping handles extreme brightness ranges.
React accretion shader features
- Raymarching algorithms - 3D space traversal for authentic volumetric rendering
- Polar coordinate transformation - Natural disk geometry with atan2 angular mapping
- Multi-layer turbulence - Complex matter flow simulation with sine wave synthesis
- Refraction effects - Unique visual distortions from iterator-based turbulence interaction
- Distance-based coloring - Realistic brightness falloff with 3D depth calculation
- Cylindrical distance functions - Authentic accretion disk shape with wave patterns
- Tanh tone mapping - Professional brightness compression for extreme dynamic ranges
- Customizable depth control - Adjust 3D perspective and disk thickness
- Turbulence intensity - Control matter flow complexity and refraction strength
- Speed variation - Animation timing for disk rotation and matter flow
- Brightness scaling - Overall intensity control for different environments
- Color phase shifting - Spectrum cycling with thermal radiation simulation
- TypeScript React component - Full IDE support with prop definitions
- Next.js compatible - Works with App Router and modern React patterns
- shadcn/ui integration - Consistent with Tailwind CSS design systems
- Copy-paste installation - No vendor lock-in, you own the shader code
API Reference
AccretionShaders
Main container component for the accretion disk effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Animation and rotation speed (0.5 to 2.0) |
turbulence | number | 1.0 | Matter flow and refraction intensity (0.5 to 2.0) |
depth | number | 1.0 | 3D perspective and disk thickness (0.5 to 2.0) |
brightness | number | 1.0 | Overall intensity multiplier (0.5 to 2.0) |
colorShift | number | 1.0 | Color spectrum cycling rate (0.5 to 2.0) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
GPU accretion troubleshooting
Disk rotation too slow/fast: Adjust speed
for comfortable viewing. Lower values create meditative cosmic rotation, higher values create dynamic matter flow.
Turbulence too calm/chaotic: Use turbulence
to control matter flow complexity. Higher values create more dramatic refraction and swirling patterns.
Disk appears flat/too 3D: Modify depth
for optimal 3D perspective. Lower values create flatter disks, higher values create pronounced thickness.
Effect too dim/bright: Use brightness
to adjust overall intensity. Accretion disks have extreme brightness ranges - adjust for your display.
Colors cycling too fast/slow: Adjust colorShift
for spectrum transition rate. This affects the thermal radiation color patterns.
Mobile performance: Reduce turbulence
to 0.8 and consider lower depth
values. Raymarching is intensive but well-optimized for mobile GPUs.
Refraction artifacts: The unique refraction effect is intentional and creates the characteristic matter flow appearance.
More React shader components
Explore other GPU-accelerated shader components for Next.js applications:
Singularity Shaders
Blackhole effects with gravitational lensing and accretion disk physics
Nebula Shaders
Procedural cosmic clouds with fractal structures and animated twinkling star fields
Cosmic Waves Shaders
Flowing cosmic ocean patterns with multi-layer waves and starfields
Cosmic Discs Shaders
Glowing radial arcs with concentric rings and polar coordinate mathematics
Plasma Shaders
Organic energy effects with flowing plasma patterns and smooth color cycling
Advanced Tunnel Shaders
3D tunnel with raymarching, bump mapping, and volumetric lighting effects
React accretion FAQ
React Abstract Mod Shaders
3D abstract raymarching with procedural geometry and atmospheric effects. Pure WebGL shaders for React with TypeScript and shadcn/ui—smooth GPU animations.
React Advanced Tunnel Shaders
React advanced tunnel with raymarching and lighting. 3D tunnel effects for Next.js with TypeScript and shadcn/ui—free code.