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)

Star Wars: The Force Awakens – atmosphere and evenings

R6AxklN

When I left the cinema, it was this one shot that stuck in my head more than any other. And there were plenty of beautiful, memorable shots throughout the film – but there’s something about seeing futuristic space fighters against a sunset that really resonates with me, something in that shot that elevated the film above other sci-fi flicks.

I think it’s because it’s evening.

Sci-fi always seems to happen at night. Of course a lot of sci-fi happens in space, where it’s always night time; but sometimes stuff happens in the daytime – and when it does, it’s usually bright and harsh and dusty. But there’s something about evenings that’s extremely important to humans: it’s that calm transition, the moment of calming and changing gears at the end of a day’s work, before heading out on the town (or wherever). There’s a whole cosm of human experience tied into the atmosphere that evenings bring.

And the Star Wars films have always used evenings to their advantage. You can be on a planet at the far edge of the universe, a gazillion miles from home, but if you’re watching a sunset (even multiple suns setting), something primeval kicks in and you suddenly feel: this place ain’t so different. Show me a character looking into a sunset and I instantly know and connect with the atmosphere there. I can feel the temperature dropping, feel the anticipation of night falling – but it hasn’t fallen yet. Relief the day’s work is over; expectation of what the night will bring.

SW_binary_sunset

And day and night are such broad textures to paint your scenes with that they don’t really tell you anything much about the time. An EXT. DAY shot doesn’t tell you whether it’s morning or afternoon without adding lots of other visual or scripted cues. Likewise an EXT. NIGHT – it could be 10 at night or it could be 4 o’clock in the morning, but either way, you can’t easily communicate that subtlety in a shot until you start adding other elements.

But evening can be communicated instantly. And they communicate so much human stuff – it’s not just an arbitrary time of day, it’s evening, and that’s a very special, a very human, time, rich in atmosphere.

And boy, how important a single shot can be to a whole film: a single shot can colour your whole experience of a movie. I saw The Force Awakens in the cinema, and now, a year or so later, it’s on the movie channels every other day, and I often have one of the screens on my desk playing it as part of my background noise. So I’ve probably seen 90% of the film about a dozen times… but for some reason I keep missing that sunset shot. I glance up and see Finn and Rey in that temple bar place, then glance up again and they’re in the rebel base, and I know I’ve missed that shot again. Huh. Maybe next time.

Why is that shot so important for me? It’s just some spaceships in the air, after all… but yet it was the shot that brought home the Star-Wars-iness of the story to me. These are stories set in fantastical locations a million miles from my sphere of experience, but show me a character watching the sun setting:

Screen Shot 2017-01-26 at 04.54.18

… and I’m there. I know exactly what it feels like to be there on that strange planet, the air cooling, the day over, the night not yet here. I instantly get it. I’m there.

And now I can watch Luke fly a space ship and blow up a Death Star and do whatever fantastical stuff the script wants, but because we had that shared moment together watching the sun setting, I know he’s just a human like me. His universe and mine aren’t so different after all.

h at howiem dot com — animation, music, electronics, ramblings