Skip to content

MOPs Tutorial 5: Modifiers

toadstorm edited this page Jul 19, 2020 · 4 revisions

MOPs Modifiers

Modifiers are the broadest category of nodes in MOPs. Modifiers, like the name implies, are designed to change the transform attributes of packed primitives or points. These transformations range from simple operations like MOPs Aim or MOPs Transform to more complex movements such as MOPs Move Along Spline or MOPs Delay. As a rule, the effect of any Modifier can be scaled by a falloff attribute. This attribute can be generated by one of the many Falloff nodes in MOPs, or can be created from any other method at your disposal.

Almost every MOPs Modifier at its core is creating or changing template point attributes on the input points, then using MOPs Apply Attributes to apply those changes to the input geometry. If you want to make your own Modifiers, consider using Apply Attributes to ensure that your transformations operate as expected.

This tutorial won't go over every single Modifier; just the ones that take a little bit more work to set up or are otherwise worth explaining in-depth. For an overview of what each individual Modifier does, check the Modifiers page.

MOPs Noise Modifier

mops noise

The MOPs Noise Modifier uses one of many different noise generators in MOPs Noise Patterns to push packed primitives around. This modifier has two modes: A “simple” mode, which is entirely procedural, and an “Advect” mode which acts like a solver. You can generally get more complex motion out of a solver, but with the added expense of having to actually cache the simulation to see it play.

The Noise Modifier can either generate vector noise or scalar noise. Vector noise means that the points may be pushed in any direction. Scalar noise will displace the points along their normal or up axes. All of the noise functions by default will base the noise function on the current point position, but there’s a checkbox to use the “rest” attribute that MOPs automatically generates so that the noise pattern doesn’t change as the objects animate. Almost every noise pattern also supports “time-dependent” noise, which means the noise will evolve over time without needing to keyframe it.

If you switch to “Advect” mode, the controls get a little different. Rather than having an option to randomly rotate instances according to the sampled noise function, an “Aim Weight” parameter is used to control how much time it takes to aim each instance towards its direction of motion. The default value of 0.1 means that 10% of the target orientation is blended in at each timestep. You also gain the ability to emit trails from the animated instances, though this functionality has largely been replaced by the MOPs Trails generator, which has more options. Still, it can be a little more efficient to handle this from inside the noise solver, so it’s been left in.

The last thing to note about Advect mode is that it’s a solver, so any animated changes to attributes upstream won’t affect the solver unless you go to the Solver Settings and add the attributes you want to update to the list. The mops_falloff attribute is there by default so you don’t have to do anything if you’re just animating Falloff nodes upstream.

Simple Advect
simple advect

Simple mode vs. Advect mode. Simple mode is entirely procedural. Advect is a solver, building upon the previous frame. Advect can be slower, but allows you to aim the instances in the direction of motion. Example file: noise_modifier.hip

The Noise Modifier isn't just for pushing stuff around, though. You can also use it to affect rotations (or even scales). Affecting rotations only in Simple mode can be a great way to quickly add movement to an otherwise static scene; for example, rustling leaves on trees.

trees

Using the Noise Modifier in Simple mode to affect rotations only. The noise is being remapped to affect the local X-axis more than the other axes, so they pitch more than they roll or yaw. Example file: noise_modifier.hip

MOPs Move Along Spline

The MOPs Move Along Spline modifier solves a very common problem in Houdini… how to move objects along a path. Houdini gives you some basic tools to handle this at the object level, but you’re on your own if you want to do it in SOPs, and it gets pretty complicated if you also want to handle the orientation of your objects as they move. MOPs Move Along Spline handles all of this automatically. It’s a very powerful node, but it can be used in a number of different ways so there’s quite a few settings to go through.

Move Along Spline has a “simple” mode and an “advect” mode, just like the MOPs Noise Modifier. The only difference between the two modes is the same: simple mode is procedural, and advect mode is a solver. The controls don’t change much between modes, mostly just switching “goal” for “speed”, but the different modes can yield very different results.

Something you’ll probably notice right away is the different variants of Move Along Spline in the Tab Menu… these are presets. The “Distribute” preset automatically places all your instances evenly along the target curve. You can use this either as the starting position for another Modifier, or as a cheap and easy way of sticking the packed primitives to the curve. The “Snap Group” preset snaps the centroid of all your objects to the start of the curve… this is handy if you want all the objects to appear like they’re moving as a group.

move along spline presets

The "Distribute" and "Snap Group" presets available from the Tab menu for MOPs Move Along Spline.

Move Along Spline and its sister node, Move Along Mesh, both operate in two distinct steps: the “Attach” step and the “Animate” step. In the “Attach” step, you determine the initial state of your objects relative to the curve or curves. You can decide whether to attach to a specific curve primitive or just the nearest primitive, and then decide whether to use an attribute to decide where on the curve to attach to, or just attach to the nearest point on the selected curve. Once you’ve picked the point to attach to, you can use the Offset sliders to blend between the attached transform and the original transform. The Visualize Offset toggle draws a line to help you see where the attachment point is for each packed primitive… this can be helpful when your curve is twisting all over the place and it gets hard to debug motion.

There’s also options in the Attach step for resampling and reorienting the curve. The orientation of the curve affects the direction your instances will aim in if Orient Offset isn’t set to 1.0, and it also affects how offset is applied… if your curve’s orientation is twisty, the offset vectors will twist as well as the instances move.

move along spline offset

Visualizing the "Maintain Offset" parameter. The offset vector is calculated based on the difference between the point position and the determined "attach" position. It rotates as the curve twists and turns. Example file: move_along_spline_offset.hip

One big thing to note about Modifiers, if you haven’t noticed already, is that most of them support VEXpressions. These are nifty ways to literally inject VEX code into an existing Wrangle, so you can customize what these nodes do even further. Any MOPs node that supports VEXpressions will have all of the parameters that you can write to written in comments as the default value. For example, you could completely randomize the speed of all of these objects by writing a rand() expression here and setting “speed” equal to the result. You can reference any point attribute you like in here, so if you’re having trouble getting exactly what you want, remember that you can just store a point attribute somewhere upstream and refer to it in a VEXpression later to set parameter values for individual points.

move along spline vexpression

Using a VEXpression to modulate the speed of instances, as well as the offset amount. Most MOPs Modifiers have full support for VEXpressions. Example file: move_along_spline_vexpression.hip

Delay and Spring

MOPs Delay and MOPs Spring Modifier are two specialized modifiers for adjusting existing motion. Delay will read incoming transformations and delay them by a number of seconds, multiplied by the falloff attribute. You can use this to add weight and complexity to otherwise very simple animations. MOPs Delay also works on packed sequences by default, though for best results you may want to set up cycling behavior first using MOPs Set Sequence Time.

mops delay

MOPs Delay offsets the timing of input animation based on a falloff attribute. This allows for complex behavior with just a few keyframes. Example file: delay.hip

The MOPs Spring Modifier applies spring forces to incoming motion, so that they appear to be bound to invisible rubber bands. The spring forces can be applied to any transformation component (Translate, Rotate, Scale), but also can be applied to Falloff and the sequence time, just like MOPs Delay. It’s another great way of dressing up otherwise simple animations to get more organic-looking behavior with little effort. Keep in mind that both the Spring Modifier and Delay are solvers, so you can’t count on attributes from outside the solver updating during the solve.

spring

MOPs Spring applies spring forces to incoming transform attributes. Here, a simple scale operation is first run through a Delay to offset timing from the center, then MOPs Spring generates the bounce. Example file: spring.hip

Remember that MOPs isn't just for packed primitives!

Most of these Modifiers were built with the intention of modifying packed primitive transforms, but that doesn't mean they're the only thing you can use them on! MOPs Delay, for example, can be used on deforming polygon meshes. The only real difference between a packed primitive generated in MOPs and any old point is that points don't always have an orientation and an id attribute. Add those, though, and you could use MOPs Transform to push particles around in their local space, or use MOPs Spring Modifier on a walk cycle. Very few MOPs nodes actually require packed primitives!

In the next section, we'll go over some of the Tool nodes we haven't already discussed.