HDK volume advect compare with Vex/Ocl

I’ve made one of my first HDK plugin. This was more a test in order to work with volumes in c++. You can find the code here.

_

This node read one volume on input1 and advect the data with 3 volumes on input2. I’ve made a comparaison with Vex and Opencl with a volume of 100*100*100 and 3 substeps in advection :

  • HDK advect : 1.813s
  • Volumewrangle : 0.398s
  • Opencl : 0.025s

I was surprised to get so much differences. My code in HDK is not threaded and I guess not optimized, I’ve made a test to thread my code with THREADED_METHOD2  but I didn’t get any improvement yet. My next step will be to try threads, opencl or cuda in HDK.

_

The Opencl Code seems in this case much better, for those who want to have a look the otl is here and I have a hip file here. (made with indie licences)

sop solver : multiple outputs

I always though you can only edit one data at a time with Sop Solvers but in fact you can output multiple datas from a Sop Solver. : sop_solver.hip

I’ve seen this with the vellum constraint and you need to use a compile block. In this example I just move some geometry from a data to an other but it can be very useful when you have many data to edit like a smoke object.

opencl : advect volume

As the vdb_advect node was very slow, I decided to make my own advect node in Opencl : advect_opencl.hip

I’ve made a forward and backward advection. I’m uploading this node as it shows how to use atomic add with floats inside Houdini for the forward advection. It also use a bilinear interpolation to read or write into the voxels.

vex : mix colors

Here is a test to mix colors in different spaces like RGB RYB CMYK CIELab :

Hip File : color_mixing.hip

you will need this vex lib  : color.h

Below, from right to left : RGB mixing, RGB or CMYK in substractive mode, RYB with luminance based on RGB, and CIELAB.

Video : A test made with a color mixing in RYB space, I hope to upload soon the hip file for this effect.