I made a previous post about spinning particles with "w" and Pop Torque.... Walter uses this & it seems much simpler (?). In your DOP network, create a Pop Spin node & in the VEXpression space type:
spinspeed = 100*(fit01(rand(@id),chf("min"),chf("max")));
axis = sample_direction_uniform(rand(@id));
Spinspeed is measured in degrees per second
Axis specifies the axis of each point you're spinning. The sample_direction_uniform() function returns a normalised vector. So here, we have a completely randomised rotation axis. Not bad.
Tuesday, 28 May 2019
Tuesday, 30 April 2019
recalculating velocity
Nicked from Walter..
Velocity is a vector..
Velocity=speed x direction.
I was using this because some of my POPs had too much speed and were going through my collision objects.
If you store the normalised version of your velocity, this is the direction. Then you can multiply it by a new speed.. Perhaps you want to make it 85% of it's velocity until it reaches your max target?
So...in VEX:
vector direction=normalize(@v);
float speed=length(@v);
if(speed>chf("maxSpeed")){
speed*=chf("dampMultiplier");
}
Velocity is a vector..
Velocity=speed x direction.
I was using this because some of my POPs had too much speed and were going through my collision objects.
If you store the normalised version of your velocity, this is the direction. Then you can multiply it by a new speed.. Perhaps you want to make it 85% of it's velocity until it reaches your max target?
So...in VEX:
vector direction=normalize(@v);
float speed=length(@v);
if(speed>chf("maxSpeed")){
speed*=chf("dampMultiplier");
}
Friday, 19 April 2019
Group selection expand.
If you need to expand your group's point selection, make ANOTHER group node straight after it.
Specify the same name and change it to Point type (this only works with points I think).
Set the Initial Merge to Union with Existing.
Untick Base Group.
Tick "Include by Edges" and also "Edge Depth".
Specify the group name in the Point Group box and drag the slider to see your point selection increase.
If you want to put the expanded selection into a new group, give it a different name at the top.
If you want to put the expanded selection into a new group, give it a different name at the top.
Thursday, 18 April 2019
PYRO DIY 2019
The pyro setup tools have changed a little bit in Houdini 17..
Here's a refreshed outline of what you need to make a setup from scratch.
- Create something to emit the pyro. You'll eventually be turning it into a volume, so keep that in mind.
- Plug your emitter object/points into a Pyro Source node.
- Optional, but usually a good idea - Connect an attribute randomise node and randomise Density and Temperature
- Use a Point Wrangle to randomise pscale with your favourite function (or don't)
- Connect a Volume Rasterise Attribute node and specify Density, Temperature and V (for velocity) as the things you want to rasterise. Now you have some volumes which will act nicely as sources for smoke. Label them with nulls (SOURCE)
- Before we jump into simulating, there are two more things we need to make to help along things. A box that encompasses the volume of the entire sim and a box that roughly covers the volume of the first frame of your sim. Label them with nulls( BOUND and START for example)
- Create a dopnetwork. Inside, make a Pyro Solver. This is the brains of it all.
- The first input into the solver should be a Smoke Object. For testing purposes use a higher division size, maybe 0.1, which represents 10cm as a single voxel. In the "size" boxes, use an expression bbox("../../START",D_XSIZE) and respectively the D_YSIZE, D_ZSIZE
- For the centre, use the expression centroid("../../START", D_X) and D_Y, D_Z
- The rest of the Properties tab can usually be left as default.
- In the Creation tab, set the Creation Frame to the first frame where your source appears. You may or may not want to have Solve on Creation Frame ticked on. See what works for you.
- The second input into the solver is the Gas Resize Fluid Dynamic.
- The Max Bounds tab is what we're interested in first. Set the type to "From Object" and navigate to the BOUND object you created in step 6. This stops the simulation from going nuts and out of bounds.
- Back in the Bounds tab, you might have to play around with the padding values. Generally the closer to zero, the less extra work the solver has to do.
- Let's skip a few inputs of the solver. The last input will be the source volumes. Add a Volume Source node and navigate to your SOURCE object (step 5) You could have this connected to the Dopnetwork as one of the inputs, but lately I tend to keep those clear (you might have many sources etc..)
- In the Volume tab, press the + button. You'll want to add the "density", "temperature" and "v" from your SOURCE. Label the target fields "density", "temperature" and "vel" respectively. The first two are scalar values & vel is a vector one.You could leave out temperature and velocity if your sim doesn't really require it, but I find a little bit of temperature helps gets the sim moving.
- Hit play, or click on a frame (this is faster, as having to display each frame slows down Houdini a little) in the timeline & wait a little bit. Something should have happened!
- The sim probably looks a little simple. We can disturb the velocity or temperature to make it look more interesting now. This is what the third input is for. You can plug in Gas Disturbance, Gas Turbulence and a few other nodes to do the trick here.
AND THAT'S IT.. A simple and clean pyro setup.
Copying different objects to points
Sometimes you need to copy a bunch of different objects to points. Eg. You have 5 variations of wood splinters and you're emitting them from a snapping plank.
Instead of using the slower copy stamp with random point values, you can use a ForEach loop and a Switch node..and of course a point wrangle.
Connect the objects to the Switch node. In a point wrangle, give each point an (random) integer value (eg "instanceID") ranging from 0 to the number of objects you have.
Make a ForEach network and connect the Point wrangle into the top. Create a null node directly after the start of the Foreach Begin. This will be a "temporary holder" node. It will carry the instanceID value to the Switch node. I've called it PT
The clever bit happens in the Switch node. In the parameter window, click on the cog wheel and add a Spare Input. This will create a new dialog box called Spare Input 0. Type in:
../PT
This will point the spare input to our temporary null & its instanceID value.
In the Select Input dialog box, type
point(-1, 0, "instanceID", 0)
here we are telling the Switch node to get a point attribute from input -1 (which is the spare dialog....which is pointing to the PT temporary null..). The attribute in question is instanceID.. NICE.
A purple arrow going from PT to Switch should have appeared now. This represents that link we've just made.
All that is left to do is to create a Copy To Points node & put the Switch output into the objects input & plug PT into the points input. Finally plug the output of all of that into the Foreach End.
Instead of using the slower copy stamp with random point values, you can use a ForEach loop and a Switch node..and of course a point wrangle.
Connect the objects to the Switch node. In a point wrangle, give each point an (random) integer value (eg "instanceID") ranging from 0 to the number of objects you have.
Make a ForEach network and connect the Point wrangle into the top. Create a null node directly after the start of the Foreach Begin. This will be a "temporary holder" node. It will carry the instanceID value to the Switch node. I've called it PT
The clever bit happens in the Switch node. In the parameter window, click on the cog wheel and add a Spare Input. This will create a new dialog box called Spare Input 0. Type in:
../PT
This will point the spare input to our temporary null & its instanceID value.
In the Select Input dialog box, type
point(-1, 0, "instanceID", 0)
here we are telling the Switch node to get a point attribute from input -1 (which is the spare dialog....which is pointing to the PT temporary null..). The attribute in question is instanceID.. NICE.
A purple arrow going from PT to Switch should have appeared now. This represents that link we've just made.
All that is left to do is to create a Copy To Points node & put the Switch output into the objects input & plug PT into the points input. Finally plug the output of all of that into the Foreach End.
Labels:
copy stamp,
copy to points,
for each,
foreach,
id,
instance,
instanceid,
point,
spare input,
spareinput,
switch
Tuesday, 16 April 2019
Check names for duplicates
point wrangle snippet from Mike
int find = findattribval(0,"point","name",s@name);
int count = findattribvalcount(0,"point","name",s@name);
i@find = find;
i@count = count;
int find = findattribval(0,"point","name",s@name);
int count = findattribvalcount(0,"point","name",s@name);
i@find = find;
i@count = count;
Friday, 12 April 2019
solver sop and moving geometry
So, the Solver SOP doesn't behave as "I" expected with animated (ie. moving) points/geo.
You need to manually update the position if you want your geo to still move!
SOOOOOOOOOO. Inside the solver, copy the P (for position) attribute from Input 1 to Prev Frame...
Weird stuff. But hey.
You need to manually update the position if you want your geo to still move!
SOOOOOOOOOO. Inside the solver, copy the P (for position) attribute from Input 1 to Prev Frame...
Weird stuff. But hey.
Subscribe to:
Posts (Atom)