# ORB-18

a crystal folded out of one eighth of space, tumbling

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).



<OrbPreview slug="orb-18" />

## Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add https://shadercn.vercel.app/r/orb-18.json
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Install the following dependencies:
      </Step>

      ```bash
      pnpm add vgpu
      ```

      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource src="components/orbs/orb-18.tsx" base="shadercn" title="components/orbs/orb-18.tsx" />

      <ComponentSource src="components/orbs/orbkit-core-wgpu.tsx" base="shadercn" title="components/orbs/orbkit-core-wgpu.tsx" />

      <ComponentSource src="components/orbs/orbkit-renderer.ts" base="shadercn" title="components/orbs/orbkit-renderer.ts" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

## Usage [#usage]

```tsx
import { Orb18 } from "@/components/orbs/orb-18";
```

```tsx
<Orb18 size={280} state="idle" />
```

## Props [#props]

### Component Props [#component-props]

| Prop             | Type                                                             | Default  | Description                                  |
| ---------------- | ---------------------------------------------------------------- | -------- | -------------------------------------------- |
| `state`          | `"idle" \| "thinking" \| "speaking"`                             | `"idle"` | Drive preset the orb eases toward            |
| `size`           | `number`                                                         | `280`    | Rendered size in CSS pixels                  |
| `params`         | `Partial<Record<string, number>>`                                | -        | Shader param overrides, see Shader Props     |
| `colors`         | `Partial<Record<string, string>>`                                | -        | Shader colour overrides as hex strings       |
| `statePresets`   | `Partial<Record<OrbState, Record<string, number>>>`              | -        | Replace the built-in per-state param presets |
| `stateColors`    | `Partial<Record<OrbState, Record<string, string>>>`              | -        | Replace the built-in per-state colours       |
| `stateVolumes`   | `Partial<Record<OrbState, { input?: number; output?: number }>>` | -        | Pin the drive volumes a state settles on     |
| `volumes`        | `{ input?: number; output?: number }`                            | -        | Drive the orb directly, bypassing synthesis  |
| `paused`         | `boolean`                                                        | `false`  | Freeze the frame loop                        |
| `pauseOffscreen` | `boolean`                                                        | `true`   | Stop rendering while scrolled out of view    |
| `maxDpr`         | `number`                                                         | `2`      | Upper bound on the device pixel ratio        |
| `className`      | `string`                                                         | -        | Class on the wrapper element                 |
| `style`          | `CSSProperties`                                                  | -        | Inline style on the wrapper element          |
| `ariaLabel`      | `string`                                                         | -        | Accessible name for the canvas               |

### Shader Props [#shader-props]

Pass any of these through `params`; each is a single `f32` uniform read by the shader.

| Param        | Label             | Range          | Step    | Default |
| ------------ | ----------------- | -------------- | ------- | ------- |
| `wander`     | Tumble            | `0` – `5`      | `0.02`  | `0.5`   |
| `camDist`    | Camera distance   | `1` – `50`     | `0.3`   | `4`     |
| `focal`      | Lens              | `0.15` – `15`  | `0.05`  | `1.5`   |
| `fold`       | Octant fold       | `0` – `1`      | `0.01`  | `1`     |
| `crease`     | Diagonal crease   | `0` – `1`      | `0.01`  | `1`     |
| `freq`       | Crystal frequency | `0.1` – `20`   | `0.05`  | `5`     |
| `stepScale`  | Step scale        | `0.02` – `2`   | `0.01`  | `0.3`   |
| `hue`        | Depth hue         | `0` – `4`      | `0.01`  | `1.5`   |
| `spread`     | Colour spread     | `0` – `3`      | `0.02`  | `1`     |
| `envRadius`  | Envelope radius   | `0.15` – `15`  | `0.1`   | `2.1`   |
| `envCore`    | Envelope core     | `0.3` – `1.02` | `0.01`  | `0.9`   |
| `fill`       | Body fill         | `0` – `20`     | `0.01`  | `0.02`  |
| `stepClamp`  | Step clamp        | `1` – `2000`   | `1`     | `40`    |
| `scatter`    | Diffusion         | `0` – `0.2`    | `0.001` | `0.004` |
| `exposure`   | Exposure          | `0.2` – `500`  | `0.5`   | `18`    |
| `contrast`   | Contrast          | `0.15` – `15`  | `0.05`  | `1.2`   |
| `saturation` | Saturation        | `0` – `4`      | `0.02`  | `1.25`  |
| `alphaGain`  | Alpha gain        | `0.05` – `15`  | `0.1`   | `2`     |
| `edge`       | Edge sharpness    | `0` – `1`      | `0.01`  | `1`     |
| `edgeFade`   | Halo falloff      | `0.1` – `3`    | `0.015` | `0.98`  |

Colours are passed through `colors` as hex strings.

| Colour | Label | Default   |
| ------ | ----- | --------- |
| `tint` | Tint  | `#ffffff` |

## Credits [#credits]

Shader by [XorDev](https://x.com/XorDev), ported from [orbkit](https://github.com/zzzzshawn/orbkit) (WebGL/GLSL) to WebGPU/WGSL.
