View Full Version : Particles intercollide - An idea!?
08 August 2005, 06:04 PM
I may have an idea of how to make particles collilde with eachother in Maya so we can make effects that may remind of Real Flow or Glue 3D fluid simulations. The thing is, since I don't know so mutch about Maya and itīs limmitations, I will need your help to tell me if this crazy idea may work or not...
I'm thinking about making a new node, we can call it "ppCollide" (or whathever). Our particle system will be connected to that node as a child (or something).
- What ppCollide will do is: For every frame, check the distance between the particles (will get to that later) and if they are closer than a value that the user will define, the node creates a spring between these particles.
-Every particle will be able to have a maximum of 8 connections (or 8 springs to other particles), but these are not common springs.
- The springs between the particles will act just as normal springs when they act as a force pushing the particles away from eachother, having the stiffness and damping controlling the viscosity of our "fluid" (higher stiffness + higher damping = lower viscosity).
- The springs will act differently when trying to pull the particles closer to eachother, becouse if the force trying to push them apart is higher than some user defined value, the ppCollide node will brake that connection by deleting the spring between the particles.
- Since it will be VERY CPU consuming to check the distance between ALL the particles for every frame... I thougt that this whole simmulation will happen inside a 3D fluid container. That way we (maybe) can use the voxels to limmit the calculation. So the distance between particles will only be calculated within the same voxel + the ones directly connected to it.
I know this is a pretty wild guess... but is it possible??
08 August 2005, 01:06 PM
Sounds cool enough, and I'm sure it's possible. To get you started there's a couple of plugins at highend3d that deal with particle interaction in different ways, some of them have source code availible.
I've had similar thoughts on using a grid to optimize distance calculations and collision tests, but it seems overly cumbersome to use an expensive node such as a fluidshape to create the grids - I suggest you let your plugin create its own (invisible) grid based on the bounding box of the particle system with voxel sizes set to the maximum test radius for the interaction. once all the particles have been located to a voxel, that voxel's index can be stored in an integer array corresponding to the particle array, and then it will probably be a fast operation to check whether a particle is in the same or adjacent voxel as the current particle.
08 August 2005, 03:12 PM
Your setup for smart particles is intriguing. It does seem CPU intensive. Have you considered using Push/Pull radial fields per particle? A Pull radial field with a weak strength and large radius (max distance) and a Push radial field with a high strength and a small raidus. Both fields use the particle as source and under fields extra attributes check off Per Particle. Observe fantastic examples here:
http://www.brentforrest.ca/realflow.htm and scroll down to the bottom where it says Faking RF with Maya Particles
You can go even farther with this setup by connecting the max distance of the fields to the scale of two nurbs circles making visual guides as to how large your fields are - this makes tweaking the sim much much easier.
08 August 2005, 04:39 PM
Anders - Thanx for the tips about the grid. I thougt that using a fluid container you could take advantage of the dynamic grid for velocity, so the "new fluid" can make swirls and stuff. But maybe it wouldn't be worth it...
Brentorama - I already know about the workarround using fields per particle. The particles may stack upon eachother, but the problem is that they never settle. They are constantly movig due to the fact that fields don't have de damping and the threshold for complete stop that the springs have. I know that my idea takes a lot of CPU, we would need to simulate and cache the result (the way you do in Real Flow), but I see it as a solution closer to a physical simulation then the ones available today.
08 August 2005, 08:00 PM
ah but you can achieve settling by setting your conserve memory to 0.995 and applying a drag field. Also, you can use layers of fields, use four intsead of two, get a layered field to simulate damping.
But hey, what do I know?
08 August 2005, 08:05 PM
When i made the tutorial threat today i found this:
I hope that will help you :)
08 August 2005, 08:40 PM
But hey, what do I know?
Sorry man, didn't mean to "sound" like I'm trying to outsmart you. I'm sure you know a lot more than I do in this subject and am thankful for your replies. Let me explain myself a little better:
It seems like fields have been used to simulate interparticular collisions for a while now, but I have yet not seen a convincing result with this technique (I may be wrong). I have also researched on this subject and it seems like the ones who work with Maya doing CG effects prefer to pay the significant amount o money for RF or Glue than use this technique, but they have no doubt about Maya's capability of doing this kind of simulation.
The reason I started this thread is not to search for different techniques to make particles collide with each other, we can start another thread for that. I think I may have an interesting idea of a new way of thinking but since Iím not an experienced Maya user/programmer, Iím asking more experienced users/programmers if this idea is even doable (before I put my *** trying it for like 3 months to discover it by myself).
Iím not looking for a high performance solution. Iím aiming for better looking results.
So my question is quite simple: Is this idea worth a shot or not? If it is, can anyone give me some good pointers?
08 August 2005, 08:52 PM
Was the tutorial i pointed out usefull, cause if that's something similar you are trying to archive well then the idea is very plausible. So i would check that tutorial out, but well thats just my suggestion.
08 August 2005, 09:06 PM
if you're checking anyways for particle distance at every frame (or sub-frame) then i can't think of a reason to use springs - you might as well calculate the effect of a spring through your node (or through expressions) and apply the calculation to the per-particle velocity.
creating and deleting spring connections will mostly just increase maya's workload - with a bit of physics and math, you can mimic the behaviour as easily on your own.
i would look at game development sites like gamasutra.com or gamedev.org to find resources on writing your own spring system. if you're using maya's particle expressions , i find it a good idea to maintain particle position and velocity between frames (i use global arrays) so that you're not having to constantly query each particle in world space.
08 August 2005, 09:14 PM
I thougt that using a fluid container you could take advantage of the dynamic grid for velocity, so the "new fluid" can make swirls and stuff. But maybe it wouldn't be worth it...
Yes it would definitely be worth being able to take advantage of fluid's capabilities, but the good maya programming practice would dictate you to make a field whose forces would add up with any other fields that the user connects to the particle (including fluids as fields). I proposed making a custom grid mainly because I believe it would be faster and more flexible than taking the detour of tapping into a fluid's attributes. I believe the api is also a bit limited as to how much it can communicate with fluids.
I've played a bit with double radial fields (one with negative magnitude and one with positive magnitude) acting on, and from particles and I didn't find it to hard to make them settle.
Note also that the attributes of fields with apply per vertex turned on can be set dynamically on a per particle basis (search for "per particle field attributes" in the manual for a tutorial). That can get you real far.
08 August 2005, 09:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.