Custom large-scale partilces simulation in Three.js

Hello,

I am interested in large-scale particles simulation using Three.js, having no background in GPU programming, I found the unofficial class ParticleSystem best fit, however, I think it’s limited in terms of customizing the individual particles’ properties, such as setting each particle with a different material depending on some other individual variables. In this matter, I hope to receive some tips on whether it is advisable to use Threejs for large-scale particle simulation that requires many custom settings, such
as evolving a particles-based system or for soft rbots (such as a cloud or smoke) and being able to easily update each particle with different parameter settings.

Thanks in advance.

Three.js is capable of creating wonderful particle simulations, however, unless you’re willing to use unofficial libraries/helper classes, you pretty much have to build them up from scratch yourself. Without knowledge of GLSL it will probably prove to be very challenging, but it does grant you the most control over your simulation.

However, if you only need a specific effect, like cloud/smoke, you will probably find some ready-to-use code samples from the examples or posts on this forum, since particles are a pretty popular topic.

2 Likes

This is one of the reasons I created Polygonjs.
Creating a particles system that handles several variables will require you to create multiple shaders/textures to have those updated, and then you’ll have to customize your render material to fetch those variables properly.
It’s possible, but very time consuming and error prone in my opinion. I found it too distracting from actually working on the look & feel.

Have a look at this tutorial if you’re curious to know more. It’s all visual and node-based:

2 Likes

There are many interesting things, for example: • Atomize • GPGPU elastic-viscuous particles simulation

3 Likes

I think it also largely depends on what you mean when you say “large-scale” :wink:

for some people it’s 10,000 for some it’s 10,000,000

When talking about simulation, that’s also a very key point, what kind of behavior you wish to simulate.

Think about what’s your goal with this particle simulation, is it for visually pleasing rendering, or are you trying to reproduce some physical phenomena accurately?

1 Like

Thank you guys for all the replies.

@ DolphinIQ Thanks for your comment, I’d like to achieve shape-shifting particle system that changes it’s physical properties according to some external and internal dynamics inputs, I think I will built my own class in GLSL but not without checking the available projects and code samples.

@ gui Polygons looks nice! but I prefer to get my hands dirty with code. Nevertheless, I will check it if I stuck.

@prisoner849 Thanks for the links, it looks awesome, I have no prior experience with FBP Particles programming, I think I will start from your link.

@Usnul My target system is pretty as large as 10,000,000 or more (depending on my GPU capabilities).
I aim to implement many-particles system that collectively exhibit shape-shifting by using the boids steering rules (attraction, repulsion, orientation, maybe more) to achieve a final form that is an adaptation to certain irregularities in the simulation environment.

Is this for personal use only? Since that number is very huge and will exclude a huge percentage of devices in the world, being in browser gives us a huge audience unlike native games typically having a audience with rather high-end machines. So even though it is possible, it is just a question of the hardware then.

What is the actual goal of it, could you explain this a little more? A lot of things can be archived without performing expensive physically correct simulations.

@Fyrestar
It’s for academic use, the system simulates a flabby-like structure (composed of small particles), that collectively chose one action, such as exploring a 3D maze and reaching a target. Or collectively avoiding a moving glider while keeping its overall consistency. I hope this makes sense.
The greater the number of particles gets, the more life-like the system becomes.