Skip to content

feat: Perlin Noise derivatives #1457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jul 7, 2025
Merged

feat: Perlin Noise derivatives #1457

merged 18 commits into from
Jul 7, 2025

Conversation

iwoplaza
Copy link
Collaborator

@iwoplaza iwoplaza commented Jul 4, 2025

Changes:

  • More useful Configurable type
  • More efficient perlin2d implementation
  • perlin2d.sampleWithGradient with also returns the first derivative of the noise function (analytical solution)
  • Static and dynamic cache for perlin2d

Changes to CI:

  • More packages built in CI (@typegpu/noise, unplugin-typegpu)
  • Package URLs easier to copy

Copy link

github-actions bot commented Jul 4, 2025

pkg.pr.new

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

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@0272e322767da1e75c981c08a02a712012d216d2
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@0272e322767da1e75c981c08a02a712012d216d2
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@0272e322767da1e75c981c08a02a712012d216d2

benchmark
view benchmark

commit
view commit

@iwoplaza iwoplaza marked this pull request as ready for review July 6, 2025 22:40
});

const mainCompute = tgpu['~unstable'].computeFn({
workgroupSize: [1, 1, 1],
Copy link
Contributor

Choose a reason for hiding this comment

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

We should consider making this more than one - if we look at our examples (game of life and fluid with atomics) there are significant performance gains when using higher workgroup sizes

Copy link
Contributor

Choose a reason for hiding this comment

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

We should benchmark this but I think having workgroups at least a wavefront size (64 - which is 2 warps) with boundary checks inside the shader will be universally more performant

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's try to make this a separate PR. Could you try this out @reczkok?

Copy link
Contributor

Choose a reason for hiding this comment

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

I will create a task for it

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@reczkok reczkok left a comment

Choose a reason for hiding this comment

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

Great work!

@iwoplaza iwoplaza merged commit 9848b15 into main Jul 7, 2025
6 checks passed
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