Skip to content

feat: Attractors example#1949

Merged
aleksanderkatan merged 21 commits intofeat/tgpu-threefrom
feat/attractors
Dec 3, 2025
Merged

feat: Attractors example#1949
aleksanderkatan merged 21 commits intofeat/tgpu-threefrom
feat/attractors

Conversation

@aleksanderkatan
Copy link
Contributor

No description provided.

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

pkg.pr.new

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

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@240e292839c57878557e1507cdedb326a0359f1a
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@240e292839c57878557e1507cdedb326a0359f1a
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@240e292839c57878557e1507cdedb326a0359f1a

benchmark
view benchmark

commit
view commit

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new Three.js example demonstrating GPU compute-based particle simulation with multiple attractors. The example is based on the Three.js TSL compute attractors particles example and showcases integration between TypeGPU and Three.js for compute shaders, implementing gravitational attraction and spinning forces on a large number of particles (262,144 particles).

Key Changes:

  • Implements a GPU-accelerated particle system with customizable attractor physics
  • Provides interactive controls for manipulating attractors using Three.js TransformControls
  • Includes extensive UI controls for adjusting simulation parameters in real-time

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
apps/typegpu-docs/src/examples/threejs/attractors/meta.json Adds metadata configuration defining the example's title, category, and experimental tag
apps/typegpu-docs/src/examples/threejs/attractors/index.html Provides minimal HTML structure with a canvas element configured to fit its container
apps/typegpu-docs/src/examples/threejs/attractors/index.ts Implements the complete particle simulation with GPU compute shaders, Three.js rendering, attractor physics, and interactive controls

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@aleksanderkatan aleksanderkatan marked this pull request as ready for review December 2, 2025 17:30
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!

This reverts commit a4fde76.
@aleksanderkatan aleksanderkatan merged commit bdee185 into feat/tgpu-three Dec 3, 2025
2 of 3 checks passed
@aleksanderkatan aleksanderkatan deleted the feat/attractors branch December 8, 2025 15:30
iwoplaza added a commit that referenced this pull request Dec 22, 2025
)

* feat: tgpu.comptime, tgpu.rawCodeSnippet and `this` allowed in TypeGPU
shader functions

* Fix tests

* Better docs for rawCodeSnippet

* Docs for comptime

* - Namable comptime - Turned `extensionEnabled` into a comptime function

* Fixes

* Add @typegpu/three package and Three.js integration example (very WIP)

* Update tgpuThree.ts

* Three.js types for example code view

* More tweaks and experiments

* More work

* A bit more work

* More work

* Using @typegpu/noise in Three.js

* Add a new example

* Testing compute in Three.js

* Update examples

* Update typegpu-material.ts

* Update index.ts

* Some more work

* Works again

* TypeGPU compute shaders in TSL!

* A bit of a refactor of the cloth example

* Cleanup 🧹

* Comparing Three and TypeGPU output

* triNoise3D in TypeGPU

* comptime

* Support for 'this' in TypeGPU shader functions

* Update verlet.ts

* feat: Attractors example (#1949)

* Tweaks

* feat: Tweaks to feat/tgpu-three (#1954)

* Some review fixes

* Thumbnails and tags

* Comptime fromTSL

* Update shellless.test.ts

* fix: Calling `toTSL` multiple times (#1974)

* feat: Inform user about type mismatches (#1988)

* Fix renderer resizing when browser zoom

* docs: Cloth example controls (#1986)

* feat: ThreeJS 'Compute Particles' with tgpu (#1947)

* feat: ThreeJS 'Compute Geometry' with tgpu (#1948)

* feat: ThreeJS 'Compute Snow Particles' example in tgpu (#1972)

* fix: @typegpu/three toTSL should have a per-stage namespace (#1994)

---------

Co-authored-by: Iwo Plaza <iwoplaza@gmail.com>
Co-authored-by: Aleksander Katan <56294622+aleksanderkatan@users.noreply.github.com>
Co-authored-by: Rafal Lukosz <93160829+lursz@users.noreply.github.com>
Co-authored-by: Szymon Szulc <103948576+cieplypolar@users.noreply.github.com>
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.

3 participants