Skip to content

docs: "Trippy Raymarching" example - #2770

Open
vende11s wants to merge 3 commits into
mainfrom
docs/trippy-raymarching-example
Open

docs: "Trippy Raymarching" example#2770
vende11s wants to merge 3 commits into
mainfrom
docs/trippy-raymarching-example

Conversation

@vende11s

Copy link
Copy Markdown
Collaborator

Adds trippy interactive 3d sdf raymarching example.

download (5) download (6) download (7) download (8) download (9) download (10) download (2) download (4)

Copilot AI review requested due to automatic review settings July 29, 2026 10:58
@github-actions

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/eslint-plugin-typegpu@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/sdf@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@f73e8166c32d83fe4a55e69fa98433881f59096b
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@f73e8166c32d83fe4a55e69fa98433881f59096b

benchmark
view benchmark

commit
view commit

@github-actions

Copy link
Copy Markdown

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]
Loading
---
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]
Loading
---
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]
Loading

@github-actions

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 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 ($${\color{green}-3.2\%}$$)
tgpu_initFromDevice.ts 258.99 kB ($${\color{green}-3.4\%}$$)
tgpu_resolve.ts 164.93 kB ($${\color{green}-38.5\%}$$)
tgpu_resolveWithContext.ts 164.87 kB ($${\color{green}-38.5\%}$$)
tgpu_bindGroupLayout.ts 69.27 kB ($${\color{green}-74.2\%}$$)
tgpu_mutableAccessor.ts 66.27 kB ($${\color{green}-75.3\%}$$)
tgpu_accessor.ts 66.26 kB ($${\color{green}-75.3\%}$$)
tgpu_privateVar.ts 65.61 kB ($${\color{green}-75.5\%}$$)
tgpu_workgroupVar.ts 65.60 kB ($${\color{green}-75.5\%}$$)
tgpu_const.ts 64.85 kB ($${\color{green}-75.8\%}$$)
tgpu_fn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_fragmentFn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_vertexFn.ts 38.27 kB ($${\color{green}-85.7\%}$$)
tgpu_computeFn.ts 37.97 kB ($${\color{green}-85.8\%}$$)
tgpu_vertexLayout.ts 27.08 kB ($${\color{green}-89.9\%}$$)
tgpu_comptime.ts 14.77 kB ($${\color{green}-94.5\%}$$)
tgpu_unroll.ts 1.66 kB ($${\color{green}-99.4\%}$$)
tgpu_slot.ts 1.54 kB ($${\color{green}-99.4\%}$$)
tgpu_lazy.ts 1.19 kB ($${\color{green}-99.6\%}$$)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 defineControls sliders.
  • 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 cleanupAbortController for event listeners, ResizeObserver.disconnect(), cancelAnimationFrame(), and root.destroy().

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +4 to +5
"tags": ["raymarching", "visuals", "trippy", "sdf"],
"coolFactor": 6.7
Comment on lines +103 to +107
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,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants