You’re Doing That Wrong is a journal of various successes and failures by Dan Sturm.

Real RoundRects in Nuke

I ended my previous post about creating RoundRects in Nuke with this line:

Fingers crossed that The Foundry will render this gizmo obsolete sooner rather than later…

Though it wasn’t The Foundry that came to the rescue, I didn’t have to keep my fingers crossed long. Thanks to Erwan Leroy, we now have a real RoundRect tool worth using.

What Was So Bad About My Version?

I’m glad you asked. Technically, nothing, since the tool did work, but, beyond the limitations I outlined in the previous post, my RoundRect tool was exceptionally complicated under the hood.

The internals of my RoundRect gizmo.

It was built from 6 basic shapes; four circles and two rectangles [1]. Combining all the pieces required 31 nodes, expression linked to play nicely together. Sure, the nodes were hidden under the surface of the gizmo interface, but a simplified tool will always be more efficient and easier to debug should you run into a problem while working.

Erwan’s tool is built from a single Roto node. It also uses a Transform node, but the tool isn’t connected to the input or output of the gizmo; it exists solely to make the creation of the gizmo interface easier and less prone to situational malfunctions.

From Erwan’s post:

The reason why I added a transform instead of picking directly the roto node's knobs, is that the roto knobs are sensitive to what is selected within the node. I kept getting greyed out knobs, so I decided to get around the issue this way.

The internals of Erwan's RoundRect gizmo.

The Magical Part

The reason I built a gizmo in the first place was to have a procedurally drawn RoundRect, absent from the human error inherent in dragging tangent handles with GUI controls. In my mind, the way to avoid these problems was to use simple shapes and assemble the RoundRect piece by piece. Which caused me to discount the use of Bezier shapes.

Being much smarter than I am, Erwan recognized that each point and tangent handle on a roto shape is scriptable. So, by manually drawing the eight points required to create a RoundRect, then adding expressions to each point, ensuring they were positioned and curved properly, he was able to create a perfect, procedurally drawn RoundRect with a single Bezier path in a single Roto node. If you haven’t clicked the link yet, go check out how he did it.

The expressions on the Bezier points.

Thank You

Thank you, Erwan, for building and sharing this tool. At this point, I don’t care if The Foundry ever adds native RoundRect support. This tool is what I’ll be using from now on.

  1. Well, technically only three shapes; the two rectangles, and four copies of a single circle. This, by the way, is one of the major benefits of node based compositing, if you’re still on the fence about the whole layers vs nodes thing.  ↩