Skip to content

feat(shaders): add angle and stretch to FractalNoise - #280

Merged
hunterbecton merged 3 commits into
mainfrom
t3/start-sha-309
Nov 3, 2026
Merged

hunterbecton merged 3 commits into
mainfrom
t3/start-sha-309

Conversation

@hunterbecton

Copy link
Copy Markdown
Member

Why

Composition 2's heat field is long streaks that climb at about 30°. FractalNoise could only draw untilted features, so the rough route at /dev/composition-2-rough drew blobs.

What changes

FractalNoise gains angle and stretch

The shader rotates the coordinate the noise reads, then divides it along the angle by stretch, so features run longer in that direction. The rotation happens in aspect-corrected space, so angle reads in on-screen degrees, the degrees FlutedGlass uses. The shader then undoes the aspect correction, so angle 0 and stretch 1 draw the old field and no baseline moves. Both props ride uniforms, and the new fractal-noise.test.tsx checks that changing them keeps the same mesh. The drift still morphs in place, and scale now counts features across the streaks. The internal remap constant that was named stretch is now spread.

The demo and the rough route set them

The FractalNoise demo gains Angle and Stretch sliders, which a composition's All props section also shows. The rough route sets angle 30 and stretch 3, and raises scale from 2.5 to 5 to thin the streaks.

Known limitations

FractalNoise samples in 0..1 uv, so on a wide canvas every feature already runs wider than it is tall. With these props, that widening turns with angle. On the 2.35:1 hero, a stretch of 3 draws streaks about 7 times longer than wide, and angle 90 at stretch 1 draws tall features. Making features round at stretch 1 would have moved every baseline. The visual spec still captures only the defaults, so no baseline pins a tilted field.

Closes SHA-309

Composition 2's heat field is long streaks that climb at about 30
degrees, and FractalNoise could only draw untilted features.

The shader rotates the sample coordinate in aspect-corrected space, so
`angle` reads in on-screen degrees, then divides the along-angle axis by
`stretch`. Undoing the aspect correction afterward keeps angle 0 and
stretch 1 identical to the old field, so no baseline moves. Both props
ride uniforms. The internal remap constant `stretch` is renamed to
`spread` so the prop has the name to itself.
…ition 2

The FractalNoise demo gains Angle and Stretch sliders, which also show in
a composition's All props section. The composition 2 rough route tilts
its field to 30 degrees with a stretch of 3, and doubles its scale to 5,
because scale now counts features across the streaks.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 11:24
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit b6dced9.

Copilot AI 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.

🟡 Changes recommended

The visual spec covers only the identity transform, leaving rotation and stretch untested; a frozen nondefault case on a nonsquare canvas and committed screenshot baselines are still needed.

1 open issue
What changed in this PR

Adds animatable angle and stretch props to FractalNoise so compositions can create tilted streaks while preserving the default field.

Changes:

  • Adds aspect-corrected rotation and stretching through stable uniforms.
  • Exposes demo controls and configures the rough composition with 30° streaks.
  • Adds mesh-stability tests and a minor-release changeset.
File Description
packages/​shaders/​src/​components/​fractal-noise/​shader.tsx Implements rotation and stretching of noise coordinates.
packages/​shaders/​src/​components/​fractal-noise/​fractal-noise.tsx Exposes and documents the new props and defaults.
packages/​shaders/​src/​components/​fractal-noise/​fractal-noise.test.tsx Checks prop types and mesh stability during updates.
apps/​docs/​src/​app/​dev/​composition-2-rough/​rough-scene.tsx Configures tilted, elongated heat-field features.
apps/​docs/​src/​app/​components/​fractal-noise/​scene.tsx Passes demo angle and stretch values to the component.
apps/​docs/​src/​app/​components/​fractal-noise/​params.ts Adds demo parameter types and defaults.
apps/​docs/​src/​app/​components/​fractal-noise/​demo.tsx Adds Angle and Stretch sliders.
.changeset/​fractal-noise-angle-stretch.md Documents the feature for a minor package release.

Review effort: Balanced

…tch 4

The default story sits at angle 0 and stretch 1, where the transform does nothing. A new /dev/fractal-noise-probe route draws the demo's field turned and stretched on a 16:9 canvas, and the spec screenshots it beside the default case.
Copilot AI balanced review requested due to automatic review settings November 3, 2026 11:56

Copilot AI 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.

🟢 Approval recommended

No active review issues block the addition of animatable angle and stretch controls to FractalNoise.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@hunterbecton
hunterbecton merged commit f485ca1 into main Nov 3, 2026
12 checks passed
@hunterbecton
hunterbecton deleted the t3/start-sha-309 branch November 3, 2026 12:04
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