HoudiniTricks has moved
You just came across this Tumblr blog, please head on over to the new HoudiniTricks site. https://houdinitricks.com
noise dept.
almost home
d e v o n
Cosmic Funnies
Game of Thrones Daily

tannertan36
styofa doing anything
Monterey Bay Aquarium
Jules of Nature

shark vs the universe
taylor price
One Nice Bug Per Day
let's talk about Bridgerton tea, my ask is open
Sweet Seals For You, Always
ojovivo
Today's Document

izzy's playlists!
I'd rather be in outer space 🛸

No title available
art blog(derogatory)
seen from Belgium

seen from Sri Lanka

seen from Malaysia
seen from United States
seen from United States

seen from United States

seen from United States
seen from United States
seen from United States

seen from Indonesia
seen from United States
seen from United States
seen from United States
seen from United States

seen from United States
seen from United States
seen from United States

seen from United States
seen from United States

seen from United States
@houdinitricks
HoudiniTricks has moved
You just came across this Tumblr blog, please head on over to the new HoudiniTricks site. https://houdinitricks.com
QuickTip — Adding Tools to The Houdini Menu
So in a previous post about custom main menus, we ended up moving our Desktop menu to the top level for quick access. This is the kind of stuff that you bust out at your high school reunion.
You now may be wondering if you can create a custom menu and add your own tools or python scripts.
Custom Menus
Creating your own menus and adding menu items is really simple once you have your MainMenuCommon.xml in place. Again, refer to the #QuickTip on Custom Menus if you need help setting this up.
We’re going to add a top level menu and add simple menu item that runs a Python script. Houdini gives you tremendous flexibility to edit the menus and a couple of ways of running python scripts. Have a look at the ExampleFile.xml located in your $HFS path. On the Mac, this will be /Library/Frameworks/Houdini.framework/Versions/15.0.244.16/Resources/houdini/ExampleMenu.xml. On Windows it shouldn't be hard to find.
This file has plenty of examples for customizing your menu and is heavily commented.
Scrambles
I like being organized with my files and as a result I created a glorified Pyside application that creates a folder structure on disk. Now, the reason I did this was because I wanted pretty folder icons. Yes, I like “design-eeee” stuff.
I set the project name, the path of the project and the type of project. The result is a series of folders that will store a specific type of media or file type. I figured it would be cool to be able to run the application from within Houdini when starting new projects.
So let’s say I want to add a top-level menu called “990” to the main menu bar containing an item that when chosen runs my Scrambles application or any other Python scripts. We will do exactly this!
Main Menu Bar
The MainMenuCommon.xml file is an XML file that works with a bunch of elements. If you’re familiar with HTML, it’s similar. Let us start with the most basic XML file and build it up incrementally. Add the following line to your MainMenuCommon.xml file:
<?xml version="1.0" encoding="UTF-8"?>
Remember, the name of the file is super important. We are actually inheriting from a similar file that Houdini is loading and we’re attaching our own custom items to it. I know, this is a simplified explanation but if I start getting into it, we will go down a rabbit hole and stop for carrots and tea. Let’s continue.
The first document element for a menu configuration file is always mainMenu. This is the top-level menu. Menu definition and manipulation elements go inside mainMenu. Notice that the closing element has a foward slash / before the name.
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> </mainMenu>
Within the mainMenu element, we then add the menuBar element. This element defines the structure of menus.
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> <menuBar> </menuBar> </mainMenu>
Now we are ready to add the the good stuff! You should easily be able to read what the markup is doing. Nothing exotic. Let’s start attaching the menu items. These are your familiar File, Edit or Help menu items. This is done via the subMenu element. This attaches a top-level menu to the menu bar.
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> <menuBar> <subMenu> </subMenu> </menuBar> </mainMenu>
So far so good! We need to name or label our menu item. This is done with the label element. Inside the label element we include the name of the menu item. In this case, it’s going to be “990”.
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> <menuBar> <subMenu> <label>990</label> </subMenu> </menuBar> </mainMenu>
Right now, if we run Houdini, we should see our “990” menu item located right next to our “Help” menu. Nice!
Adding Submenus
We are almost done. We now need to add the menu item that will run our application. This menu item will call a custom python script and run our application “Scrambles”. Appropriately named after my cat “Scrambles”. “Waffle” already has an app named after him.
First, we are going to add the scriptItem element and provide an id attribute. This element attaches a menu item that triggers a Python script when the user chooses it. The scriptItem element can have various sub-elements but we are only going to use the label and scriptPath sub-elements.
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> <menuBar> <subMenu> <label>990</label> <scriptItem id="scrambles_app"> </scriptItem> </subMenu> </menuBar> </mainMenu>
Here we are adding the scriptItem element and providing a name for our id attribute. It is not necessary to add an id but it is highly recommended as we shall soon see. The name is basically to be able to reference and identify the menu items.
Just as we provided a name for our menu bar item through the label element, we need to do the same for the menu items.
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> <menuBar> <subMenu> <label>990</label> <scriptItem id="scrambles_app"> <label>Scrambles</label> </scriptItem> </subMenu> </menuBar> </mainMenu>
If you were to run Houdini to check your progress and you should before you get to far ahead, you will see your custom menu. However, clicking on Scrambles does nothing yet. We need to add a final element and that is the path to the script we want the menu item to run.
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> <menuBar> <subMenu> <label>990</label> <scriptItem id="scrambles_app"> <label>Scrambles</label> <scriptpath>$HOUDINI_USER_PREF_DIR/python2.7libs/open_scrambles.py</scriptPath> </scriptItem> </subMenu> </menuBar> </mainMenu>
The scriptPath element means exactly that! It contains a path to the script to run when the user chooses the menu item. This is any path on our your disk that will store the code. In my case, I’m storing my scripts in the python2.xlibs folder inside the Houdini user preferences location. Notice I make use of the Houdini environmental variable $HOUDINI_USER_PREF_DIR. Houdini will do us the favor of auto expanding the variable to the proper path.
So now we are all set. If I run Houdini and click on my Scrambles menu item, I will see my application pop up! Exciting, I know!
Final Touches
One last thing before I go watch Three’s Company. Notice how my custom menu is after the Help Menu. Yuck! Let’s move it. Add the following insertBefore element to our markup after the subMenu element and before the label element:
<?xml version="1.0" encoding="UTF-8"?> <mainMenu> <menuBar> <subMenu> <insertBefore>help_menu</insertBefore> <label>990</label> <scriptItem id="scrambles_app"> <label>Scrambles</label> <scriptpath>$HOUDINI_USER_PREF_DIR/python2.7libs/open_scrambles.py</scriptPath> </scriptItem> </subMenu> </menuBar> </mainMenu>
As you might have guessed, this places our custom menu bar item just before the “Help” menu. Notice I’m using “help_menu” text in-between the element. This the id attribute I mentioned previously. So use those id attributes where appropriate.
Much better! There are many other ways to customize the Main Menu in Houdini. Several context (right mouse button) menus are configurable so check out the docs to get your learn on!
Customize Menus: http://www.sidefx.com/docs/houdini15.0/basics/config_menus
QuickTip — Debugging VEX Code
So you have decided to jump into the world of VEX. Congratulations! You will never be same. Sort of like Peter Parker when he found out he was Spider-man.
As you get more serious with your code, an essential part of development is debugging. Believe it or not, I feel debugging is actually harder than writing out the actual code. Anyways, debugging is an important part of development and sometimes it will drive you nuts. You have been warned.
Hi printf()
As far as I know there are no debugging tools in Houdini so we have to rely on our good old friend printf(). It stands for “print formatted”. He is a nice little fellow who takes a string and prints it out to the console. This is the printf() signature:
void printf(string format)
This is an old function but most folks first come across it when learning C. The Houdini documentation has a good explanation and example use of it. I recommend you look it over. Especially when dealing with the format specifiers. By the way, if you want to learn C, this is an excellent book by the man who created the language.
Where Is It?
So now you fire up Houdini and write your code makig use of printf(). How do you see the output of printf() though? You hunt the interface and menus looking for a console or something that gives an indication that it will output the information. The Textport and Python Shell don’t show anything. Then you open the Shell and still nothing.
Well, you can keep looking but you’re going to come up empty handed. Here is the thing. While the Shell is indeed the correct output window, if you started Houdini using your Desktop icon, it's not going to work.
The Shell is responsible for the output but in order for it to do its job you need to start Houdini from the command line. At least on OS X you do and I would image it's the same on Windows and Linux.
Open Sesame
Starting Houdini from the command line is really easy. All you do is open up your Shell window and type in houdini. Done.
Now we will see your printf() output in all its glory.
Printing Stuff
In this simple example I have two points I created via the Add SOP and change the color of one point based on the distance between them.
So in this network, I grab the second point's attribute value from the second input in the Point Wrangle via the point function and then use the distance function to calculate their distance. I use printf() to print out the value from this calculation. Notice I use the format character %f to get the float value contained in the variable dist since the distance function returns a float value.
float dist = distance(@P, point(1, “P”, 0)); printf(”dist: %f \n”, dist);
If the distance between the points is greater than 1.5, I color the first point yellow and print a message to the console, else I make the point red and print out that the point is red.
float dist = distance(@P, point(1, “P”, 0)); printf(”dist: %f \n”, dist); if (dist > 1.5) { @Cd = {1, 1, 0}; printf("Point is yellow.") } else { @Cd = {1, 0, 0}; printf("Point is red."); }
If you take a look at the Console or Shell window, you will see the output of printf().
There you have it! Now, if you know of a different way, please let me know!
Creating a Multi-Object Asset
QuickTip — Adding Parameters to Interface via Python
Posting this one for future reference. It’s been documented in plenty of places I’m sure but the more the merrier. You wouldn’t complain if there was extra beer in the refrigerator right? Thanks again to the super smart folks over at the ODForce Forums with this one.
Secret Sauce
I’ve been exploring some more Python in Houdini and got to a point where I needed to add some parameters to the interface programmatically. I figured it would be a piece of strawberry cake. Well, it wasn’t immediately obvious to me (story of my life) but here you go.
node = hou.node("/obj").createNode("geo") parm_group = node.parmTemplateGroup() parm_folder = hou.FolderParmTemplate("folder", "Extras") parm_folder.addParmTemplate(hou.FloatParmTemplate("noise", "Noise", 1)) parm_folder.addParmTemplate(hou.FloatParmTemplate("amp", "Amp", 2)) parm_folder.addParmTemplate(hou.FloatParmTemplate("cat_treats", "Cat Treats", 3)) parm_group.append(parm_folder) node.setParmTemplateGroup(parm_group)
The hou.FloatParmTemplate() method constructs the parameter. As you can see, I pass in the name, label and dimension or number of components. There are many other arguments you can pass in. Check the docs for the whole deal. The init method is the following:
__init__(name, label, num_components, default_value=(), min=0.0, max=10.0, min_is_strict=False, max_is_strict=False, look=hou.parmLook.Regular, naming_scheme=hou.parmNamingScheme.XYZW, disable_when=None, is_hidden=False, is_label_hidden=False, join_with_next=False, help=None, script_callback=None, script_callback_language=hou.scriptLanguage.Hscript, tags={}, default_expression=(), default_expression_language=())
If you’re creating or manipulating assets, this is a good one to have in your small jeans pocket.
QuickTip — Command Line Rendering in Houdini
After not having exercised for four months, I’m finally back at it again and I feel shredded!
I like feeling lean and healthy. Makes me feel good and all tingly inside. Just like exercising, I like my machine to be lean when I’m rendering especially since I work on an old machine. I’m not like all you cool kids with the fancy Octane boxes. So I like to give my render all the resources possible to do its job. This is why I like command line renders. I do it in After Effects all the time.
After Effects Command Line Render:
aerender -project ~/Desktop/30-days/to/six-pack-abs.aep
As you might have guessed, you can do the same in Houdini. Now, I’m not going to get into the whole “it doesn’t make a big difference...blah, blah, blah” deal. If my OS does not have to waste resources drawing the UI, I’m fine with the placebo effect. Just like exercising, I feel good about it.
Environment Setup
Command line rendering is not programming for those of you about to close the browser window or tab. It’s just typing a few words in the shell. It really comes down to calling a render command with a few options thrown in.
Now, before we continue, I’m on OS X so that means I’m using the Terminal and I have my environment set up to initialize Houdini when I launch a Terminal session. If you need help with this, refer to my previous post on setting up your environment.
If you’re on Windows, it may work similarly. I don’t have a Windows box so can’t really say. Other than that, on OS X you can use the Houdini Terminal setup provided by Side Effects. You will find it in your Houdini installation directory under the Utilities folder. Again, not sure if the Windows install provides something similar. Yeah, yeah, make fun of my underpowered Mac.
Command Line Magic
Lets say I have a .hip file called ripped.hip that has a Mantra node called mantra_out. At the most basic level, you can start a render with the following command:
hrender -d mantra_out ripped.hip
This will process the ripped.hip file with whatever settings you set in your Mantra node when you saved out your .hip file. This is the hrender command followed by the output driver and the .hip file name.
One important things to take notice. The -d option is required. This specifies the output driver. In our example, it’s a Mantra node but you can use a geometry node to save a .bgeo file to disk. You need to provide the -d option with the name of your output driver node exactly as you named it in your Houdini file. In this example, I named my mantra node mantra_out and this is what I used after the -d option.
You can get fancier of course and alter a few of the render settings.
For example, lets say I wanted to command line render this file from frames 10 to 70 to check a section of my render. I wouldn’t need a full size render for preview so I would type in my shell:
hrender -e -f 10 70 -v -w 640 -d mantra_out ripped.hip -o preview-’$F’.jpg
Lets break this down.
The hrender is your render command that in turn calls a Python script called hrender.py. This guy does all the work.
The -e option tells the render command it will be a sequence of images. If you wanted to specify a single frame, you would leave out -e and Houdini will render the frame where the timeline marker was left at when you saved your file. If you would like to specify the frame number, use the -F option followed by the frame number (e.g. -F 12).
When using -e, you need to use the -f option. This is a lowercase f. You add -f followed by the frame range such 2 59 or 72 9000000000. First number is the start and second number is the end of the frame range.
The -v option is verbose mode so you get some info regarding time and the frame currently being rendered. This is optional.
Since this is a preview, I want a smaller image. In order to do this, I passed the -w option which specifies the output width. You can also use the -h for a height output but if only one option is specified, aspect ratio will be maintained based upon aspect ratio of output driver.
As I previously mentioned, the -d option specifies the output driver. In other words, the node in your scene that will do the rendering. This option is required so this is why you need to remember what you called your node.
The ripped.hip is the file name. No surprises here.
The -o options give you the ability to override the image file name and type. If left out, it will use the values specified in the Mantra node when you saved out the file. Notice since I’m rendering a frame range I need to use $F to specify the frame number WITHIN single quotes. This is very important! If you leave out the $F or single quote marks, you will only get one image file called preview-.jpg. The frames will overwrite each other.
The reason the quote marks are important is because the Terminal or shell is trying to find an environment variable called $F and perform parameter expansion. If it doesn’t find $F with an associated value, it will leave it blank. You need to protect $F so Houdini can do its own expansion. I used quotes but you could have used a backslash such -o preview-\$F.jpg and that would work as well.
Next Time
Command line rendering is super useful especially when you combine it with other scripts or commands. For example, if I have an After Effects project that contains an image sequence rendered out of Houdini and I need to make changes to the Houdini file, I have to re-render in Houdini and After Effects.
After making my changes to the Houdini file, I can automate the Houdini and After Effects renders from the shell without having to open up any GUIs.
I’ll show you next week how to do this but for more info regarding batch renders and command line rendering, head on over to the docs. I simplified a lot of this because Houdini does a lot behind the scenes and provides greater flexibility when it comes to rendering.
http://www.sidefx.com/docs/houdini15.0/render/batch
Time for some burpees!
QuickTip – Motion Blur in Houdini
So I just finished a project with the use of heavy motion blur. A stylistic piece, sort of like a Picasso but not really. Actually, not even close. Anyways, a change came down the pipe. I know, shocking. One of the animated objects in the scene had way too much motion blur and another object should not have motion blur at all. ¯\_(ツ)_/¯
I figured, well, I’ll just turn down the shutter time on that one object and turn off the motion blur for that other object...
Motion Blur in Houdini 101
Enabling motion blur in Houdini is as simple as toggling the Allow Motion Blur toggle in the Mantra node Rendering tab. This will reveal three additional parameters: Xform Time Samples, Geo Time Samples, and Shutter Offset.
The Xform Time Samples controls the number of transformation motion blur samples. Think quality. The more complex the motion, the higher you have to crank these values. Side Effects recommends a value of 2 for most scenarios.
Something important to keep in mind is that Transformation Blur refers to objects being transformed at the object level. In other words, this will not work for deforming objects. So for example, if your geometry is transforming into a hot dog, it will not work and you will have a hot dog without motion blur. For deforming objects, you need to look at the Geo Time Samples parameter.
The Geo Time Samples controls the number of deformation motion blur samples. As with Xform Time Samples, the more complex the deformation of the geometry or if an object is moving really fast, you will have to crank up these values. However, Unlike Xform Time Samples, this is an expensive operation as Houdini has to keep a copy of the geometry in memory for each additional sample.
The Shutter Offset just determines the segment of time by which motion blur will be generated. So to generate motion blur at the current position of your object and the position of the object on the next frame, you would use a value of 1. If you want Houdini to generate from the current position to a position on the previous frame, you would use a value of -1. Finally, a value of 0 will generate motion blur using an interval halfway between the previous and next frame.
Per Object Motion Blur
As an example, witness the following cube and torus spinning wildly in the wind. Both have same amount of rotation. The task is to eliminate or reduce the motion blur on the cube.
Enabling Motion blur is a global setting on the Mantra node. Makes sense but here is the pickle. What happens if you want to turn off the motion blur for certain objects or reduce the samples for objects that really don’t matter much to reduce the memory footprint? You might think to yourself, “Well, I’ll just turn off motion blur or try reducing my Shutter Time on that particular object. Or how about reducing Xform Time samples to a value of 1 and that will essentially disable motion blur for the object.” Sounds reasonable.
However, if you start poking around the object’s node parameters, you won’t find Xform or Geo Time sample control properties. So where are they? You need to add the properties yourself!
Properties
I won’t go into properties in this tip but if you have done the whole “Edit Parameter Interface...” dance, it’s the same thing. Head on over to the object’s gear icon on the top, right-hand side of the parameter window and instead of selecting Edit Parameter Interface..., select Edit Rendering Parameters. You can select either one. It’s just tabs you can switch once the window opens up.
Now, you can hunt through all the folders looking for the properties in question but we don’t have time for that. We’ll use the handy Filter option at the bottom of the window. Assuming you know the name of the property you are looking for, just type it in and Houdini will retrieve it for you or give you the closest matches.
All you have to do now is drag the property over to the right hand side into the area of your choice.
As a side note, if you do have the time, going through all the folders is a great way to learn about all the properties available to you. Flexibility. Also keep in mind a great deal of the properties are already exposed in the node’s parameter interface. You will know this because the property will be grayed out.
It’s Shutter Time
So how about adjusting camera shutter time or shutter offset for an object? It’s the same deal. Just find your Shutter Time property and add it to the node’s parameter interface.
Here I’m essentially turning off motion blur for the cube by making the Xform Time Samples 1. The global Xform Time Samples in the Mantra node is still 2.
After adding the Shutter Time property to the cube, I reduced it a bit. Compare the motion blur to the torus which is still using the Mantra default of 1.
There you have it! Couldn’t be any easier! Time for a wheatgrass smoothie!
Recreating the Cinema 4D Cloner Object in Houdini
Houdini 15 Masterclass | Material Stylesheets
QuickTip — Houdini Flat UI
If you’ve been clamoring for everything flat in your applications, then you are in luck! If you are a qLib user, there is an option to flatten up Houdini’s UI a bit.
If you head to the regular old Color Settings under the Edit menu you are going to find that the qLib library added a couple of extra color schemes. You have the option of using the Pro or the ubiquitous Dark scheme in a flat version.
It may not be to everyone’s liking. Especially if you long for the days of Skeuomorphism in UIs. I personally dig it. I like the red touch in the sliders. It’s a subtle change but does not feel as bubbly.
Before
After
QuickTip — Learning VEX via Animated Gifs
So I know you want to learn VEX. I just know it! I will bet my Fall Guy lunchbox on it!
Well, you are in luck. Houdini genius, Matt Estela, started a thread over at ODForce implementing some VEX examples based on Dave Whyte’s looping Processing Gifs.
He provides the .hip files for you to dissect and experiment with. Great stuff!
Link: http://forums.odforce.net/topic/24056-learning-vex-via-animated-gifs-bees-bombs/
QuickTip — Parameter References in VEX Snippets
Hey! What’s that? < incessantly pressing the button > Oh well... It does nothing.
Since it was nagging me, I looked in the help files for the POP Wrangle but I couldn’t find any mention of the button. The tooltip was not helping me and in hindsight, I’m embarrassed to admit it was sort of obvious. I deserve cat pee on the sofa. Anyways, after thorough research* I figured out what it actually does.
Spare Parameters
If you’re learning Houdini, you probably already came across the nifty bit about being able to add your own custom parameters to a node’s user interface. You then access those custom parameter values with expressions. If you have used Cinema 4D, then think User Data and linking the stuff up with Xpresso, Python, etc.
It’s a bit of a process in Houdini. You have to open the Parameter Interface for the node and create parameter types, set the name and label at the minimum, then link them with other parameters using the channel functions. Not a big deal but if you don’t want to miss that episode of The Fall Guy on TV, time is of the essence.
When you’re in a POP Wrangle or Attribute Wrangle for example, you may do the same thing to change the value of a multiplier. As an example, I have this glorious sphere that is emitting particles and some added force for award winning style points.
Let’s say we want to add noise to the velocity of the particles and we pass in the particle’s age as an argument. Then multiple it by some value to speed or slow them down. I’m also coloring the particles based on velocity. Remember velocity and color are vectors, so this is why I am able to assign @v to @Cd. It’s just an arbitrary example to demonstrate.
So I drop down my good old Wrangle node and type in the VEX expression:
float mult_value = 2;
@v += noise(@nage) * mult_value;
@Cd = @v;
Easy enough. However, wouldn’t it be better to be able to keyframe or have interactive control of the mult_value with say a slider control instead of it being a hard coded value? Of course!
This is where that little thingamajig comes into the picture. Instead of going through the whole “Open the Parameter Interface, blah, blah, blah...”, all you have to do is click on that image of a tube with a hotdog coming out of it.
But wait! It won’t work just yet. You have to do one last step. We know we have to use our channel functions. In this case, we will be using the chf function since the value is a float. So we refactor the code like the following:
float mult_value = chf(”multiplier”);
@v += noise(@nage) * mult_value;
@Cd = @v;
Notice I passed the chf function an arbitrary string. You would of course name it in a way to indicate what the value is actually doing. Now you can go ahead and click on the button and like magic, the spare parameter will be created underneath the VEX editor window or whatever that thing is called. What fun!
Also, I could have eliminated the float variable and just had one line of code but this way it's cleaner. You’re essentially doing the reverse. You write your function first then the parameter is created. In contrast to creating the parameter first then writing the function to link the parameters together. You can always open up the Parameter Interface and reorder your parameters.
There you have it! Fall Guy time!
I actually come across it by mistake.
Houdini Engine 2 Masterclass | Thin Client
FromTheDocs — Motion Blur and Expressions
Motion is evaluated at sub-frame intervals. If you use expressions to animate objects or deformations, you should use $T (floating point time) or $FF (fractional frame number) in the expressions instead of $F (integer frame number). Expressions that use $F will not show motion blur properly (since the expression will give the same result at every sub-frame).
source: http://www.sidefx.com/docs/houdini15.0/render/cameras
Freezing Effect in Houdini 15 by Msalehi
Houdini 15 Crowds Masterclass