EDIT

{{article.title}}

modified {{article.lastModStr}}
{{videoUrlObj.title || videoUrlObj.oEmbed.title}}
{{videoUrlObj.description || videoUrlObj.oEmbed.description}}
{{ article.videoUrls | totalDuration }}

In this we'll go over how to utilize Megascans assets in Renderman, Megascans provide high-quality geometry and texture maps from real-world scans - they're captured in a way to provide consistent output which makes them really useful to setup a single all-purpose shading network which can be re-used via Renderman's Preset Browser.

At lot of these concepts aren't specific to Megascans maps and geometry, a lot of this is fundamental look-development setup which works for any source of map and geometry your working from. I'm approaching this from a very asset-centric workflow where you model and texture the assets individually then pull them in together to build your scene.

Getting Started

Megascans provide free samples of their scans to give you example of what their like, head on over to https://megascans.se/library/free to download them. I'm using the Rock Sandstone and Soil Clay examples here.

The first thing you'll notice is your given a range of options for your download, these options cover the resolution of the maps and geometry, the type of rendering your wanting to do (real-time vs offline) and how you want to deal with specular colour (specular/metalness) and specular roughness (roughness/glossy).

I've gone for the above options. There isn't neccasirily a correct set of options here - it largely comes down to how you like to work and how you use the maps. There is more details on what the maps are in the Megascan FAQ

Context - Realtime vs Offline

This largely seems to determine whether you want to use Displacement or Normal maps. Here I went with Offline as it provided both Normal, Displacement and Bump maps. I wanted to try all three out.

The displacement maps provided in the free samples are 8-bit JPG files - this can cause "stair-stepping" artifacts. It looks like the paid-for samples come as 32-bit EXR files.
Whether to use Displacement, Normals or Bump is largely up to what you want to do, each have there benefits.
  • Displacement - moves the geometry so provides more realistic results, relies on both texture resolution and tessellation resolution (micropolygonlength) in order to acheive fine details - this can slow down rendering performance as "more micropolygons to trace equals slower render".
  • Normals - modifies the normals of the geometry to provide a similar effect to displacement, because this doesn't move the geometry it results are less realistic especially on geometry silhouettes - relies on texture resolution only so provides for finer details without the rendering cost.
  • Bump - similar to Displacement except it doesn't move the geometry, relies on texture resolution only so provides for finer details without the rendering cost.

There is the potential to use all three at once, displacement to do low frequency geometry changes with normals/bump to do high frequency details.

Workflow - Specular vs Metalness

I saw this as presenting the following questions "do you want a map that is ready to use?" or "do you want a map that is good for flexiblity?"

  • The Specular map is already well adjusted and doesn't require much tweaking. Just plug it in.
  • Metalness provides a Cavity map which provides a better starting point for tweaking but would probably require tweaking.

I went with Specular on this one, although having the Cavity map provided with a Metalness workflow would be handy to have around.

Microsurface - Roughness vs Glossiness

These is largely personal preference here as these are the inverse of each other, I find it it easier to talk about how material properties in terms of how "rough or smooth" it is rather than how "glossy" it is.

Look-development Prep

In order to get consistent shading it's really important to make sure your adjusting your material properties in scene where your not constantly changing the lights and cameras.

My setup typically includes the following...

  • For the geometry, name it appropiately, set up any render attributes, make sure the scale works with my settings (I use centimetres).
  • Camera set to rotate around the object. This allows you to play back the render in a continuous loop which makes for a nicer presentation. To do this set the frame range you want to use (I'm using 48 frames, although you can use whatever you like) and then set two keyframes on the rotateY of the "turntable" group. Frame 1 set to 0 and frame 49 set it to 360 (this makes it loop cleanly) and make sure the keyframe interpolation is set to linear.
  • A few different lighting setups such as daylight, cloudy, interior and night time. The lighting setup you choose should best represent the type of lighting setups your going to be using in your project. I primarily use PxrDomeLights because they aren't dependant on the size of the geometry - although I do have a few lighting setups I use which use PxrRectLights are based on real-world lighting setups, so they only work with certain sized geometry.
  • I use renderlayers to switch between the different lighting setups.

The really important part about this is once it's all setup, the only thing you then modify is the shading network - you avoid touching the geometry, camera and lighting as best you can.

Connecting Up The Maps

If you want to get started straight away, the following connections will get you most of the way there.

  • Albedo -> PxrSurface.diffuseColour
  • Bump -> PxrSurface.bumpNormal
  • Displacement -> PxrDisplace
  • Fuzz -> PxrSurface.fuzzGain
  • Normal -> PxrNormalMap
  • Roughness -> PxrSurface.specularRoughness
  • Specular -> PxrSurface.specularEdgeColour

Although to help you make adjustments and tweak your work here are a couple of useful things to setup in your shading network. The network I've come up with looks like this...

Diffuse Colour/Albedo

To have greater control over the the Diffuse contribution. It helps to have include a few additional patterns to allow for easy tweaking.

  • PxrManifold2d - Some of the Megascans are designed to be tileable. You can connect a single PxrManifold2d up to multiple textures so that you have one control over the tiling effect.
  • PxrTexture - the Albedo maps supplied are in sRGB colourspace, so you'll need to make sure "Linearize" is on.
  • PxrHSL - this provides simple hue, saturation and luminance adjustment over the albedo.
  • PxrMix - this allows me to mix back to a constant colour such as a mid-grey (0.18). By default I have the texture map passing through Colour1 and Mix set to 0. When mix is set to 1, it uses Colour2 instead. Grey renders like this can be useful for debugging or blocking out your lighting if you don't have all of the assets in your scene lookdev'd yet.

I found the original saturation of the albedo maps slightly over-saturated, so toned most of them down to a saturation value of 0.67 by default. In the example below I've set the rock and clay to the same adjusted saturation, although I'd probably increase the saturation back up on the clay.

The following example shows the use of PxrMix to switch between the texture map and a constant grey colour. You'll notice it's much easier to see the specular highlights without the diffuse albedo.

Specular Colour and Specular Roughness

For the specular controls I do a very similar network, although I replace the PxrHSL with a PxrRemap.

On PxrSurface I prefer Specular Fresnel Mode set to Physical and Specular Model under advanced to GGX. Setting the fresnel using an Index of Refraction value has become intuitive for me and GGX produces nicer specular tail which matches up pretty closely with photographic reference.

The specular section of the shading network looks like this.

  • PxrManifold2d - this is the same pattern used throughout the shading network.
  • PxrTexture - because these maps represent scalar values rather than colour, "linearize" is turned off.
  • PxrRemap - this is used to tweak the effect of the map on the specular response.
  • PxrMix - used to set a constant value rather than use the texture map, by default Colour2 is set on SpecularColour to 0.5 and SpecularRoughness is set to 0.3

Using a PxrRemap to tweak the SpecularRoughness, by default the values in a) the original roughness map are too rough and produce b) a render which produces no smooth reflections, lifting the inputmin value to 0.8 produces c) which provides more contrast in the roughness map resulting in d) which contains a mix of rough and smooth reflections.

To find your specular roughness values, it oftens helps to output a "wedge" which animates the specular roughness from 0 to 1 across several frames. You can then use this image sequence to help figure out the range of values you want use for your specular roughness map.

Displacement

Setting up the displacement was the easiest to setup in terms of shading network and then the trickiest thing to figure out about what encoding was used for the displacement. Each of the sample displacement maps I had seem to work differently, despite the Megascans FAQ pointing out the following values should be used White = 10 cm, Gray = 0 cm and Black = -10 cm. The network itself looks like this in the node graph.

The settings I used for the clay ground looked like this...

  • PxrManifold2d - Used to scale the tiling effect of the ground.
  • PxrTexture - The default settings here.
  • PxrDispTransform - Here I've used centred as the remapping mode and set the displacement height-depth to 2-2 with the displacement centre at 0.5 (grey), with the the clay ground I largely eyeballed what I thought was a good height-depth to use.
  • PxrDisplace - I've just connected the Scalar Displacement here, one thing to always check here is that if your not using Vector or Model Displacement is that those values are always zero.

The PxrDispTransform was the tough bit to get the settings right, going off the Megascans FAQ, the displacement height-depth should have been 10-10 and remapping set to centred. For all of the free samples I found two settings that generally worked well.

  • Displace Height-Depth = 1-1, Remapping Mode = Centred, Displacement Centre = 0.5
  • Displace Height-Depth = 10-10, Remapping Mode = None

Normals

The normals setup I used looked like this.

  • PxrManifold2d - same as above, used to tiled all the texture inputs at once.
  • PxrTexture - even through PxrNormalMap has a texture input, this has more controls (linearize, blur, filter, altas, etc) on it that I wanted to play with.
  • PxrNormalMap - for orientation I used DirectX which resulted in the lighting direction coming from the right place, I also set Adjust Normals to 1, this prevents the normals from getting orientated into places they shouldn't go and prevents artifacts.

Matte IDs

In a production environment it's often really helpful to provide additional AOV passes to the compositing team in order to allow them to fine tune the composite - these passes go by lot's of names - I've heard them called 'helpers', 'utilities', 'secondaries', 'isolates' or more commonly 'AOVs' (A-O-Vees).

To set this up in Renderman requires two steps. The first is to create a PxrMatteID pattern and connect up your texture inputs into it. Then the PxrMatteID.resultAOV is connected to the PxrSurface.utilityPattern.

  • After this you need to add Matte attributes to either the PxrSurface material or your geometry and set them to a white colour. The reason for doing this is Renderman multiplies the colours on PxrMatteId by the Matte attributes - allowing you to split up the MatteIDs even further.
  • Add Matte render outputs under Passes in render globals.

You may have noticed I've not connected up anything to Matte Texture 0 in the node graph yet I've set Matte ID 0 as an attribute to green. This is a constant colour ID based on the geometry. The end result looks something like this...

The magenta colour represents that the input texture is missing and not available - this is useful for debugging, as it's much easier to spot a bright magenta colour then a black colour.

Building a Reusable Material

Once I was happy with my shading network I wanted to create a material that I could quite simply re-use again and again without having to rebuild each time. To do that I did removed any asset specific parameters I had set (texture paths, saturation, displacement, etc) and set my PxrMix pattern so they read in a constant value rather than a textured value. This means my Megascan material will by default render as a grey plastic material, in order to set it up for rendering properly I have to point it to the right textures and then switch the PxrMix patterns to read the textured value.




Project Assets
Tags
  • {{tag.name}}

Log in to post a comment

{{ commentBody.length || "0"}} / 10 characters

No Comments, Yet

Comments