docs: Add an SDF version of the OS Awards Statuette#2607
Open
reczkok wants to merge 1 commit into
Open
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (355 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
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.79, 1.57, 3.31, 5.15, 6.04, 8.17, 17.25, 19.50]
line [0.80, 1.64, 3.52, 4.70, 5.77, 9.31, 18.18, 20.29]
line [0.83, 1.65, 3.45, 5.06, 5.92, 9.54, 17.23, 20.35]
---
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.47, 0.64, 0.69, 0.97, 1.05, 1.19, 1.30]
line [0.33, 0.48, 0.62, 0.68, 0.98, 1.01, 1.23, 1.36]
line [0.23, 0.46, 0.56, 0.69, 0.97, 0.99, 1.19, 1.34]
---
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.79, 1.77, 3.32, 5.18, 10.20, 21.56, 45.54, 91.90]
line [0.79, 1.79, 3.03, 6.23, 10.66, 21.56, 45.57, 93.56]
line [0.74, 1.84, 3.29, 5.15, 10.13, 21.22, 46.03, 92.31]
|
There was a problem hiding this comment.
Pull request overview
This PR adds a ray-marched SDF-based renderer for the OS Awards statuette example and refactors the existing mesh-based renderer into shared “common” modules so the demo can switch between SDF and mesh rendering modes.
Changes:
- Added an SDF shape definition, UV atlas mapping, and an SDF renderer with epoxy interior tracing.
- Refactored environment sampling, PBR helpers, and material sampling into
common/and updated the main example to use a shared bind group. - Added a mesh-renderer module and a UI control to toggle between
sdfandmeshrenderers.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/typegpu-docs/src/examples/rendering/os-awards/sdf/uv.ts | Adds UV region selection/atlas coefficients for the SDF award. |
| apps/typegpu-docs/src/examples/rendering/os-awards/sdf/shape.ts | Defines SDF primitives/ops composing the award + epoxy wood block and bounds. |
| apps/typegpu-docs/src/examples/rendering/os-awards/sdf/renderer.ts | Implements SDF ray marching + epoxy shading/path tracing logic. |
| apps/typegpu-docs/src/examples/rendering/os-awards/scene.ts | Tweaks camera zoom range and adds scene.sdfEpoxy parameters used by the SDF renderer. |
| apps/typegpu-docs/src/examples/rendering/os-awards/mesh/renderer.ts | Extracts the mesh pipeline into a dedicated renderer module. |
| apps/typegpu-docs/src/examples/rendering/os-awards/index.ts | Refactors the example entrypoint to shared bind group + renderer toggle + inverse transform uniform. |
| apps/typegpu-docs/src/examples/rendering/os-awards/common/shading.ts | Centralizes bind group layout, tonemapping, env/material sampling, and shared shading helpers. |
| apps/typegpu-docs/src/examples/rendering/os-awards/common/pbr.ts | Extracts PBR utility functions used by shading. |
| apps/typegpu-docs/src/examples/rendering/os-awards/common/model.ts | Simplifies texture creation options (conditional viewFormats). |
| apps/typegpu-docs/src/examples/rendering/os-awards/common/cubemap.ts | Adds shared equirect->cubemap conversion and direction/UV helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+3
| import tgpu, { d, std, type TgpuRoot } from 'typegpu'; | ||
| import { type loadModel, ModelVertex } from '../common/model.ts'; | ||
| import { |
Comment on lines
+179
to
+181
| destroy() { | ||
| resizeObserver.unobserve(canvas); | ||
| }, |
Comment on lines
+91
to
+95
| const shadeEpoxyWood = (hit: d.v3f, normal: d.v3f): d.v3f => { | ||
| 'use gpu'; | ||
| const worldWoodNormal = modelDirToWorld(normal); | ||
| const uv = awardUv(hit, d.vec3f(1, 0, 0)); | ||
| const woodAlbedo = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.