giovedì 28 marzo 2013

Houdini - pin table & led panel

Yesterday I saw on TV a beatiful commercial in which a pin table makes the animation of a horse, so I was wondering what's the best way to achieve this effect in Houdini.

Here is my test (special thanks to my cat Lucy for the help!):





The first (and of course bad) idea was a copy-stamp with a "pic" expression to affect the Y position of each instanced pin:



pic("../img_sequence/OUT",$BBX, $BBZ,D_CR)*ch("../yAmount")

This technique works fine, but it's very slow to calculate and also single threaded (can use only one CPU core). In addition, the cache would take a lot of memory because it has to store every single pin geometry (and that's no need in this because we only need position informations).

So, to optimize cache, I used the pic expression in a "point" node BEFORE the "copy" SOP (see the picture):


In this way cache files are much smaller because they cache template points only. Anyway, the evaluation is still slow.

The only way to optimize the evaluation is to remove the "pic" expression: fortunately, points can take color from images also by creating UVs and transfering texture color with a VOP SOP, that is much faster. Houdini 12 contains a digital asset that does exactly that, "AttribFromMap".

Placing an AttribFromMap before the "point" SOP and editing Y position expression to "$TY+$CR" ([point Y position] = [original Y position] + [red value]) is enough to get the same result as before with a reasonable evaluation time.



Whith the same method, you can easily create a LED panel effect. This time you have to create 3 different instance SOPs (red, green, blue) and merge them together before applying the copy operator:
  1. Create a LED geometry (that will be instanced on grid points), for example a box.
  2. Using AttribFromMap and Point SOPs, transfer the red channel of your footage to points; create an offsetted copy of the template points and apply another AttribFromMap to create the green channel; do the same for blue.
  3. Merge all the instance points.
  4. Instance the LED geometry on points with a copy SOP and transfer the template colours on instances (see the picture).

In the sample scene (download here, password "valeriodinapoli") I have prepared both effects.

Nessun commento:

Posta un commento