Saturday, February 4, 2017

Tutorial: Displacement for Renderman 21

So I've been working on a project in my freetime using the latest Renderman 21 with Maya 2016. Really loving it so far, but there is limited documentation out there right now for the new shaders and work flow that has changed since Renderman 20. This proved to be especially difficult when I was trying to set up displacement maps that I had generated through Mari.

There IS documentation if you made your maps in Mudbox or Zbrush, so if that's your situation then stop reading and check out these links!
and this video is pretty good too:

BUT if you are using maps you created in Photoshop or Mari, I couldn't find anything explaining how to set this up. I tried following the tutorials shown above, and just plugging in my maps from Mari instead, but it caused my model to shift to the right for some reason.

Anyway after much trial and error, I DID figure out what to do! I honestly have no idea if this is the proper way to do it lol, but it worked for me and so I thought I'd pass it along for anyone else struggling as I did.

Without further ado.....

How To Setup Displacement for Renderman 21 Using Maps From Mari

Step 1: Create File Node

- Displacement maps should be 16 bit or 32 bit, so make sure your Mari channel or Photoshop file has been set up for this.
- Set your Color Space to "Raw" so it knows to read the map as linear.
- If you have your map painted so that 50% gray should not displace, then set your Alpha Gain to "2" and your Alpha Offset to "-1".

Step 2: Create PxrDispTransform Node

- Make sure your Displacement Type is set to "Scalar"
- Plug in your file node into the "Scalar Displacement"
- Leave everything else as is

Step 3: Create PxrDisplace Node

- Plug in the "PxrDispTransform" Node into the Scalar Displacment. The Connection Editor will pop up. Select "resultF" on the PxrDispTransform side and then "dispScalar" on the PxrDisplace side.

- The Gain is where you adjust how strong you want the map to displace. 

Step 4: Plug PxrDisplace node into the SG node

- Profit!

In the end your network should look like this:

Thanks for reading! And I hope this helps keep you from banging your head against the wall like I did ;P