/houdini-blender-clipboard

Enables easy geometry exchange between Houdini and Blender.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Houdini-Blender Clipboard

This program automates geometry exchange between Houdini’s SOPs and Blender using Alembic file format as a medium. It works similarly to your typical clipboard. The only difference is that yanked data is not stored in volatile memory, but physically on the file system (inside operating system’s temporary directory).

With this program, with just two mouse-clicks you can:

  • effortlessly export selected SOPs from Houdini and load them in Blender,
  • export selected objects from Blender and import them in the vicinity of currently selected SOP,

Use Case

The program can be used to easily make ad hoc destructive (non-procedural) changes to SOP geometry with Blender.

For example, while modeling an object in Houdini you decide that some operations would be faster to carry out with traditional modeling techniques in external software. Normally, in order to export geometry from Houdini, several steps are required. You need to create a ROP SOP, provide it with a target path and configure it. It’s also possible to export geometry via the right-click context menu, but this method doesn’t offer any configuration options.

Importing geometry in the target program also requires several actions. You also need to remember path to the exported file.

Same for re-importing modified geometry in Houdini. All of this quickly adds up and makes the whole process a hassle and a time waster.

Houdini-Blender Clipboard attempts to solve this by providing two buttons: one for yanking the geometry, the other for pasting it into the scene. This makes the export-import process virtually seamless. You select one or more SOPs that you want to modify and hit the “Yank” button. Then, you switch to Blender and hit the “Paste” button to place yanked geometry into the scene. When you’re done making changes, you press the “Yank” button in Blender, and with one SOP selected in Houdini, you press the “Paste” button.

TIP: Once you decide that the object you’re working on is finished, you might want to export geometry from Stash SOPs created by this program into file(s), and then replace stashes with operators capable of referencing those files (like File, Alembic, GLTF, etc., depending on what format you use at this stage of your pipeline).

Why Alembic?

Four reasons:

  • unlike FBX, it’s an open format,
  • it’s reliable,
  • it supports custom attributes (like subdivision crease weights),
  • it supports animation.

Requirements

This program was tested on Houdini 19.5 and Blender 3.2.2 and thus the minimal requirements are set to those versions. It should also work on older builds of those programs (Houdini with Python3 only), but if you want to test it on them, you will need to set appropriate minimal versions in houdini-blender-clipboard.json and scripts/python/__init__.py files.

If you intend to export heavy, high resolution geometry or animation, make sure that /tmp is large enough to accommodate that data.

Please note that the program has not been tested neither on Windows nor on macOS.

Installation

  1. Clone the repository into $HOUDINI_USER_PREF_DIR/packages:
    cd $HOUDINI_USER_PREF_DIR/packages
    git clone https://github.com/ajz3d/houdini-blender-clipboard.git
        

    If you didn’t set this environment variable, Houdini user preferences directory will be located in ~~/houdini##.#~.

  2. Copy houdini-blender-applink.json to $HOUDINI_USER_PREF_DIR/packages:
    cp houdini-blender-applink/houdini-blender-applink.json ./
        
  3. Symlink hou-blend-clipboard/scripts/python to add-ons directory of your Blender installation (~~/.config/blender/#.##/scripts/addons~):
    ln -sf "$HOUDINI_USER_PREF_DIR/packages/houdini-blender-clipboard/scripts/python" ~/.config/blender/#.##/scripts/addons/houdini_blender
        
  4. Open Houdini and add “Blender Clipboard” to your shelf set.
  5. Open Blender and enable “Houdini Clipboard” Import-Export add-on.

How to Use

Exporting from Houdini

Make sure that geometry which you want to export has name primitive attribute. Value of this attribute is used for naming imported objects in Blender.

With at least one selected SOP, go to “Blender Clipboard” shelf and press the “Yank” button. If you want to export animated geometry, hit the “Yank(Anim)” button. It will export current frame range.

Note: In order to export creaseweight attribute, you need to set object node containing your SOP network(s) to “Render Polygons as Subdivision” and then choose “OpenSubdiv Catmull-Clark” from the list.

Importing from Houdini

Open 3D View’s sidebar (n key) and switch to “Houdini” tab. Click the “Import” button. Objects from Alembic file(s) will be imported into currently selected collection.

If object of the same name already exists in the scene, it will not be overwritten. Instead, an object with different name will be created (Box, Box.001, etc.)

Exporting from Blender

Select objects that you want to export, open 3D View’s sidebar and switch to “Houdini” tab. Click the “Yank” button.

Only objects of type MESH will be exported.

Note: In order to export subdivision creases, a subdivision modifier must be present on exported objects.

Importing from Blender

Select one SOP, then press “Import” button from the “Blender Clipboard” shelf. The program will create a Stash SOP piped into selected SOP’s output.

A special case is if selected SOP is a Stash. Here, the existing Stash operator will be updated with imported content.

Exporting animation

The program allows for exporting animation in one-way only: from Houdini to Blender. The reverse is best done manually, with Alembic SOP referencing a file outside the operating system’s temporary directory (residing in a more permanent location, like somewhere in $HIP or $JOB trees).

The rationale is that stash SOP and operators that are hardlocked are capable of storing single frames only. Therefore, I currently don’t see any reasonable way of embedding imported Alembic animation into .hip files. Embedding animation would also be a terrible idea, as it would cause .hip files to easily balloon to ludicrous sizes.