Examples โ
Status: Coming Soon
Examples are being rebuilt to showcase the new 3Lens architecture.
Overview โ
3Lens examples are organized by category, each demonstrating specific features and contracts of the new architecture. All examples will follow the same structure and can be run locally with pnpm dev.
Example Categories โ
๐ Getting Started โ
Quick start guides for different setups - from minimal one-file examples to full Vite plugin integration.
| Example | Description | Status |
|---|---|---|
| Minimal Setup | Absolute minimal - one file | ๐ Coming Soon |
| Vanilla Three.js | Standard three.js with 3Lens | ๐ Coming Soon |
| Vite Plugin | Zero-config with @3lens/vite-plugin | ๐ Coming Soon |
| Web Components | Using <three-lens-overlay> | ๐ Coming Soon |
| Bootstrap API | bootstrap3Lens() one-liner | ๐ Coming Soon |
๐ Framework Integration โ
Framework-specific setups with mount kits and host integrations.
| Example | Framework | Host | Status |
|---|---|---|---|
| React Basic | React | manual | ๐ Coming Soon |
| React Three Fiber | React + R3F | r3f | ๐ Coming Soon |
| Vue Basic | Vue 3 | manual | ๐ Coming Soon |
| Vue TresJS | Vue + TresJS | tres | ๐ Coming Soon |
| Angular | Angular | manual | ๐ Coming Soon |
| Svelte Basic | Svelte | manual | ๐ Coming Soon |
| Svelte Threlte | Svelte + Threlte | manual | ๐ Coming Soon |
| Next.js | Next.js 14+ | r3f | ๐ Coming Soon |
| Nuxt | Nuxt 3 | tres | ๐ Coming Soon |
๐ Inspector Addon โ
Entity graph browser and blame navigator demos.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Scene Browser | Entity graph hierarchy | ๐ Coming Soon |
| Entity Search | Query engine | ๐ Coming Soon |
| Blame Navigator | Attribution chains | ๐ Coming Soon |
| Five Questions | Inspector contract | ๐ Coming Soon |
| Selection Sync | Global selection | ๐ Coming Soon |
| Relationships | Entity edges | ๐ Coming Soon |
โก Performance Addon โ
GPU/CPU attribution and profiling.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Frame Timing | Per-frame capture | ๐ Coming Soon |
| Draw Call Attribution | Attribution to objects | ๐ Coming Soon |
| Hotspot Detection | Query engine | ๐ Coming Soon |
| Cost Heatmap | Visual overlay | ๐ Coming Soon |
| Capture Modes | MINIMAL/STANDARD/DEEP | ๐ Coming Soon |
| Fidelity Labels | EXACT/ESTIMATED/UNAVAILABLE | ๐ Coming Soon |
๐ง Memory Addon โ
Resource lifecycle and leak detection.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Resource Lifecycle | Create/dispose tracking | ๐ Coming Soon |
| Leak Detection | Undisposed resources | ๐ Coming Soon |
| Texture Analysis | Texture memory | ๐ Coming Soon |
| Geometry Analysis | Geometry memory | ๐ Coming Soon |
| Material Sharing | Shared vs duplicated | ๐ Coming Soon |
๐ Diff Addon โ
Frame/trace comparison.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Frame Diff | Compare two frames | ๐ Coming Soon |
| Trace Diff | Compare traces | ๐ Coming Soon |
| Entity Changes | Changes over time | ๐ Coming Soon |
| Cost Regression | Performance regression | ๐ Coming Soon |
๐จ Shader Addon โ
Shader introspection and analysis.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Variant Browser | Compiled variants | ๐ Coming Soon |
| Uniform Inspector | Uniform values | ๐ Coming Soon |
| Define Analysis | #define combinations | ๐ Coming Soon |
| WebGPU Pipelines | Pipeline inspection | ๐ Coming Soon |
๐ผ Trace & Replay โ
Recording and replaying sessions.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Record Session | CLI recording | ๐ Coming Soon |
| Replay Offline | Offline viewer | ๐ Coming Soon |
| Export Profiles | MINIMAL/STANDARD/FULL | ๐ Coming Soon |
| Share Redacted | Data redaction | ๐ Coming Soon |
๐ Multi-Context โ
Multiple renderers, scenes, and cameras.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Dual Renderer | Two renderers | ๐ Coming Soon |
| Minimap | Main + minimap | ๐ Coming Soon |
| WebGL + WebGPU | Mixed backends | ๐ Coming Soon |
| Context Switching | UI context selector | ๐ Coming Soon |
๐ท Worker & OffscreenCanvas โ
Background rendering scenarios.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Offscreen Basic | Worker host | ๐ Coming Soon |
| Transport Channel | PostMessage | ๐ Coming Soon |
| Remote UI | Split render/UI | ๐ Coming Soon |
๐ฅ๏ธ UI Surfaces โ
Different UI modes and layouts.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Overlay Mode | Floating panel | ๐ Coming Soon |
| Dock Left/Right/Bottom | Docked panels | ๐ Coming Soon |
| Separate Window | DevTools window | ๐ Coming Soon |
| Minimal HUD | Tiny overlay | ๐ Coming Soon |
| Theming | CSS variables | ๐ Coming Soon |
๐ง CLI & Tooling โ
Command-line workflows.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Trace Record | 3lens trace:record | ๐ Coming Soon |
| Trace Diff | 3lens diff | ๐ Coming Soon |
| Query Hotspots | 3lens query | ๐ Coming Soon |
| Doctor | 3lens doctor | ๐ Coming Soon |
๐ Addon Development โ
Building custom addons.
| Example | Feature Demonstrated | Status |
|---|---|---|
| Minimal Addon | Basic structure | ๐ Coming Soon |
| Custom Panel | UI panel | ๐ Coming Soon |
| Custom Query | Query registration | ๐ Coming Soon |
| Custom Events | Event emission | ๐ Coming Soon |
๐ Security & Enterprise โ
CSP, enterprise constraints.
| Example | Feature Demonstrated | Status |
|---|---|---|
| CSP Safe Mode | No inline styles | ๐ Coming Soon |
| Style Nonce | Nonce support | ๐ Coming Soon |
| Dev-Only Loading | Conditional load | ๐ Coming Soon |
| URL Toggle | ?3lens=1 | ๐ Coming Soon |
๐ฎ Real-World Apps โ
Complete application examples.
| Example | Features Used | Status |
|---|---|---|
| Model Viewer | Inspector, Memory | ๐ Coming Soon |
| Particle System | Perf, Memory | ๐ Coming Soon |
| Physics Game | Multi-Context, Perf | ๐ Coming Soon |
| VR Experience | Inspector, Perf | ๐ Coming Soon |
๐งช CI/CD Integration โ
Automated testing.
| Example | Feature Demonstrated | Status |
|---|---|---|
| GitHub Actions | CI workflow | ๐ Coming Soon |
| Performance Budget | Regression detection | ๐ Coming Soon |
| Contract Validation | 3lens validate | ๐ Coming Soon |
Architecture Overview โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your App โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Mount Kit (optional) โ Host Integration โ
โ @3lens/mount-react โ @3lens/host-manual โ
โ @3lens/mount-vue โ @3lens/host-r3f โ
โ @3lens/mount-angular โ @3lens/host-tres โ
โ @3lens/mount-svelte โ @3lens/host-worker โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ @3lens/runtime โ
โ createLens() โข registerContext() โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Addons โ UI โ
โ @3lens/addon-inspector โ @3lens/ui-core โ
โ @3lens/addon-perf โ @3lens/ui-web โ
โ @3lens/addon-memory โ โ
โ @3lens/addon-diff โ โ
โ @3lens/addon-shader โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ @3lens/kernel โ
โ Capture โข Entity Graph โข Query โข Trace โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Quick Start Preview โ
Install 3Lens:
npm install @3lens/devtoolsThen set up your lens:
import { createLens, manualHost, uiOverlay } from "@3lens/devtools";
const lens = createLens({
ui: uiOverlay(),
addons: ["inspector", "perf", "memory"],
});
lens.registerContext({
id: "main",
host: manualHost({ renderer, scene, camera }),
});
lens.attach();2
3
4
5
6
7
8
9
10
11
12
13
That's it! The 3Lens overlay will appear in your application. Press the toggle key (default: Ctrl+Shift+D) to show/hide the devtools panel.
Running Examples Locally โ
# Clone the repository
git clone https://github.com/adriandarian/3Lens.git
cd 3Lens
# Install dependencies
pnpm install
# Run a specific example
cd examples/getting-started/minimal
pnpm dev2
3
4
5
6
7
8
9
10
Stay Updated โ
- Watch the GitHub repository for updates
- Check the Changelog for release notes
- Join Discussions for Q&A
Contributing โ
Once core packages are stable, example contributions will be welcome!
See Contributing for guidelines.