PDA

View Full Version : particles follow a path??


OsteN
03-23-2003, 07:02 PM
I've got a problem with particles when it comes to get the particles ( as instances) follow a path as the cars in "The fifth element"
I've tried with "curv flow" under effects and they follow but also rotate 180 from the emitter to the end which I don't want to happen.

I also want the cars to bank in the curves.

I will be very greatful if someone could help me with this.

thanks!

Jozvex
03-23-2003, 11:37 PM
Hi,

You should definitely be able to do what you want using Curve Flow. To get the particles to face the right way, in the attribute editor of the particles:

1. Go to the Instancing section
2. Change the Aim Direction from None to Velocity.

I've attached a screenshot of a quick attempt of mine. Oh, and make sure the curve flow has lots of control and sub segments. It makes things much smoother.

OsteN
03-26-2003, 10:47 PM
Thanks, it really helped me a lot. It seem that you got some knowledge about Dynamics and Particles. Therefore I've got a second question: How do I get the size of the cars that are instanced and follow the path to emitt as different size and color?

I would be sooooooooooooooo glad if you could help me with this.

Once again, THANKS!!!:thumbsup: :xtreme:

Jozvex
03-27-2003, 02:23 AM
:thumbsup:

Ok, I'll start with the colour.

Unfortunately, I don't think that there's any way to change the colour of instanced particles. But, what you can do is make like 5 copies of your original object that will be instanced, and apply different colours to them (more copies if you want more random colours). Then you can select all 5 objects to be instanced at once, and that way you'll get random coloured particles because the instancer (once we tell it to) will randomly choose the different objects and emit them.

So:

1. Make your copies with different colours and instance them all at the same time.

Now we need to tell the instancer to randomly choose which object will be emitted for each particle. To do this, you need to create a custom per-particle attribute:

1. Open the Attribute Editor with the particles selected (not the emitter, the actual particleShape node).

2. Go down to the "Per Particle (Array) Attributes" section.

3. Click on "General" (it's in the next little section).

This will let us create a new attribute for the particles.

In the window that pops up, type in the Attribute Name (something like randomColour), keep the Data Type as Float, and change the Attribute Type to "Per Particle (Array)".

4. Click Add.

Now if you look back in the Attribute Editor there should be a new attribute called randomColour (or whatever) in the list.

Ok, now we have an attribute, but it doesn't do anything or have a value. So right click in the slot next to it and choose "Creation Expression".

We have to write a very simple creation expression that will give this attribute a random value. You may have noticed that in the list of instanced objects, each object listed has an index number in front of it, (the first object's index is 0 though, not 1). So if you have 5 objects instanced, the indicies (no idea how to spell that :rolleyes: ) go from 0 to 4. Get it?

So anway, we need our attribute to give us a random number from 0 to 4 (if there are only 5 objects). This expression will do that:

particleShape1.randomColour = rand(0,4);

So type that expression in (but substitute anything that needs to be changed) and click the "Create" button.

Still with me? Now for the last easy steps:

1. In the Attribute Editor still, scroll up to and open the "Instancer (Geometry Replacement)" section.

2. Tick the "Allow All Data Types" check box.

3. Find the "ObjectIndex" dropdown and change it from "None" to our new attribute "randomColour".

And that's it!!! If I managed to explain this well enough, you should be able to rewind then play your scene and it will randomly emit the different coloured copies of your object!

For the scale:

1. Just create another attribute in the same way called randomScale.

2. Write a creation expression for it like:

particleShape1.randomScale = rand(0.5,3);

Which means the scale will vary from half sized to 3 times the size (change to suit your needs). Don't forget to press "Edit" after you add in the new expression!

3. Then in the section where you changed the "ObjectIndex" dropdown, change the "Scale" dropdown to "randomScale"

4. Rewind, press play, voila!

I really hope you could follow all of that and it works for you. If not, post again and I'll help you out with where you got stuck.

Of course, if it works and you feel like sending me a cheque for a million bucks go right ahead!!! :p

OsteN
03-27-2003, 05:01 PM
Thank you very much!

It really helped me a lot. You see, I'am studying at a school in Sweden called SOFE (school of future entertainment) and we are in a mittle of a projekt where we are supposed to make the SFX in a film-pilot. We filmed against a bluscreen where we now going to model up a future city with a lot of hovers (cars) running between the buildings. It's a 25 sec clip total.

To show my happyness to you I'll send you the link to our project-page where you can see the final clip. We have deadline friday 4:th April.
You are more than welcome to give us feedback of the film.

It will fore sure come up more problems before deadline. I wonder if it is ok to send them to you?

Thanks once again!!

:beer: mate!

Jozvex
03-28-2003, 01:36 AM
I'm glad to help you! I hope your project goes well and I can't wait to see it!

And yes of course you can ask me more questions if you need to!

OsteN
03-29-2003, 11:56 AM
Thanks!

Deadline getting close now and the swett starts dripping. Phuu!!

I've got a problem with my cars pivot, they piont in different axis, therefore even though I choose velocity under aim direction some cars comes out on the side and some backwards. Is there by any chance that you kan rotate an objects pivot as you can move it (insert key)?

How do I make them not bump in to each other? Is there a mel for particles so they don't collide with each other?

Btw, where in Australia do you live?

Jozvex
03-29-2003, 11:01 PM
Ok, for the pivot problem, in order for objects to instance in the right direction, they need to be facing in the positive X axis direction.

So if you rotate all your car models to face towards the X axis, and then Freeze Transformations (you only need to freeze the rotation though), that should fix it. If it doesn't, you may need to re-instance them now that they are facing the right way. But don't worry, you don't need to re-do the whole thing. If you select the "Instancer" node in the Outliner, then open up the Attribute Editor, it gives you a list of instanced objects that can be removed/added etc. So just remove all the cars, then add them again. That way it should keep the expressions etc.

Next problem, cars bumping into each other could be tricky....

On my (half finished) website I have a tutorial on that exact thing, but it uses the fact that particles are usually round, not car shaped. So if you follow my tutorial, it would make like a "sphere barrier" around each car, which would mean that the cars couldn't come very close to each other.

www.geocities.com/jozvex/tutorials/interparticle.html

That's the link to my tutorial anyway, if you want to try it.

Another way to stop them colliding would be to use the free Brainbugs plugin, which is very good, but more complicated to use. It lets you give particles 'desires' and 'obstacles'.

You can get the Brainbugs plugin here:

http://www.kolve.com/mp_brainbugz/brainbugz.htm

I hope that helps you!

Oh, and I live in Canberra which is Australia's capital city. It's in the south east!

OsteN
04-01-2003, 12:22 PM
Thanks, once again!

stressy! stressy! It's only 3 days before deadline and we haven't start the rendering yet.

It seems that it will be long nights and even longer days. But after this I'll travel to Malta for 8 weeks doing my internship, so hopfully it gonne be some time over for relaxing a little bit.

See ya!

gogofast
05-26-2003, 04:48 AM
Hi, Jozvex

I read the threads, and learn more. Thank you.

gogofast
05-26-2003, 04:56 AM
I find the plugin "brainbugz v1.1" you mentioned . It's too complicated to use. What about the others, such as "ParticleCollider v1.0" and "intercollisionField v0.2", have you ever used them? Could you tell me which one is best? Because I only need to simulate lots of rocks falling down the mountain, so the simple one is my best choice.

Thank you very much!

:bounce:

gogofast
05-26-2003, 05:34 AM
Hi Jozvex
I created a particle node and make it collide with a mountain surface, and the particles falling down under the gravity fields.
That's ok. Then I instanced particle with rocks, but the rocks fall down the mountain without any dynamics, only jumping(just like particles), no rotations.
How can I get the solutions. Because I dont want to make a lots of rocks, I want to simulate the effect using particle(instances).

Give me some suggestions. Thank you very much.
You are very pretty, just like a movie star!!!!!
:bounce: :bounce:

Jozvex
05-26-2003, 08:27 AM
First of all, my picture/avatar is not me! It's Sarah Michelle Gellar, the actress who plays Buffy on Buffy the Vampire Slayer! But yes, she is very pretty. :love:

Now about your rocks. I'm afraid it will be quite tricky to achieve realistic tumbling rocks using particles, because particles don't calculate rotation. You'd have to write expressions to fake it, and it still might not look very good.

Could you try using lots of duplicated rocks as rigid bodies?

Or can someone else help? Like Alexx or Wrend etc?

CGTalk Moderation
01-14-2006, 06:00 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.