Major bug in Nuke’s particle system.

June 4, 2014

TLDR: As of Nuke 8.0v4, there is a bug in the nuke particle system that can cause dramatically increased render-times. Fix Below. 

I created a API for the Edit Geo node, allowing me to interact with the node using python (sadly at work so i can’t share, but it should be pretty self explanatory). With that you can do funky stuff like turing some geo into particles, do some particle operations and then apply the particle transformations to the original geo, with animations and all that jazz.13

And that was were i discovered a major bug in the nuke particle system. If you emit particles from a closed object using the uniform distribution method, nuke will spawn more than 1 particle per vertex causing major performance drop when emitting from dense models or high vertex emission rates. However since the particles are spawned at the exact same spot in sapce, any (almost) particle transformation will apply the same way causing the render to be identical to a render with just 1 particle per vertex but just with longer render and simulation time.

16 On the left 1.800.000 particles spawned from a 150.000 point mesh (each visible particle contains 15 particles) – On the right 150.000 spawned particles from the same 150.000 mesh turned into a pointcloud.

In the example shown above the left dragon, and right dragon render is 100% identical however the the dragon on the left takes x15 times longer to render due to each particle containing 15 instances. The workaround is to turn whatever mesh you have to spawn from, into a pointcloud before spawing. If you use a static mesh you can use my GeoToPoints tool: GeoToPoints.nk

Casting lights with Nuke particles, using new undocumented node (ParticleToImage).

May 28, 2014

Nuke 8 secretly introduced a undocumented node called ParticleToImage. This node can be used to turn a particle system into raw image data, containing XYZ positions, Scale, and Color data.

I assume the node was introduced to bridge the gab between 3D scenes and the new BlinkScript node.

You can for example apply a particle system to your geometry, choose uniform distribution and you will be able to get all vertices from the geometry. You can also add custom data into the color channels to bridge data like rotation and so.

ParticleToImage

Anyway, to showcase this node i have made a little relight node that uses the image data to have a Nuke particle system cast light onto a scene. I have used a basic blinn light model with a half-lambert option.

It uses the particle scale to determine the light intensity, and color for the light color.

The node should be available on nukepedia shortly or you can get it directly here

 

Nuke ParticleLights from Hagbarth on Vimeo.

 

StickIT – Digital Makeup Gizmo for Nuke

May 8, 2014

StickIT – A Digital Makeup Gizmo for Nuke. from Hagbarth on Vimeo.

In summer 2013, I was tasked with finding a way to easily add digital makeup to actors facees across multiple scenes (with alot of twitchy motion and super shallow-focus closeups), quickly and with as little effort as possible. That was where i came up with StickIT, a 2D optical flow(ish) solution for “warp” matchmoving a image onto another.

 

Most digital makeup solutions involves a 2D planar track or a 3D matchmove both with their own respective strengths and weaknesses. When doing face makeup with a actor talking or doing other rapid motions, both 3D and planar track solutions can easily take hours before a solid track is in place, and this is where the combination of the 2 comes in.

StickIT uses the Nuke Camera Tracker to generate a 2D pointcloud on the desired area. StickIT then generates a mesh of pins based on the density of points from the pointcloud. By triangulating the neareast points taking both movement and distance into account, StickIT calculates the best suitable motion for each and. It all becomes one big mesh that does’nt care for edges, regions, planes or perspective, but rather just the “optical flow” of the pixels underneath. This obviously have its disadvantages in certain situations, but makes it a simple 1 Click, set and forget approach.

Pulling a ST map into the warp you can generate a diffrence map and by that a ST map and Motion Vector map that can be used to not only creating motion blur and re-applying the effect multiple times in the same comp, but also gives the option to export the 2 and replicate the exact same results inside Fusion or AfterEffects for example.

With all that being said, StickIT is made to do things fast and dirty and won’t replace any of the other solutions if there is time for a proper matchmove. But when you are on a budget and got 100 more of these shots waiting in queue you might aswell just “do the clicks and se if it sticks”

 

StickIt01

 

 

 

StickIt02

 

The python source code took quite a few rounds of cleanup (the yellow parts) to bring down solve time to a few seconds.

StickIt03

Petzval for Nuke – Swirly Bokeh using Blink Script

April 29, 2014

I remember seeing this video from Jason Bognacki for the first time and immediately thinking “Wow… I must replicate that effect in Nuke”.

I contacted Jason and bought one of his modded lenses for me to study and play around with.

PETZVAL-MOD™- 58MM F2.0 (W/ MODIFIED ELEMENTS) from Jason Bognacki on Vimeo.

Not only is it an artistically interesting effect, it also raises a problem with Defocus, Z-defocus, Convolve and pgBokeh nodes alike. They all mimic the perfect optical element alignment in a lens. And most lenses have alot of “swirl” and distortion in their bokeh. If you look at this image you can clearly see how the bokeh circles at the edges of the frame are “facing away” from the center of the image (also referred to as “onion bokeh”), and this effect is occurring quite often.

 

So i decided to make a new Z-Defocus node for Nuke that generates swirly bokeh, and thanks to the new Blink Script node and the convolve examples provided by The Foundry this was a rather easy task to accomplish.

The node itself takes 4 inputs.

  • Filter Input – Changes the look of the bokeh
  • Depth Map – Depth map, but can also be used for masking.
  • Direction Vector – This map defines the direction that the bokeh should face, I have included anoter blink node that creates the default 360 map but you can make it face any direction you want.
  • Input Image – The image to apply the effect to.

 

Petzval_07

(Image from Tivoli – Copenhagen)

Here are a few results:

Petzval_01

Petzval_02

Petzval_03

Petzval_04

Petzval_05

 

 

There are still a few adjusments to do, but sofar im pretty sattesfied with the result.

 

Trying out Nuke Blink Script

April 29, 2014

One of the most exiting new features, actually.. the most exiting feature in Nuke 8 was the addition of the Blink Script node.

At the point of the announcement i was acturally working on a shder manager for nuke, mainly using the basic expression node. The expression node is nice but you need a ton of them and from time to time nuke doesn’t update the data stream causing the output image to be invalid.
ShadersBreakdown2 (The nuke shader manger i was working on)

The blink node means that i can gather all my shader code inside a single node.
However as the blink node cannot reference anything outside the input rgb channels i still have to create 1 blink node for each light.

ShadersBreakdown (3 simple shaders using the blink node, 2 color Velvet,Improved Blinn Phong, and Lmbert)