Run!
Creating RenderMan Procedural Primitives with C++ Code

I am a 3D VFX and digital composition artist, always striving to improve my skills and techniques. Recently, I have been working on a project to practice using C++ code to generate RenderMan procedural primitives. The goal was to download a model and short animation from Mixamo and place RenderMan procedural spheres on it.

Have you ever wondered how to generate RenderMan procedural primitives with C++ code? As a 3D VFX and digital composition artist, I recently worked on a project to explore this technique. In this article, I will walk you through the process and share some tips and tricks I learned along the way.

Project Breakdown

The goal of this project was to practice using C++ code to generate RenderMan procedural primitives. I downloaded a model and short animation from Mixamo and placed RenderMan procedural spheres on it. To really begin the whole process, I had to locate my “Maya.env” file. The path is usually C:/Users/”YourUserName”/Documents/maya/2019/Maya.env.

It needs to be edited so that it can tell Maya to look for the script in specific folders. Because C++ scripts are not being read automatically by Maya, it’s important to create a RenderMan procedural node and load the script with it. Under the DSO Name, instead of loading the cpp file, you will need to choose the compiled file with extension “.dll”. And every time you edit the cpp file, you need to ctrl/alt E and ctrl/alt R to compile the file.

You can tell Maya to look for the correct Python script by using these two lines in the script editor:

import pp_place_spheres reload(pp_place_spheres)

And in the RenderMan Procedural, look for the “Pre Shape Python Script” in the drop-down menu “Scripts” and type in:

import rfm2.api.strings as apistr; import pp_place_spheres; pp_place_spheres.setDataStr(apistr.expand_string("<shape>"))

The important files you need are located at:

  • C:/Users/User/Documents/maya/rfm_scripts/python/pp_place_spheres.py
  • C:/Users/User/Documents/maya/rfm_scripts/proc_prims/src_c++/place_spheres_proc.cpp
  • C:/Users/User/Documents/maya/rfm_scripts/proc_prims/place_spheres_proc.dll

I had so much fun working on this project, even though it sometimes confused me and caused errors

In the beginning, when I felt like I couldn’t keep up, I was really frustrated. But with the help of my professor and classmates, I am pretty pleased with what I have achieved. This project helped me enhance my 3D VFX skills, and I look forward to exploring more techniques in the future.