Home Creators Posts Import Register Favorites Logout

Videos

  • clip01.mp4
  • clip02.mp4

Downloads

Some files exceed the archive size limit and weren't saved: 1 file. Please note these limits are in place to keep this site running long term, without costing a fortune. You can favorite the creator though, certain milestones increase the limit.

Content

With the amazing new RenderMan support in Gaffer I wanted to add an installment to my Introduction to Gaffer series. We’ll look at the new features we can take advantage of to upgrade the chess set demo project from Introduction to Gaffer. Gaffer and RenderMan combine to provide an incredibly powerful and flexible toolset that produces spectacular images with ease.

The Gaffer scene, USD files and textures are available for download at the bottom of this article. For the full experience you’ll need to be running the latest Gaffer nightly build from https://github.com/GafferHQ/gaffer/releases/tag/nightly. Once 1.6.6.2 comes out that should have all the features needed going forward.

Let’s take a detailed look at how I ported the original Cycles scene over to RenderMan, starting at the top of the graph! (For a refresher about how everything was set up to begin with, check out earlier installments in this series.)

I replaced the Cycles lights with PxrRectLights and a PxrDomeLight.

I kept the size and position of the rectangle lights, but the intensity needed for RenderMan lights is different than Cycles. I settled on an intensity of 2 for the top light, 6 for left and right and 1 for the dome light. I updated the connected Spreadsheet to reference the new RenderMan lights.

Moving down to the material assignment sections, I replaced all the materials with PxrSurface and PxrTexture for the textures.

Note that when using Gaffer all the textures will have to be pre-converted to RenderMan’s .tex format. (This is easily done with my texture conversion script, found here: https://www.patreon.com/posts/99745842)

I dialed in the appearance of the materials as needed. One helpful resource I found was the material presets that come with RenderMan for Blender. I used their gold Physical preset to get a nice look for the gold leaf on the board.

It’s interesting to note that a lot of their plastic, wood and other materials have Primary Specular Edge Color near 1 and Face Color near 0. This indeed looks quite nice, so let’s go with the experts! I increased the Face Color value a bit in some places to get more reflections than you perhaps would find in a physically correct system. They call it “Artistic” mode in the dropdown for a reason!

I used PxrExposure nodes to set global control points for shared settings. For example, all the pieces will have the same specular settings, so those can be controlled from dedicated PxrExposure nodes.

Next, displacement. This is controlled with PxrDisplace nodes and a PxrTexture connected to each dispScalar input.

My height textures were created with a midpoint of 0.5, so I made sure RenderMan was configured for this by offsetting all textures by -0.5.

You can check this by rendering a test image with no displacement, then trying different offsets. The correct offset will not move the overall surface of the mesh and will only create small surface details. For example, if I didn’t offset the textures by -0.5 in this case the meshes would ballon outwards.

I created more PxrExposure control points for the shared displacement offset and scale values.

That does it for materials!

Next up is a very important node, offering a huge upgrade over Cycles. RenderMan has fantastic support for on the fly subdivision, so we don’t need to use a MeshTesselate node within Gaffer to smooth the meshes. This makes the scene vastly more responsive and streamlines scene setup. However, we still need to tag the meshes as subdivision surfaces. Some Alembic or USD files will have this preconfigured, but mine doesn’t, so we simply add a MeshType node set to Subdivision Surface.

RenderMan will now automatically smooth things to perfection.

Next I added a RenderManAttributes for the purpose of setting displacement Bound Radius. This is not required, but it’s a nice way to prevent accidently setting a much too large dispScalar value somewhere and crashing the scene. I put it at 0.2, still probably higher than needed, but it’s just a safety valve in case of fat fingering a value elsewhere.

Now a RenderManOptions node. This controls all our global render settings. I didn’t change much here, just set Max Samples to 32, set the CPU Thread Limit to use all but 2 cores, and configured which GPUs XPU should use.

Pixar has stated that they often use only 64 max samples on their production scenes and denoise from there. 64 is overkill for this relatively simple scene, so I went with 32. It’s very noisy but cleans up great in the denoiser.

Next is a RenderManIntegrator with PxrPathTracer attached. All default settings here. The vast majority of the time PxrPathTracer is the best choice. PxrVCM is useful for heavy caustics and others like PxrVisualizer are nice for inspecting mesh attributes.

Jumping down to the end of the graph we set up our Interactive and Batch render settings. I used RenderMan XPU for max speed. XPU is incredibly responsive in Interactive mode and final frames finished in less than a minute for me in Batch mode.

One thing worth noting, although it’s not something I use further in this scene, is that Cryptomatte is currently RIS only, no XPU support. For demo purposes here I branched off a RenderManSampleFilter connected to a PxrCryptomatte that is piped through a RIS Batch render.

Note that by default this would output an unneeded image since PxrCryptomatte is a filter, not a Batch output in Gaffer. A neat trick here is to change the output Type from exr to null. This bypasses the extra image output and saves only the Cryptomatte file to disk.

In order to configure our final EXRs for the RenderMan ML denoiser we need to manually create a bunch of specific AOVs. Gaffer in theory has these available as defaults, but they’re not quite right as of this writing and need to be tweaked a bit. Here is the full list of required AOVs.

Skip the default “Beauty” layer, change the Mse Data to color Ci from rgb and add two new layers, Ci and a. You’ll find all the needed settings by loading the Gaffer scene.

That should do it!

Finally, note that you’ll need to update the geometry and environment light paths to match your system (use you own environment light image) and also update the output paths.

Press Dispatch in the LocalDispatcher and wait for the magic to happen!

Once all the images are rendered, it’s denoising time. You could run the RenderMan denoiser GUI or do it from the command line, but let’s do it in Gaffer.

In Gaffer you can run console commands using a SystemCommand node. I added three, one for each denoising process: the closeup camera, the environment light and the turntable.

I created fileName and denoiserPath Substitutions with the relevant paths. This lets us use these variable names in our console command and avoid typing out long lines that are hard to edit later.

Our final command is cd {denoisePath} & denoise_batch {fileName}, which on my system expands to cd "C:/Program Files/Pixar/RenderManProServer-27.0/bin" & denoise_batch C:/Users/Brian/Desktop/chess/rman/close.${color}.####.exr.

Note that I used Python expressions to link the SystemCommand nodes to the first one so as to avoid retyping the same variables and commands in each one. This is just a taste of how customizable Gaffer is using Python. We can easily reference and perform operations on values from any node in the scene.

I attached everything to the same kind of Wedge used in the main render so that we can loop over everything using both red and black color values.

Click Dispatch and wait for more magic! In short order you’ll have incredibly high quality denoised images saved to a denoised subfolder.

Conclusion

This is all very exciting! Gaffer was already best in class for this kind of work and adding RenderMan bring things to an even higher level. RenderMan is one of the most powerful, sophisticated and battle tested renderers in the world. It really shows here. Everything we wanted to do was easily accomplished, no workarounds or compromises needed. The image quality is stunning. I often say that light in RenderMan is radiant. Gorgeous! And of course the denoiser means we no longer have to wait hours for RIS to painstakingly grind through thousands of samples. Just 32 for this scene, denoise, and we’ve got perfect, noise free images.

We’re living in a Golden Age now as far as 3D creativity. The fact that we have access to this level of power is awe inspiring.

Files

Comments

Simba Kunedzimwe

Hie Brian. Happy to join your channel. Merry Christmas.