Wiper No Wiping
- Max Austin
- Nov 14, 2022
- 2 min read
I was creating some breakdowns at work one day and decided to quickly create a 'wipe' gizmo that would expedite the task. Around the same time, I started learning Blinkscript from Chris Fryer's An Artist's Guide to Blinkscript. So I thought why not play around and see if I could replicate the Gizmo using Blinkscript. If you don't want to know the results, click away now!

Blinkscript is a C based language that runs on the GPU, making it incredibly fast. Most of what I've learned has come from Chris Fryer's An Artist's Guide to Blinkscript. It's very well put together and easy to understand, 10/10! For anything I needed to know that wasn't directly covered in the course, the Foundry's documentation was helpful, and a special shoutout to this Erwan Leroy blog, where I got and modified the if/else statement used to make the wipe line.


Inside the initial group node, there are actually 2 Blinkscript nodes running the node. One creates the before/after split between the two plates, the other creates the line that separates them. These 2 tasks can be accomplished in 1 node, but since I'm learning, I found that breaking the overall task into smaller tasks was a great way to quickly isolate and resolve any issues within the code.
Below is the code from the Wipe itself; I won't post the code for the split since it's just a simple if/else statement.
kernel Wipe_Line_Placement : ImageComputationKernel<ePixelWise>
{
Image<eRead, eAccessPoint> before;
Image<eRead, eAccessPoint> after;
Image<eWrite, eAccessRandom> dst;
param:
// This parameter is made available to the user.
float wipe;
int wipewidth;
float4 color;
local:
// This local variable is not exposed to the user.
int height;
float width;
float wipepos;
float4 baimage;
// In define(), parameters can be given labels and default values.
void define() {
defineParam(wipe, "Wipe Position", 0.5f);
defineParam(wipewidth, "Wipe Width", 3);
defineParam(color, "Color", float4(1.0f));
}
// The init() function is run before any calls to process().
// Local variables can be initialized here.
void init() {
height = before.bounds.y2;
width = before.bounds.x2;
}
void process(int2 pos) {
//used to determine where in 'x' the wipe is
float wipepos = wipe * width;
//loop for line width
for (int x = 0; x <= wipewidth; x++) {
//loop from 0 to height of image
for (int y = 0; y < height; y++) {
dst(wipepos + x,y) = color;
// This writes to the dst image at coordinates
//0, y, value 1. WARNING! If the coordinates are
//outside of the BBOX, nuke will crash!
}
}
}
};
Comments