Houdini Materials Override

Overriding materials in Houdini  not a simple task that you might think. There are many ways to do so such as Takes or shop_surfacepath method mention here (http://forums.odforce.net/topic/13385-global-material-override/)

Python Filtering technic described in the same post by King Tapir work pretty well and do not required that all of your material assigned on the object level. However, it might be difficult to figure out how to use it for the first time.

Made a .py file. In my case it called filter.py and contain following code.

import mantra

def filterInstance() : 
    mantra.setproperty('object:surface', 'op:/shop/AO'.split())
    mantra.setproperty('object:overridedetail', 1)

print "Python Filter Finished"
filterInstance() Called just prior to the ray_end statement which locks off the settings for an instance object. The function can query object: settings and possibly alter them.
object:surface = ('') The surface shader attached to the object.
vm_overridedetail / object:overridedetail = ('false') When geometry has shaders defined on a per-primitive basis, this parameter will override these shaders and use only the object’s shader. This is useful when performing matte shading on objects.
Not supported for per-primitive material assignment (material SOP).
'op:/shop/AO' Shop material that we going to override

Tell mantra to use this file as a Python Filter

command

Also, don’t forget to force writing of all shaders into .idf by setting Declare All SHOPs.

declare_all_shops

Create a simple SHOP material in this case I’m doing very simple Ambient Occlusion shader.

oclusion

If everything set correctly you should see the print output “Python Filter Finished” in your console.

Screen Shot 2015-03-20 at 12.15.22 PM

This is my result

un_ao_test

Useful links to explore:

http://www.sidefx.com/docs/houdini11.0/rendering/ifd

Converting Houdini Not Commercial Files

This task was bothering me for a long time. We have educational license of Houdini in our school which works without any limitation within the school network. But often I want to reuse my asset created in school for other projects, however an attempt to do so transform my .hip file into apprentice version with all of the limitations applied.

By watching Ari Denesh tutorials (https://vimeo.com/60757344) I found a couple very useful commands.

opscript

http://www.sidefx.com/docs/houdini14.0/commands/opscript

cmdread

http://www.sidefx.com/docs/houdini14.0/commands/cmdread

This is an example of usage.

opscript -G -r / > F:/un/objgroups.cmd

And when load all generated .cmd back.

cmdread F:/un/groups.cmd

I didn’t test it with locked digital assets. According to documentation it won’t work.

Unpacking Houdini Files

Just stumble across this thread

http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=28954&sid=2170ee4566cf91f7b356d0951dcf0501

It took me some time to figure it out because standard “hexpand” utility doesn’t quite work on Windows. I also fail to solve “Permission denied” error discoursed in the thread.

Finally, I just use “hcpio.exe” utility. It seems work pretty well.

http://www.sidefx.com/docs/houdini14.0/ref/utils/hcpio

Here is the command.

“C:\Program Files\Side Effects Software\Houdini 14.0.201\bin\hcpio.exe” -idI F:\Projects\test_prj_01\halway
_micropoly_01.hip