VRAYprocedural – getting started 2 – compiling

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 SOP_Star.so 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:$HOME/houdini11.0/dso/mantra
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?

A flowchart of the VRAYprocedural connections

When you compile from a myProcedural.C, you will get a myProcedural.so 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 myProcedural.so, 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
ls

move the plugin:

mv VRAY_DemoBox.so ./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:

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:

The dso is not in the right place. Should be in $HOME/houdini11.0/dso/mantra

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

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.

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.