Compiling a VRAYprocedural example

Compiling a SOP

After you have copied the samples folder from $HFS/toolkit/samples it is time to try and compile one of the examples. It is a little bit easier to compile a normal sop rather than a VRAYprocedural, so let’s do that first. The SOP_Star.C is easy to test.

cd $HOME/dev/houdini11.0/samples/SOP
hcustom SOP_Star.C

This will create in $HOME/houdini11.0/dso which is the default where hcustom will put plugins for most nodes. VRAYprocedurals are not loaded by houdini, but are loaded by mantra. They should be put in:
If all went well, you should be able to start up a new houdini and inside of a geometry node, lay down a star sop. A change to a plugin requires you to restart houdini. However changing a VRAYprocedural does not require you to restart houdini as it is loaded by mantra and mantra is only called when you launch a render.

How does it all link together?

VRAYprocedural flowchart

A flowchart of the VRAYprocedural connections

When you compile from a myProcedural.C, you will get a which will need to go into the $HOME/houdinixx/dso/mantra folder. In order for a user to change any parameters from within houdini an interface is required. This interface is provided through a custom otl, example myProcedural.otl which will be put in $HOME/houdinixx/otls. The last step is to make sure that the myProcedural.otl links to the, this is done through a separate configuration file. This configuration file is called VRAYprocedural and should be put in $HOME/houdinixx You can find an example of this configuration file in the $HFS/toolkit/samples/VRAY folder.

Compiling a VRAYprocedural example?

Time to compile one of the examples:

cd $HOME/dev/houdini11.0/samples/VRAY
hcustom VRAY_DemoBox.C

Now make sure that dso goes into the $HOME/houdini11.0/dso/mantra directory. If that directory does not exist it needs to be created.

cd $HOME/houdini11.0/dso
mkdir mantra

move the plugin:

mv ./mantra

Next step is to register the plugin in mantra through the VRAYprocedural file. We’ll copy the file from the samples directory and modify it later when we add our custom plugins:

cp $HOME/dev/houdini11.0/samples/VRAY/VRAYprocedural $HOME/houdini11.0

Let’s take a quick look inside the VRAYprocedural file, specifically:

demobox			DSO_FILE(VRAY_DemoBox)

On the left is the name of the otl, on the right is the name of the dso. This needs to be exact as this is how the DSO is linked to the otl.

Now we need to make the otl that will provide the user interface inside of houdini. A VRAYprocedural will link into an object through a procedural geometry shader, just like a mantra delayed load. So we will need to make a new SHOP, a geometry/procedural shader. Open a new houdini session and go to:

File -> New Operator Type

New Geometry Shader

Create a geo node at object level, put a shopnet inside. Dive inside the shopnet and lay down a demobox shop. Jump back up to the object level and select the geo node. The demobox is a geometry shader, this is assigned to the object in the procedural shader, it will overwrite whater geometry is inside. Generally I tend to put a null inside with the renderflag set:

geo1 -> Render (tab) -> Geometry -> Procedural Shader

Add a light and camera and kick off a render, you should see a red box. If you do not see a render it could be that:

  1. The dso is not in the right place. Should be in $HOME/houdini11.0/dso/mantra
  2. The dso is not being registered by mantra. The VRAYprocedural is not present inĀ $HOME/houdini11.0 or not properly configured. The name of the otl and the name of the dso need to be exactly correct. You can check as well by running mantra from the shell in verbose mode and see the procedurals that are listed:
    mantra -V4
  3. The .so file was not created and there were errors/warnings during compilation. You might be missing the right compiler or some of the required packages. There have been some changes in the HDK from houdini 10 to houdini 11, so there might be some warnings, but the demobox should still compile.
  4. The geometry shader was not assigned to the object. Simply assign it.

I would recommend trying to compile the other VRAYprocedural samples. You will have to create the otls manually and match the parameters by name and datatype to the parameters in the .C files.

Here is a very basic scene file with the demobox assigned to geo1. Follow the above instructions to set it up and compile the demobox from the $HFS/toolkit/VRAY samples.

File: demobox_procedural_01