Converting a PNG Sequence to a VDB and keeping all colors in Houdini

80 Views Asked by At

I have this volume wrangle setup running through a .png sequence and generating a volume from that where the color is ramped to the density value.

int f = 15;

int count = 0 + int(@P.z * f);
string num = sprintf('%02d', count);
string folder = chs('folder');
string file = chs('file');
string path = folder + file + num + '.png';

vector uvw = v@P;
vector color = colormap(path, uvw);
@density = color.x;

this is the node setup

Is it possible to do the same thing for the diffuse color? I've read about the @Cd Expression but it did nothing when i tried it.

1

There are 1 best solutions below

1
On BEST ANSWER

So Houdini is a bit tricky with vector attributes and volumes. It's important to understand that Houdini doesn't actually have vector type volumes, only float. However if you create three volumes/VDBs and use the naming convention like name.x/r/u, name.y/g/v, name.z/b/w then nodes like volume wrangle will treat these as a single vector value for convenience.

You need to create three different volumes/VDBs named: Cd.r, Cd.g, Cd.b then assign color values to them however you want. You'll also need a density volume. Think of it the same as an RGBA image, Cd.rgb are the color values and density is alpha.

Once you have these volumes you can use wildcards in the Volume Visualize Node to map Cd to color.

Here's a quick example graph:

enter image description here

Here's the created volumes:

enter image description here

In the Volume Visualize node you need to set "Density Field" to density and "Diffuse Field" to Cd.* and leave everything else default:

enter image description here

You should then see the Cd volumes color values visualized: enter image description here

I also tested this with VDB and works exactly the same way.

PS: If you're just create "2D" volumes (ie just has a thickness of 1 voxel) you can use the output of the COP2 Network node and set it's Method to Volume then load your image using COP nodes inside the COP2 Network.