Houdini HDA: Particle Looker 1.7

Should be called “Point Looker” really. Super simple really, just a time-saver if you keep need certain looks, which I found I did. Plug some points in the top and this will create Alpha / Cd / pscale attributes. Set colour from a ramp, or from a base colour and then hue/sat/val variance; Alpha over age or from a custom attribute; Size based on mass, or a ramp based distribution.

And a “Create specials” option, which takes some proportion of your particles (best not too many) and gives you some extra controls. Handy for making a few odd differently coloured or extra bright particles to spice up the mix, like in the top image.

Colours can be cycled through the ramps too, to add a bit of life.

No guarantees, may not function as advertised, may burn down your house. But it’s reasonably well documented if you dive inside, and most of the parameters have hover-text help. If you’re happy with that, download: com.howiem__h_particle_look__1.8.hdalc

Houdini: copying camera animation data to After Effects

I use AE for comping stuff, so once I’ve rendered something out of Houdini, I usually need the camera animation data in AE to line flares etc up. This Python script, stuck on a button in Houdini, will copy the animation to the clipboard in a format you can paste onto a Canera in AE. Almost. There’s one additional step: paste the data into something else first—any old plain text editor—and copy it from there into AE. Dunno why, but it makes it work…

 

Houdini quick tip: Control particle birth rate with a point attribute

You can control a POP Source’s birth rate using an emission attribute, but it only works with primitive attributes, not points. Bit of a pain. Often I just want to birth from a single point – but I want to leave the door open to adding more sources later, so using the POP Location node is a bit limiting.

Turns out the POP Source node is actually not too tricky to understand – unlock it and dive in. You’ll find a Solver SOP: dive in there, and you’ll see how particles are birthed. Awww.

The wrangle you need to tit about with is here:

It’s called attribwrangle1, and it’s just above the “random_points” null.

Here’s its existing code:

#include <voptype.h>
 #include <voplib.h>

int npts = ch("npts");
 int seed = ch("seed");
 float frame = ch("frame");
 int firstpointcount = ch("firstpointcount");
 int firstprimcount = ch("firstprimcount");

for(int i = 0; i < npts; ++i)
 {
  float r = rand(vop_floattovec((float)i, frame, (float)seed));
  int sourcept = (int)(r * firstpointcount);
  sourcept = clamp(sourcept, 0, firstpointcount-1);
  int newpt = addpoint(geoself(), sourcept);
  setpointattrib(geoself(), "sourceptnum", newpt, sourcept);
 }

 for(int i = 0; i < firstprimcount; ++i)
   removeprim(geoself(), i, 0);
 for(int i = 0; i < firstpointcount; ++i)
   removepoint(geoself(), i);

It works by taking the total number of points that are supposed to be birthed this frame and spreading it randomly across the source points. But we want to go through all the source points, read the @birth attrib, and birth that many particles on the point. So replace the bold bit with this new code:

for(int sourcept = 0; sourcept < firstpointcount; ++sourcept)
{ 
 for (int j = 0; j < point(geoself(), "birth", sourcept); j++) {
 int newpt = addpoint(geoself(), sourcept);
 setpointattrib(geoself(), "sourceptnum", newpt, sourcept);
 }
}

To test it:

  • Set the emission type to “Points”
  • Ensure there’s a point attribute called i@birth on the points being fed into the POPNet
  • Now, every frame, each point will birth @birth number of particles. Ta-da. You can drive the @birth attribute any way you like – even just using noise makes for some sexy effects.

Note that the Constant and Impulse birthrates are now ignored. For tidyness, you ought to do some more tidying up to the node, and perhaps create a new HDA – but this’ll do for now.

A super-quick test (and hey, gotta love the new Attribute Noise SOP – saves having to build a VOP net every time):

That attribute wrangle above the popnet just says

i@birth = int(10.0 * @Cd.r);

Animating the birth rate on a per-point basis is now super easy. And yep – you can do something similar-ish using primitive / surface emission attributes, but this gives you a whole world of different looks, and, for me at least, much easier control. I love point-based emission. Fireworks, here I come

Houdini quick tip: random seed for your HDA instances

Sometimes you need each instance of an HDA to have a random seed for internal use. Sometimes you just can’t be arsed to do it yourself. This’ll do it – create a seed parameter in the UI, and then stick this in the onCreated handler to set it automatically on creation:

node = kwargs['node']
seed = 6173*node.sessionId()+4139;
node.parm('seed').set(seed % 10000)

From Leaf on the SideFX forums, who adds: “Explicitly setting the seed parameter on node create is the safest approach. Basing the seed on the node name can quickly cause problems when you go to clean up your scene and re-name everything (Toootally never accidentally done that before :)”

Drone day 1

I bought a drone! This is my first ever flight, so it’s a bit clunky (keep bashing into the gimbal end stops, whoops)

Bloody addictive, this thing, but I’ve only got enough batteries for around an hour of flight at a time…

Blender / Cycles / Particles / Motion blur artefact fix

A render with lots of particles (baked), using Blender and Cycles. I was getting this peculiar streak artefact right next to the particle emitter:

After a bit of fiddling around, I’ve sussed what’s causing it. The default setting for Motion Blur in Cycles is to centre the motion blur around the frame time: it opens the “shutter” before the frame time, then closes it after the frame time.

So when it’s rendering frame 7 with a half-frame (180°) shutter, it’ll actually render the portion of time from 6.75 to 7.25. But it seems that when Cycles reads the particle data from the cache, it only reads the previous frame and the current frame. So the second half of the motion-blurred period doesn’t have the correct particle data to work from.

Easy fix then: choose either Start on Frame or End on Frame instead. Which one to choose will depend on your scene, but it should become obvious when you test it.

Streak artefacts gone! (Phew)