PDA

View Full Version : particleShape2 rgbPP based on particleShape1Id


Aikiman
07-30-2009, 11:10 PM
Im doing a fireworks explosion effect using the emit command but im having difficulties trying to base particleShape2 rgbPP on the Id of particleShape1.

ATM if I add -at rgbPP into the loop and make it random, then I get an explosion with random colours which Im can understand cause each particle gets a random rgb but this is not what I want.

I want all the particles that come out of particleShape1Id == 1 to be one colour etc etc.
I tried creating a striped ramp on the 2nd particle shape and randomise its birth place on the Ucord but i get the same result, so I need to base the rbgPP on the other particle's ID.

Does anyone have suggestions?

rxgeez
08-01-2009, 01:42 AM
You should be able to use the rand function...you just need to seed it with the particle id.

I've attached an example scene...created in maya 2009.

I think this is what you're after....correct me if I'm wrong.


-K

Aikiman
08-02-2009, 07:49 PM
rxgeez,

thanks mate that worked a treat!

I understand how the seed works in this case.

Thanks for your help :)

Cheers Jeremy

Aikiman
08-03-2009, 09:05 AM
Hi Kiel,

Just wondering if you can take a look at my file. Im having problems with the explode particles "pulsing" on and off.

Basically I want the explode particles to twinkle at different times but instead I am getting a syncronised pulse effect.

To create the effect im using a V ramp (lifespan) on the opacity of the secondary emitted particles. This ramp has a noise texture applied to it to create the twinkle. (this may not be applied correctly and could be the cause of the pulsing).

To vary the birth place of the emitted particles I have add this in the emit command on the lead particle...

-at opacityUPP -fv (rand(1));

Maybe this is not been read properly.

Do you have any ideas?

Cheers

mahigitam
08-03-2009, 09:36 AM
hi i used simple ramp whose V cord is assigned to parentId....hope this will help u too...

Aikiman
08-03-2009, 10:44 AM
Thanks mahigitam,

thats a good method for applying rgb based on parentId cause I can have some control in case the client wants specific colors at specific times.

rxgeez
08-03-2009, 10:11 PM
hey man,

yeah it seems like everything is set up right and it should work as we'd think. I'm not sure why they seem to pulse in the beginning...for some reason as they're born their opacityPP is 0 and then it ramps up and does the pulse thing but then seems to twinkle and fade off....kinda weird.

It appears that the particle is getting the opacityUPP value but not picking that color on the opacityPP ramp....when I get more time I'll look into it more....im interested now.


The way I'd approach it though would be to use a the noise function with the id as the offset (so each one is unique) then create another attribute called opacityFade (or whatever) with a ramp based on age and multiply that value by the noise in the runtime to get them to fade off over life. I attached a example file.

I created 2 other attributes on the particleShape to control the frequency and amplitude of the noise. Select the explodeParticle and under the extra attrs in the attributEditor or scroll down to the bottom of the list in the channelBox to see those attributes.

amplitude: will effect how opaque they get (noise returns 0 - 1) so if you set the amplitude to .5 the opacity will twinkle between 0 - .5
frequency: will effect how fast they twinkle

I'll look into the pulse thing and let you know what I come up with.


-K

Aikiman
08-03-2009, 10:24 PM
Cool, thanks for that, ill check it out soon. I thought maybe there is some wrapping issue with the texture but I dont really think that is the reason.

At the moment I have rebuilt the scene using Per-point emissions and using the example from mahigitam to get color = id. This setup is a lot cleaner since there is bugger all mel and the pulsing seems to have gone now so im gunna run with this for now due to deadlines.

Im going to have a look at your scene when Im done to analyse what you put in place, sounds like better control over the noise/twinkle.

Thanks for all your help dude, you've been great.

Aikiman
08-04-2009, 10:28 PM
just had a look at the file you uploaded and it works flawlessly. Actually the expressions are more reliable than the Per-Point Emission because some of the particle just fizzle out and dont emit anything, very weird. Im gunna submit this method first because I might be able to use parentID to change any colours if the client needs it. If it doesnt work Ill go back to Per-Point.

Thanks for all your help so far.

rxgeez
08-06-2009, 06:34 PM
glad to hear that's working out...I did notice one thing with the runtime on the explodeParticle though.

currently one of the lines is:
float $opacityNoise = (abs(noise((time*$frequency)*$offset)))*$amplitude;

it should of been:
float $opacityNoise = (abs(noise((time*$frequency)-$offset)))*$amplitude;

multiplying the $offset causes the particles with the larger id to twinkle faster instead of just having them twinkle at different times...so currently the each rocket was continually twinkling faster and faster.....my bad.

If the particles aren't offset enough you could always add a multiplier to the $offset.

Anyways just wanted to let you know....if you didn't already catch it. good luck with everything.

-K

Aikiman
08-06-2009, 08:02 PM
No I didnt notice that, hah, thanks for checking that out Ill have to change that I guess.

Thanks again! :)

Sybexmed
08-11-2009, 12:04 AM
How were you able to map the V cord to parentID?

hi i used simple ramp whose V cord is assigned to parentId....hope this will help u too...

Aikiman
08-11-2009, 12:34 AM
nParticles has this attribute available already when you create your ramp for rgbPP, select parentID rather than lifespan. If you are using 2008 then you just write out an expression in creation Vcord = parentId.

mahigitam
08-11-2009, 02:58 AM
select the parentID option from the particles<General tab

then go to the perparticle attribute,click on the little box which is to the right of "create ramp"

select parentID for input V

thats all

CGTalk Moderation
08-11-2009, 02:58 AM
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.