CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 02-09-2013, 01:16 AM   #1
Jamone22
New Member
portfolio
Ben Lane
BSc 3D Computer Animation
Swansea Metropolitan
Swansea, United Kingdom
 
Join Date: Mar 2012
Posts: 13
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
 
Old 02-09-2013, 02:07 AM   #2
Aikiman
Pixel Collisions
 
Aikiman's Avatar
portfolio
Jeremy Raven
Wellington, New Zealand
 
Join Date: Jun 2005
Posts: 3,582
What are you going to do with that data? ie read only or use it somehow?
__________________
www.jeremyraven.co.nz
Vimeo
 
Old 02-09-2013, 10:09 AM   #3
Jamone22
New Member
portfolio
Ben Lane
BSc 3D Computer Animation
Swansea Metropolitan
Swansea, United Kingdom
 
Join Date: Mar 2012
Posts: 13
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.
 
Old 02-10-2013, 04:04 AM   #4
Aikiman
Pixel Collisions
 
Aikiman's Avatar
portfolio
Jeremy Raven
Wellington, New Zealand
 
Join Date: Jun 2005
Posts: 3,582
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.
__________________
www.jeremyraven.co.nz
Vimeo
 
Old 02-10-2013, 09:49 AM   #5
Jamone22
New Member
portfolio
Ben Lane
BSc 3D Computer Animation
Swansea Metropolitan
Swansea, United Kingdom
 
Join Date: Mar 2012
Posts: 13
Thanks for the reply, I'll give it a go and I'll post back my results.
 
Old 02-11-2013, 02:04 PM   #6
berniebernie
Schmppff...
 
berniebernie's Avatar
portfolio
Bernie B.
Paris, France
 
Join Date: Sep 2003
Posts: 1,581
Quote:
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

Code:
float $posi[] = `getParticleAttr -a 1 -at position "particle1`; print $posi; //prints an array with consecutive x,y,z values in order of particle Ids
__________________
It took God 7 days to create earth because he was using MentalRay.
showreel r/maya del.ici.ous
 
Old 02-11-2013, 08:33 PM   #7
Aikiman
Pixel Collisions
 
Aikiman's Avatar
portfolio
Jeremy Raven
Wellington, New Zealand
 
Join Date: Jun 2005
Posts: 3,582
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.
__________________
www.jeremyraven.co.nz
Vimeo
 
Old 02-11-2013, 09:39 PM   #8
animatedfox
what the ?!?!
 
animatedfox's Avatar
portfolio
Benjamin Fox
Seat 43
USA
 
Join Date: Feb 2010
Posts: 895
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?
 
Old 02-12-2013, 02:20 PM   #9
animatedfox
what the ?!?!
 
animatedfox's Avatar
portfolio
Benjamin Fox
Seat 43
USA
 
Join Date: Feb 2010
Posts: 895
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.
 
Old 02-13-2013, 08:39 PM   #10
Aikiman
Pixel Collisions
 
Aikiman's Avatar
portfolio
Jeremy Raven
Wellington, New Zealand
 
Join Date: Jun 2005
Posts: 3,582
Quote:
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.
__________________
www.jeremyraven.co.nz
Vimeo

Last edited by Aikiman : 02-13-2013 at 09:05 PM.
 
Old 02-14-2013, 02:10 PM   #11
animatedfox
what the ?!?!
 
animatedfox's Avatar
portfolio
Benjamin Fox
Seat 43
USA
 
Join Date: Feb 2010
Posts: 895
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.
 
Old 02-15-2013, 01:19 AM   #12
Aikiman
Pixel Collisions
 
Aikiman's Avatar
portfolio
Jeremy Raven
Wellington, New Zealand
 
Join Date: Jun 2005
Posts: 3,582
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.



Quote:
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.
__________________
www.jeremyraven.co.nz
Vimeo
 
Old 05-02-2013, 11:55 PM   #13
Jamone22
New Member
portfolio
Ben Lane
BSc 3D Computer Animation
Swansea Metropolitan
Swansea, United Kingdom
 
Join Date: Mar 2012
Posts: 13
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
 
Old 05-02-2013, 11:55 PM   #14
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:09 PM.


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