Sampling 3d vdbs in COPs
Slitscanning in COPs using VDBs
The slitscanning effect has been explored extensively in various contexts, with one notable Houdini implementation by Stephan Helbing for Entagma. That approach uses UDIMs and processes them in SOPs, which works well but doesn’t take advantage of the compositing context. I’ve been wanting to tackle slitscanning directly in COPs for a while, but since there is no straightforward way to access multiple frames simultaneously all hope seemed lost.
However, after exploring the new COPs Pyro content in Houdini, I realized you could just load an entire image sequence into a VDB volume, effectively creating a 3D representation of your footage where time becomes a spatial dimension. Once the sequence is stored as a volume, you can sample it freely in COPs across any point in time and space.
Workflow Overview
To load an image sequence into a VDB volume, we’ll use a method outlined by Konstantin Magnus in this video, which uses a volume wranlge with the colormap() function.
I constrained the complete volume to the -1 / 1 range, so that it can easily be sampled in COPs later on. Using a “Sop Import” and a “Geo to VDB” the volume can be brought into the COP context. Where it can be sampled using the following Code:
@KERNEL
{
// Get screenspace coordinates
float3 pos;
pos = @P.world;
// this is where we sample in time, by changing the z-index of the volume
pos.z = fit(@pos.x,0,1,-0.995,0.995);
// Sample VDB in Worldspace
float3 sample;
sample = @tosample.worldSample(pos);
// output the sampled value to a 2d layer
@vdbsample.set((float4)(sample.x,
sample.y,
sample.z,
1.0f));
}
The beauty of this method is its flexibility. You can sample the volume using a gradient or any noise to morph through time.
Notes
In a “perfect” digital slit-scan, every single row of pixels represents exactly one frame of time. If your video is 1080px high but only 200 frames long, there will be noticeable banding / stepping between the slits. One way to circumvent this is to loop through the slit multiple times to fill too increase the “time resolution”.
The other thing to keep in mind is the disk usage since were always loading 100% of the sequence. You can middlemouse on the output node in sops to see the size of the vdb. Highres images with long sequences can get big quite quickly so keep that in mind.
Download
If you want to support me or dive deeper into the technique I’ve put up an advanced version on gumroad where I’ve included an automatic file loader along with setups to combine the VDB sampling with UV maps to gain ultimate control. The file can be found on my gumroad along with the free version here.