docs: "Trippy Raymarching" example - #2770
Conversation
|
pkg.pr.new packages benchmark commit |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.65, 1.23, 2.69, 4.61, 5.46, 8.64, 15.54, 17.62]
line [0.64, 1.31, 3.02, 4.58, 5.08, 7.77, 15.17, 16.89]
line [0.70, 1.37, 2.84, 4.69, 5.47, 8.88, 15.66, 18.24]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.26, 0.42, 0.52, 0.64, 0.86, 0.89, 1.10, 1.14]
line [0.26, 0.39, 0.52, 0.61, 0.80, 0.80, 0.96, 1.09]
line [0.24, 0.38, 0.49, 0.64, 0.87, 0.84, 1.05, 1.16]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.61, 1.51, 2.52, 4.58, 8.43, 17.80, 38.99, 77.88]
line [0.65, 1.46, 2.70, 4.57, 8.39, 17.81, 38.72, 77.55]
line [0.59, 1.54, 3.03, 4.47, 8.71, 18.74, 38.75, 79.26]
|
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased | ❔ Unknown |
|---|---|---|---|
| 0 | 322 | 0 | 0 |
import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):
| Test | tsdown |
|---|---|
| tgpu_init.ts | 259.52 kB ( |
| tgpu_initFromDevice.ts | 258.99 kB ( |
| tgpu_resolve.ts | 164.93 kB ( |
| tgpu_resolveWithContext.ts | 164.87 kB ( |
| tgpu_bindGroupLayout.ts | 69.27 kB ( |
| tgpu_mutableAccessor.ts | 66.27 kB ( |
| tgpu_accessor.ts | 66.26 kB ( |
| tgpu_privateVar.ts | 65.61 kB ( |
| tgpu_workgroupVar.ts | 65.60 kB ( |
| tgpu_const.ts | 64.85 kB ( |
| tgpu_fn.ts | 38.45 kB ( |
| tgpu_fragmentFn.ts | 38.45 kB ( |
| tgpu_vertexFn.ts | 38.27 kB ( |
| tgpu_computeFn.ts | 37.97 kB ( |
| tgpu_vertexLayout.ts | 27.08 kB ( |
| tgpu_comptime.ts | 14.77 kB ( |
| tgpu_unroll.ts | 1.66 kB ( |
| tgpu_slot.ts | 1.54 kB ( |
| tgpu_lazy.ts | 1.19 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — adds a "Trippy Raymarching" interactive docs example with a full-screen fragment shader rendering a 3D SDF scene with live controls and pointer/touch input.
- Add fragment shader raymarching example — a
palette-based color scheme, twist/wave/displacement SDF scene, half-Lambert lighting, and glow accumulation in the marching loop. - Add interactive controls — resolution scale, sphere spacing/base radius, max distance/raymarching steps, wave frequencies/amplitude, and twist factor via
defineControlssliders. - Add pointer and touch input — maps pointer/touch coordinates to a world-space mouse uniform that offsets the SDF scene.
- Add resolution scaling — manual
ResizeObserver+ DPR-aware canvas sizing with a user-adjustable scale slider for performance tuning. - Add cleanup —
AbortControllerfor event listeners,ResizeObserver.disconnect(),cancelAnimationFrame(), androot.destroy().
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
Pull request overview
Adds a new interactive docs example showcasing a “trippy” 3D SDF/raymarching scene, fitting into the TypeGPU docs examples gallery under the rendering category.
Changes:
- Introduces a new raymarching example implementation (shader + controls + cleanup).
- Adds example metadata (title/category/tags/cool factor) for discovery/sorting.
- Adds a minimal HTML entry with a canvas configured for pixelated rendering.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/typegpu-docs/src/examples/rendering/trippy-raymarching/meta.json | Registers the example in the docs gallery with metadata/tags. |
| apps/typegpu-docs/src/examples/rendering/trippy-raymarching/index.ts | Implements the raymarching scene, uniforms, interaction, resize handling, and controls/cleanup. |
| apps/typegpu-docs/src/examples/rendering/trippy-raymarching/index.html | Provides the canvas host element with image-rendering styles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "tags": ["raymarching", "visuals", "trippy", "sdf"], | ||
| "coolFactor": 6.7 |
| const cell = d.vec3f( | ||
| std.fract(twistedP.x * (1 / spacing) + -mouse.x * 2) * spacing - spacing / 2.0, | ||
| std.fract(twistedP.y * (1 / spacing) + mouse.y * 2) * spacing - spacing / 2.0, | ||
| std.fract(twistedP.z * (1 / spacing)) * spacing - spacing / 2.0, | ||
| ); |

Adds trippy interactive 3d sdf raymarching example.