Extract particle information

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  02 February 2013
Post Extract particle information

I was wondering is anyone could help me out with a project I am doing. Basically I have a large flow of particles and I want to extract information from some of those particles (eg velocity, mass), if they are within a certain area (maybe defined my a bounding box or some such thing).

Firstly is this even possible and secondly could someone point me in the right direction? Don't need a finished thing necessarily, just somewhere to start from

Thanks
 
  02 February 2013
What are you going to do with that data? ie read only or use it somehow?
__________________
Vimeo
 
  02 February 2013
Read out and use

I am hoping to store the information externally from maya (in a text file possibly), and then read it back in to a new particle system in another project.
 
  02 February 2013
okay, Im probably not much help as my approach was more node based read only or do something while inside Maya.

So Im not really a programming expert but I would think it would go like this. I assume it can be done in mel or the API - the method would be very similar but obviously the functions will be different.

Grab particleShape world positions and bounding volume in question. Check to see if positions of particles are inside volume. If yes, store those particles in array and extract the required attributes from those particles, store in another array for each attribute and write to file.

Hope that helps even just a little bit.
__________________
Vimeo
 
  02 February 2013
Thanks for the reply, I'll give it a go and I'll post back my results.
 
  02 February 2013
Originally Posted by Jamone22: Thanks for the reply, I'll give it a go and I'll post back my results.


I'd use soup because it's exactly what it was made for

Otherwise in mel a simple way to grab some infos is for instance


float $posi[] =  `getParticleAttr -a 1 -at position "particle1`;
print $posi;
//prints an array with consecutive x,y,z values in order of particle Ids
__________________
maya@reddit r/maya
 
  02 February 2013
Yep I thought about SouP and actually the more I do the mor this could work although I did have problems trying to isolate the particles in the bounding area using the group node. But creating your own array containers is easy so one could just query those containers for position, mass etc.
__________________
Vimeo
 
  02 February 2013
As for writing the info out, is there any format requirements on the other side? It will be a bit easier to format the data if you are game/able to use Python. Is that something you are up for?
 
  02 February 2013
In thinking a bit more about this you could grab particles in a whole range of areas by using fields to define the areas you want to grab. There are the standard volume fields with those shapes...but basically, as long as a field is affecting a particle, even in a totaly unnoticable way, you can 'trigger' something. You could use something as detailed as one of those crazy volume curves if you really wanted a specific region of particles.

The attribute you need is created as you add fields to affect a particle.
It is called .inputForce[#] the number is usually incremental in order of affecting the particle. So the first field you affect the particle with would be .inputForce[0] and up from there.

Your trigger expression could be something like this:

if (particleShape1.inputForce[0]>.01)
{
print "Run my awesome script!";
}
else
{
//Anxiously wait in aticipation of running awesome script
}

I want to stress that the field affect can be so small that there will be no noticable affect on the sim...so don't worry about that.
To me the ease of this setup and shape options with the fields is pretty hard to beat...even by the amazingness of SOUP.
 
  02 February 2013
Originally Posted by animatedfox: To me the ease of this setup and shape options with the fields is pretty hard to beat...even by the amazingness of SOUP.


Be interesting to see the difference in execution time of both methods especially when running tens of thousands of particles. One would be querying every single particle every frame, the other would be piping data to a node on demand ie not every frame. In terms of shape options you could use any shape as a bounding object in SouP, with fields you are limited to the standard shapes.

Then again it depends on his requirements.
__________________
Vimeo

Last edited by Aikiman : 02 February 2013 at 09:05 PM.
 
  02 February 2013
I hear you Aikiman, and you are right on with the speed comment. I have no doubt that Soup would be speedier. Though I do find the mesh object bouding mode in Soup can be a bit chuggy as every vert gets a bouding object
(But more likely because I don't know what I am doing.)
Just suggesting a vanilla Maya option, because for me Soup has yet to be fully accepted by my work pipeline.

But as for shape options, dont forget the volume curve...any curve you make can be a shape for a field and then you can do all sorts of falloff options. And I haven't tried this, but I wonder if you can use the nucleus object field generation in the way. Worth looking into...someday.
 
  02 February 2013
It can get clunky but in this case you are just using a group bounding object as the component selector, the particles just become points in question that become referenced - meaning you're not using the particles as bounding objects. Having said that it could still be interesting to see a speed test.

I still dont know if its possible in SOuP but it does look possible, Im going to have a play and see what I come up with.

As for curve field, thats a nice idea. You can also input curve as bounding object and affect the radius of influence using the ramp widget on the bound node with visual feedback.
I totally agree with what works in current pipeline, if SOuP is not part of it then your method with expressions is completely valid.



Originally Posted by animatedfox: I hear you Aikiman, and you are right on with the speed comment. I have no doubt that Soup would be speedier. Though I do find the mesh object bouding mode in Soup can be a bit chuggy as every vert gets a bouding object
(But more likely because I don't know what I am doing.)
Just suggesting a vanilla Maya option, because for me Soup has yet to be fully accepted by my work pipeline.

But as for shape options, dont forget the volume curve...any curve you make can be a shape for a field and then you can do all sorts of falloff options. And I haven't tried this, but I wonder if you can use the nucleus object field generation in the way. Worth looking into...someday.
__________________
Vimeo
 
  05 May 2013
Thanks guys

Thank you all for the comments and the help. They were all appreciated. I have managed to get the information I needed and stored. I can post the code if anyone is interested in seeing the method. Also figured out how to read specifics back into Maya is thats of interest too.

Thank again everyone, really helpful
 
  05 May 2013
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:33 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.