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>"))
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.
Image may contain: water
Image may contain: art
Image may contain: outdoor, person and clothing
Project Breakdown
“PlaceSpheresProc.cpp” and “pp_place_spheres.py”
The goal of this project is 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.
And to really begin the whole process, you have to locate your “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.
MAYA_USER_DIR= C:\Users\”YourUserName”\Documents\maya
RFM_SITE_PATH=$MAYA_USER_DIR\rfm_scripts
RMS_SCRIPT_PATHS=$MAYA_USER_DIR\rfm_scripts\image_tool
MAYA_SCRIPT_PATH=$RFM_SITE_PATH/mel:$MAYA_USER_DIR\scripts
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 everytime 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 useing these two lines in 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(“”))
so 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
Final Thoughts
The whole idea of the scene is from the rainbow bridge in the movie Thor,
I created 5 extra attributes, radius, jitter, probability, num_particles, and particle_spread.
After that, I parented the model that I want under the RenderManProcedural, and set the target to that model.
And just lots of set keys and tweaking numbers!
I had so much fun working on this project, Even though it’s still confuses me and causing error sometimes.
In the beginning when I felt like I couldn’t keep up, I was really frustraited. But with the help of professor and classmates, I am pretty pleased of what I have achieved.
In this project, I focused on practicing C++ code to generate RenderMan procedural primitives. The goal was to create a scene inspired by the rainbow bridge in the movie Thor, where I downloaded a model and short animation from Mixamo and placed RenderMan procedural spheres on it. To achieve this, I created a RenderMan procedural node and loaded the script with it. I also edited the “Maya.env” file to tell Maya to look for the script in specific folders.
The project involved creating 5 extra attributes, including radius, jitter, probability, num_particles, and particle_spread, and parenting the model under the RenderMan procedural while setting the target to that model. There were lots of set keys and tweaking numbers involved, but the end result was worth the effort.
Although I faced some challenges and made mistakes along the way, I enjoyed working on this project and learned a lot from it. It also helped me to improve my skills as a 3D VFX and Digital Composition artist, and I am excited to continue exploring new techniques and approaches in my future projects.