docs: Fix camera orientation in "Monocular Light Injection" example - #2891
Open
pullfrog[bot] wants to merge 1 commit into
Open
docs: Fix camera orientation in "Monocular Light Injection" example#2891pullfrog[bot] wants to merge 1 commit into
pullfrog[bot] wants to merge 1 commit into
Conversation
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased | ❔ Unknown |
|---|---|---|---|
| 0 | 325 | 0 | 0 |
import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):
| Test | tsdown |
|---|---|
| tgpu_init.ts | 263.10 kB ( |
| tgpu_initFromDevice.ts | 262.56 kB ( |
| tgpu_resolve.ts | 161.75 kB ( |
| tgpu_resolveWithContext.ts | 161.68 kB ( |
| tgpu_bindGroupLayout.ts | 62.32 kB ( |
| tgpu_mutableAccessor.ts | 57.04 kB ( |
| tgpu_accessor.ts | 57.04 kB ( |
| tgpu_privateVar.ts | 55.73 kB ( |
| tgpu_workgroupVar.ts | 55.73 kB ( |
| tgpu_const.ts | 55.15 kB ( |
| tgpu_lazy.ts | 54.95 kB ( |
| tgpu_fragmentFn.ts | 39.68 kB ( |
| tgpu_fn.ts | 39.62 kB ( |
| tgpu_vertexFn.ts | 39.50 kB ( |
| tgpu_computeFn.ts | 39.20 kB ( |
| tgpu_vertexLayout.ts | 28.33 kB ( |
| tgpu_comptime.ts | 15.93 kB ( |
| tgpu_unroll.ts | 1.75 kB ( |
| tgpu_slot.ts | 1.70 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
|
pkg.pr.new No packages changed since release |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an iOS Safari camera-orientation issue in the “Monocular Light Injection” docs example by aligning its UV/crop pipeline with the other camera-based examples (apply uvTransform after a centered square crop, without swapping axes).
Changes:
- Removed
swapAxesfrom the camera frame transform path and from all GPU/CPU parameter plumbing. - Updated preprocessing and relighting sampling to always use the external texture’s native dimensions for the centered square crop, then apply
uvTransform. - Simplified frame option/types passed through the example (camera session → renderer → inference preprocess → shaders).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| apps/typegpu-docs/src/examples/image-processing/monocular-light-injection/shaders.ts | Drops swapAxes from uniforms and samples/crops using native texture dimensions before applying uvTransform. |
| apps/typegpu-docs/src/examples/image-processing/monocular-light-injection/renderer.ts | Removes swapAxes state and stops passing/writing it through render + inference params. |
| apps/typegpu-docs/src/examples/image-processing/monocular-light-injection/inference/preprocess.ts | Removes swapAxes from preprocess options/uniforms and uses native texture dimensions for crop + uvTransform. |
| apps/typegpu-docs/src/examples/image-processing/monocular-light-injection/index.ts | Updates static-image render path to match the new frame options (no swapAxes). |
| apps/typegpu-docs/src/examples/image-processing/monocular-light-injection/camera-session.ts | Removes swapAxes from DepthCameraFrame and iOS orientation transforms (UV rotation only). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 [1.02, 1.99, 4.47, 6.78, 8.32, 11.54, 26.02, 26.68]
line [0.93, 1.89, 4.12, 6.99, 7.77, 11.68, 25.15, 24.12]
line [0.94, 1.93, 4.36, 7.16, 8.21, 10.72, 23.86, 26.36]
---
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.29, 0.53, 0.72, 0.88, 1.14, 1.29, 1.55, 1.64]
line [0.32, 0.50, 0.77, 0.93, 1.11, 1.24, 1.54, 1.67]
line [0.34, 0.57, 0.67, 0.80, 1.09, 1.19, 1.35, 1.51]
---
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 [1.08, 2.69, 5.09, 7.88, 13.62, 27.47, 57.64, 120.02]
line [0.91, 2.25, 3.49, 7.60, 13.06, 27.31, 58.10, 118.69]
line [0.90, 2.35, 3.69, 7.20, 12.82, 26.60, 56.37, 116.77]
|
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.
Fixes #2890.
The camera sometimes appeared rotated 90° on iOS Safari in the "Monocular Light Injection" example. The orientation fix already exists in the other camera examples (see selfie-segmentation, commit
a49d357): auvTransformmatrix derived fromscreen.orientation.type, applied asuvTransform * (sourceUv - 0.5) + 0.5when sampling the external camera texture.The monocular example used the same rotation matrices but additionally swapped the source texture's width/height axes (
swapAxes) before the square-crop + rotation for portrait orientations. That extra axis-swap diverged from the verified-working pattern and is what rotated the camera for portrait captures.This removes
swapAxesend-to-end (camera-session.ts,index.ts,renderer.ts,shaders.ts,inference/preprocess.ts), aligning the geometry exactly with the other camera examples: identical rotation matrices, a centeredmin(w,h)square crop, no axis swap, and consistent mirror handling between the depth-inference input crop and the displayed relit/color view.Validation:
apps/typegpu-docspnpm run test:types(astro check): 0 errorsoxlinton the example: 0 warnings/errorsoxfmt --checkon the changed files: passesreviewfrogself-review: no actionable defects foundDeepSeek Flash(free via Pullfrog for OSS) | 𝕏