Orbs / ORB-31
ORB-31
raymarched shell, volumetric godrays
WebGPU isn't available in this browser
Installation
bash
npx expo install react-native-shader-orbs react-native-webgpu react-native-reanimated react-native-workletsUsage
typescript
import { ShaderOrb, orb31 } from "react-native-shader-orbs";typescript
<ShaderOrb orb={orb31} size={280} state="idle" interactive />Props
Component props
The props you'll use most. The ShaderOrb reference lists all of them.
| Prop | Type | Default | Description |
|---|---|---|---|
state | "idle" | "thinking" | "speaking" | "idle" | The mood. Eases the parameters toward that preset. |
size | number | 280 | Width and height in points. |
params | Record<string, number> | Parameter overrides by key, clamped to each range. See the shader params below. | |
colors | Record<string, string> | Hex colors by key. See the colors below. | |
volumes | { input?: number; output?: number } | Levels from 0 to 1 that the shader reads as input and output loudness. | |
interactive | boolean | false | Tap pulses the orb; holding makes it swell. |
quality | "auto" | "low" | "medium" | "high" | number | "auto" | Render scale. Lower is cheaper and softer. |
maxFps | number | 60 | Frame cap. |
paused | boolean | false | Stops drawing and keeps the last frame. |
onReady | () => void | Called once the first frame is on screen. | |
onError | (error: Error) => void | Called if the orb can't start. Without it the error is logged once. |
Shader params
Pass these through params. Values are clamped to the range shown. integrated parameters are phase clocks: the shader accumulates them over time, so the value acts as a rate.
| Key | Label | Range | Step | Default |
|---|---|---|---|---|
speed | Anim speed integrated | 0.015 to 10 | 0.05 | 1 |
sweepRate | Sweep rate integrated | 0 to 6 | 0.02 | 0.5 |
radius | Shell radius | 0.4 to 10 | 0.05 | 2.6 |
swell | Input swell | 0 to 3 | 0.015 | 0.18 |
warp | Warp divisor | 0.3 to 10 | 0.05 | 0.9 |
warpFreq | Warp frequency | 0.15 to 30 | 0.15 | 5.25 |
warpSwing | Warp swing | 0 to 8 | 0.05 | 0 |
freqSwing | Frequency swing | 0 to 15 | 0.05 | 0 |
smoothSwing | Softness swing | 0 to 2 | 0.005 | 0 |
smoothK | Blend softness | 0.015 to 4 | 0.02 | 0.42 |
rayGain | Godray gain | 0 to 4 | 0.02 | 0.8 |
rayFalloff | Godray falloff | 0.3 to 100 | 0.5 | 10.5 |
surfaceLit | Surface light | 0 to 3 | 0.015 | 0.105 |
ambient | Ambient | 0 to 1 | 0.005 | 0 |
alphaGain | Alpha gain | 0.05 to 15 | 0.1 | 3 |
edgeFade | Halo falloff | 0.1 to 0.985 | 0.015 | 0.45 |
camDist | Camera distance | 1.5 to 100 | 0.5 | 12 |
fov | Lens | 0.3 to 20 | 0.1 | 3.5 |
stepScale | Step safety | 0.3 to 30 | 0.5 | 9 |
maxDist | Max distance | 3 to 100 | 1 | 22 |
Moods
This orb ships presets for idle, speaking, thinking. Choosing a state eases the parameters toward that preset; anything you pass in params still wins.
Credits
Based on original work by XorDev, via shadercn. The shader is licensed for non-commercial use with attribution; see Licensing and credits.
Ported to React Native by @msobkyy.
Want to change something? Open ORB-31 in the playground.