RE: copying particle instance from one cloud to another

Date : Wed, 19 Apr 2006 10:55:10 -0400
To : <XSI(at)Softimage.COM>
From : "Mathieu Leclaire" <mleclair(at)hybride.com>
Subject : RE: copying particle instance from one cloud to another
Title: RE: copying particle instance from one cloud to another

Hi Philipp, nice to hear from you!! Hope the Mental Ray stuff is going well!!

 

No, I need 2 clouds because one is used to emit particles and follow XSI forces while the second one has a custom operator on it. So my problem is trying to copy the same particle from the first cloud to the second… So of course I want to make sure that the new particle instantiates the right object from the group and so far, following the rule that Halfdan gave me, the only way to do that is to create new particles until I find one that has a Particle ID that’ll give me the same instance as that Particle ID from the particle of the first cloud that’s being copied… But I just figured I can do something like that and then just remove the other particles I created that don’t have the right IDs using RemoveParticlesWithIDs()… it’s still a bit ugly but it should work.

 

Mathieu

 

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Philipp Oser
Sent: Wednesday, April 19, 2006 4:41 AM
To: XSI(at)Softimage.COM
Subject: Re: copying particle instance from one cloud to another

 

Hi Mathieu,
I'm trying something very similar atm. My approach was to have a single cloud and different PTypes. As far as I understood you can put the ParticleTypeID
to switch between PTypes.
Could this work for you? Do you rely on multiple objects in the group?
I'm having a little trouble though with switching PTypes - I must admit - as wrong transforms seem to be passed to MR (everything is fine in 3dViews but MR renders in the particles in the wrong place...)
I posted the problem on xsibase with more details. Has anyone successfully switched PTypes?

http://www.xsibase.com/forum/index.php?board=14;action="">

Ah, and say HI to Olivier, too...

Philipp Oeser



Mathieu Leclaire wrote:

Oh, I forgot one detail though… how can you make a certain particle be a certain instance? What I’m doing is taking a particle from cloud 1, remove it and add one to cloud 2 with the same attributes… my guess would have been to copy the particle ID but there’s no function to put an ID, only to extract one. So what should I do? Add invisible particles (size=0) to cloud 2 until I get a ID which will give me a “instance_index = ( particle_id * 23827 ) % nb_instances” that’s the same as the particle I’m removing from cloud 2? That will create a bunch of useless particles for nothing!! So if I’m to take this road, I guess I would be better off checking in those unused particles if one exist with an ID that would match the instance_index and use that one if it exist or add more particles if it doesn’t? It all becomes kind of ugly don’t you think? Anyone got a better suggestion?

Mathieu Leclaire

R&D Programmer

Hybride Technologies

-----Original Message-----
From:
owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Mathieu Leclaire
Sent: Tuesday, April 18, 2006 12:53 PM
To: XSI(at)Softimage.COM
Subject: RE: copying particle instance from one cloud to another

Thanks for the info… I would have never guessed that!!

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Halfdan Ingvarsson
Sent: Friday, April 14, 2006 7:40 PM
To: XSI(at)Softimage.COM
Subject: RE: copying particle instance from one cloud to another

It's not a particularly sophisticated algorithm either. It boils down to this:

instance_index = ( particle_id * 23827 ) % nb_instances

 

Random prime number courtesy of random.org.

 

Assuming that the index into the group from the SDK is the same as internally (which is usually a pretty fair assumption) this should work for you.

 

 - ½


From: owner-xsi(at)Softimage.COM on behalf of Mathieu Leclaire
Sent: Fri 14-Apr-06 13:54
To: XSI(at)Softimage.COM
Subject: RE: copying particle instance from one cloud to another

No, it picks randomly one object for each particle.

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of
Bernard Lebel
Sent: Friday, April 14, 2006 1:43 PM
To: XSI(at)Softimage.COM
Subject: Re: copying particle instance from one cloud to another

Perhaps I'm missing something, but last time I checked, all members of
the group are instantiated at each particle....


Bernard



On 4/14/06, Mathieu Leclaire <mleclair(at)hybride.com> wrote:
> No I think you misunderstood the question... lets say my instance group
has
> a cube, a sphere and a cylinder. Each particle will instance one of the 3
> objects from the group but how can I identify which one of those 3 objects
a
> specific particle is instantiating? If one particle is instantiating a
> sphere and I want that particle to disappear and have another particle on
> the second cloud appear that will also instantiate the same sphere, not a
> cube nor a cylinder... how can I control that? How can I identify which
> object from the group that is being used by a particular particle? I'm
doing
> all this in C++ using the ParticleCloudPrimitive btw. From that, the SDK
> says I can access information like position, velocity, rotation, angular
> velocity, UVW, color, size, sprite angle, mass, age, seed, age limit,
sprite
> index and type ID... but nowhere does it talk about instances!! Anyone
ever
> had to deal with something like that?
>
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of
> Bernard Lebel
> Sent: Friday, April 14, 2006 12:41 PM
> To: XSI(at)Softimage.COM
> Subject: Re: copying particle instance from one cloud to another
>
> Mathieu,
>
> Is there a possibility that the instanced group has a name extremely
> close (if not the same) as the PType? This is how I could sort
> something like that, as in XSI 4.2 I could not find a way to query the
> instanced group from the PType (sorry if I missed it...)
>
> I don't "manually" set the group of particle instances. Instead, I use
> a script that allows me to pick the object(s) I want to particle
> instantiate, then it will create the group and the PType with a near
> same name, and then perform the actual group instantiation.
>
> You could possibly write a tool that when a group is used as instance
> group in a PType, either the PType or the group is renamed to make
> sure the two conform to a traceable label.
>
> When you want to transfer information, retrieve the group by their
> name, based on the PType name, and then visit the group members.
>
> Note I have not tried to do what you're after, these are just suggestions.
>
>
> Cheers
> Bernard
>
>
> On 4/14/06, Mathieu Leclaire <mleclair(at)hybride.com> wrote:
> >
> >
> >
> > First let me give you the context of what I'm doing: I'm creating a
> special
> > kind of collision system for particles. I'm creating a particle cloud to
> > which I attached a scripted event evaluated on every frame that calls a
> > custom command to verify which particles collide. If a certain
particle(s)
> > does collide, the custom command writes information to a second clouds'
> > userDataBlob, and puts an ageLimit value to it's current age value to
make
> > that particle disappear. Then the second cloud has a custom operator
that
> > reads it's userDataBlob and if theirs information in it, it adds the new
> > particle(s) and the clears the userDataBlob to await new information. So
> > that's basically copying particles from one cloud to another depending
on
> > collision calculations.
> >
> >
> >
> > But here's my problem: I can copy the ptype from one cloud to the other
> > while creating this second cloud before I do the simulation. But I use
> > particle instancing and in my instance group there might be more then
one
> > object so how do I know for each particle, which object it's
instantiating
> > so I can copy that information through the userDataBlob and make sure
that
> > the new particle on the second cloud instantiates the right object?
> >
> >
> >
> >
> >
> > Mathieu Leclaire
> >
> > R&D Programmer
> >
> > Hybride Technologies
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>
>
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi



---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi

 


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.