problem with a particle rule

   4360   9   2
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
in this particle system after a collision i have an attribute set to the particle which is the current frame plus some random number between 0 and 25.
$F+round(rand($PT)*25)
i then have another group below that checking if the current frame number is equal to or larger than this attribute and then the particles will go into a new group which will have wind applied to them.
$F >= $STARTF

problem is particles only get sent out to the new group for the wind if the frame is equal to the current frame. it wont work for future frames…

I've attached a scene file demonstrating the problem.

thanks for any help.

Attachments:
destruction A 03 - forum.hip (288.4 KB)

https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
User Avatar
Member
648 posts
Joined: July 2005
Offline
see attached.
the problem was that the random function was based on $PT,
which is static, so I added $F: rand($PT + $F)

Attachments:
destruction_a_03_fixed.hip (290.5 KB)

User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
thanks!

i dont quite understand why that works. what does it being static mean and do?

i would have thought it is just some number, so im just adding some number to the current frame number.
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
User Avatar
Member
648 posts
Joined: July 2005
Offline
If rand($PT) for point 0 is 0.34 it will still be 0.34 regardless of the frame.
rand($F + $PT) will ensure a different random value for each frame.
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
now that i look at the file again it doesn"t seem to be working as desired. basicly after collision particles should start moving anywhere between then and the next 25 frames. in your file when i open it, it appears they all start moving immediately after the collision…
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
You can use the state node to activate particles after a certain point. In the stopped parameter add something like ($FF- 50 ) <= ($ID % 100)

Rob
Gone fishing
User Avatar
Member
648 posts
Joined: July 2005
Offline
queglay
now that i look at the file again it doesn"t seem to be working as desired. basicly after collision particles should start moving anywhere between then and the next 25 frames. in your file when i open it, it appears they all start moving immediately after the collision…

Sorry I tend to skip the question and go straight to the hipfile. ops:
See attached. I've gone in and made a randomly offset linear gradient either side of $HITTIME*$FPS… not elegant but should be exactly what you're after.

Attachments:
hittime_gradient.hip (340.6 KB)

User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
thanks for that. i've got one that might be a bit simpler now and it works -
under the value i have -

($F>rint($HITTIME*$FPS)+rint(rand($PT)*25))&&($HITTIME>0)

so it evaluates to 1 only when the frame number is larger than the generated frame number, and hit time is not negative.
Edited by - Feb. 26, 2010 04:28:54
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
User Avatar
Member
8621 posts
Joined: July 2007
Offline
regardless of other possible solutions, here is a little fix for your original method with some explanation

queglay
in this particle system after a collision i have an attribute set to the particle which is the current frame plus some random number between 0 and 25.
$F+round(rand($PT)*25)
i then have another group below that checking if the current frame number is equal to or larger than this attribute and then the particles will go into a new group which will have wind applied to them.
$F >= $STARTF

problem is particles only get sent out to the new group for the wind if the frame is equal to the current frame. it wont work for future frames…

your expressions are perfectly fine for what you want
but your groups arent

notice that you have the options to check Preserve Group checkbox
it means that the particle will stay in the group for future frames

so just do it this way:
1. on collision1 node you have created “collisiongroup” with preserve off
this way only particles which collided in this timestep will be in that group
leave that as is, it's ok

2. in attribute2 put you have “collisiongroup” as a source group
it will create “startf” attribute on collision frame and never touch it later for each particle
perfect, leave this as is too

3. now create group POP after attribute2
Source Group: “collisiongroup”
Group Name : “collided”
Preserve Group: “yes”
Rule Enable:1
Rule: 1
this way at each timestep, all particles from “collisiongroup” will be stored in “collided” group and preserved for future frames
this way it'll accumulate over time

4. now follows your group2 node
Source Group: “collided”
everything else is fine, even the rule
this will create “windgroup” from all points ever collided according to your rule:
$F >= $STARTF
you don't need to preserve this group because once the expression is true for one particle it'll be true for that particle in future frames too

using groups this way and running tests only on particles which are relevant for test will speed your simulation
so to further optimize your simulation you can evaluate voppop1 and kill1 nodes only when particle is created
to do that fill Birth Group on source nodes for example with “just_born”, do not preserve it
put that group as Source Group for voppop1 and kill1 nodes

the last thing, you probably know that, but try to use $ID instead of $PT when dealing with particles
in your scene it won't matter because your particle count isn't changing over time but be aware of it

here is the file with the changes I described here, maybe group names little differ

Attachments:
destruction_a_03_fix.hip (297.6 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
awesome, some very important points there on efficiency. thanks.
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
  • Quick Links