So I just confirmed this is something broken in H14. All of the work to date that I've done using this shader, a hard surface + effects commercial for TxTag and special venue piece lighting and rendering over thirty dinosaurs for Garden of the Gods in Colorado, were done in H13.
The Help Card works just fine in H13 but I get a server error in H14. Sigh. Here is the contents of the Help Card to reference until Orbolt + SESI get there scheisse together:
This is a PBR only shader, created for realism. It’s intended to use for realistic beauty passes with adjustment in compositing. It has as few parameters as possible to work easy and fast with it. It’s ideal for complex and realistic surfaces, such as metal, paint, wood, cloth, stone, rubber, glass, plastic … and layers of those. It’s intend of use is, for example: create a base layer of wood, add gold paint on top and a layer of dirt and grime. Depending on the alpha channels and view angle the shader will mix it and Mantra will render it in one go (the number of layers doesn’t affect rendertime much!). It works great with Zbrush, Mudbox, Mari. OpenGL support is very limited, at the moment. It comes with many presets, based on real life or scientific data!
Feel free to send me feature requests, bugs and feedback. Dany Bittel: mailto:firstname.lastname@example.org
Subscribe to the newsletter, to recieve update notifications: http://eepurl.com/G4t9r
up to 3 individual material layers realistically mixed
energy conserving and view dependent
refraction with basic dispersion and absorption
support for different uv sets
Mari UDIM support
individual front and back shading
support for Cd and Alpha attribute
bump map (normal and vector)
built in bump noise
built in flakes
anisotropy (with maps)
specular and metal specular
adjustable specular radius and falloff
adjustable specular sharpness at glancing angle
adjustable roundness of the specular peak
diffuse roughness and sheen
RGB masks for individual layers
AOVs (reflection, refraction, diffuse, emission, sss, Z, uv, velocity, normal, position, facing)
displacement (along normal, object space or tangent space)
optimization (override shadow, alpha and turn off features in reflections)
Point based caching (experimental)
The shader creates a material by spliting it into different layers. The Solid is everything that’s inside the material, covered by the Base. Those two layers are the minimum. Layer 1 and Layer 2 can be enabled and added on top. The calculation will start at the top most layer and work it’s way down.
The calculation takes physical behavior into account:
If a layer is fully opaque, the light is blocked and the layers below are not visible.
The thickness (opacity or alpha) of the layer correlates with the diffuse component of the layer (in a approximated kubelka munk curve)
The specular component is visible no matter how thick a layer is, just like in real life, the speculairty doesn’t depend on the thickness of the material (it’s the light that gets reflected directly from the surface, without penetrating it).
That also means that theres no semi transparent metal.
The layers are thicker at glancing angles, because the light has to travel further.
If a layer is not clear coated, (it either has some diffuse component or the specular is blurry), the layer below will be blurrier aswell.
Specular components won’t get layered. Only the top most specular is visible. Exceptions are if the specular is tinted or metal.
It’s important to keep the materials at a plausible brightness. Normally around 80% should already be perceived as white. Similarly there’s no 0% black material in nature. You can make a test material, set it’s Color to 0.8/0.8/0.8 and adjust the brightness of the lights to make it look like white. If your materials are too bright, PBR will slow down!
There are a lot of presets (use the gear icon). Most of the presets are only one layer. So it’s possible to layer two presets on top of each other, just copy paste from one presets Base to the other shaders Layer 1 (for example). Then you can use a map to mask areas of the top layer, to make the layer below visible.
All the parameters have tool tips and should be fairly easy to understand. Some more details:
use IORs for fresnel
The Base layer and only the Base layer’s fresnel can be defined through the IOR’s that are set on the solid. This is useful for water, glass, diamond maybe “physically perfect plastic”. It’s not a good idea to use it for every material you know the IOR, most real life materials are not as perfect as scientific data.
Defines the look of the specular highlight. If it’s set to 1 a standard highlight is used. Higher values makes the highlight more of a peak. The specular will also get stronger, to keep energy conservation. In real life, the falloff is almost always stronger then 1, especially for metals. The implementation of this effect is kind of a hack, there’s no math out there yet, to implement it correctly. The downside of this is, that the sampling might not be perfect for very strong peaks. (3+)
An effect that is often visible in nature, but there’s no math out there yet to cover it. Sheen basically brightens the diffuse component and makes the specular stronger at the border. Sometimes this can introduce artifacts at the edge, lower the sheen then.
The specular behaves very different if Tint is set to 0 or not. At 0 the specular is like an ordinary specular. Higher values simulates the effect of light slightly entering the surface, but still reflecting in a specular (concentrated) way. Something between diffuse and specular. This effect is very common in real life, on surfaces like wood’s and paints. The Fresnel of a tinted specular is reversed. The Minimum is then found at the border. If you have a tinted specular and want to add an extra coating on top, use an extra layer on top.
For Anisotropy, Specular Fallof and Falloff at Glancing angle to have effect, the Roughness Angle needs to be bigger than 0.
Anisotropy of 1 might introduce artefacts, try lowering it.
Why is there no map for specular scale? You might ask. In real life, that doesn’t exist. Either the material is there or it’s not. If there is material it reflects (has specular) at 100%. The effect of lower and higher specularity is either because of surface roughness (that can be mapped) or because the material or layer itself is transparent.
Udim’s are supported. Simply replace the Number with %d. The shader will replace this Code with 1001 for the first uv tile (u coordinate 0 to 1). 1002 for the second and so forth. This can be used in all map slots. Example: $HIP/udimtest/test.%d.rat, will be changed to $HIP/udimtest/test.1001.rat for the first tile. Currently only tiles in the u direction are supported.
The shader makes a lot of use of the alpha channel. Make sure if you save from photoshop, that you're saving with alpha channel and not transparency. If the maps alpha is not premultiplied (basically where alpha is 0 there’s still color), turn off the option in the shader.
To successfully export displacement and vector maps from Zbrush: Befor importing and sculpting set the “Preferences” → “Importexport” in both “import” and “export” options to:
eFlipX: off eFlipY: off eFlipZ: on
eSwitchYZ: on eFlipNormals: off
For black and white Displacement, under the Tool, choose:
Adaptiv: on (recommended) DPSubPix: 1 (should be enough)
SmoothUV: off Mid: 0.5 (same as Displace Offset in the shader)
FlipV: on Scale: at default
3 Channels: off 32Bit: on
Zbrush will export the displacement to mid grey (a grey value of 0.5, means no displacement). Be sure to have the same value in the PBR shader. Scale should be set to the value that Zbrush indicates, after it’s calculated the displacement maps. (in the top status bar)
Object Space Vector Displacement, in the Preferences → “importexport” set FlipAndSwitch: 11. And in the tool → Vector Displacement Map
vd Tangent: off vd 32Bit: on
vd SUV: on vd Snormals: on
Tangent Space Vector Displacement, in the Preferences → “importexport” set Tangent FlipAndSwitch: 11. And in the tool → Vector Displacement Map
vd Tangent: on vd 32Bit: on
vd SUV: on vd Snormals: on
Note Unfortunatly, to my knowledge the smooth algorithm is different in Zbrush and Mantra. Which makes the displacement slightly off. Especially for low res geometry. If you need perfect displacement, calculate the Displacement map inside Houdini.
Built in Extra Image Planes (AOVs)
There are Extra Image Planes that come standard with PBR. They are supported by the shader. They are explained here: PBR Deep Raster Exports
Additionally the shader writes to:
maskA, maskB, maskC and maskD Vector4 Type and 8 bit integer These Extra Image Planes will be used to write masks of individual parts or whole materials to. Just set Mask Nr on the shader to a unique number and the mask will be written to any of this Variables.
emission Vector Type, 16bit float minimum The part of the shader that’s emitting will be written to this Variable. Use “Add” in compositing.
Z Float Type, 32 bit float recommended The depth of the pixel being shaded. (distance from camera). Can be used for Depth of field or fog effects.
If you need to implement the same behavior into another shader, use:
Z = length(P – Eye);
U Float Type, 32 bit float recommended The u coordinate (uv space) of the object. If you have more then one uv set, only one can be exported. Define which one in the “Optimize” tab of the shader.
V Float Type, 32 bit float recommended see U
vel Vector Type, 16 bit float recommended The velocity vector, for use in compositing, to add motion blur.
In the Mantra Render node under Sampling, Allow Motion Blur needs to be checked on, but Allow Image Motion Blur needs to be disabled. If you need to implement the same behavior into another shader, use:
vector from = ptransform(“space:current”, “space:ndc”, P);
vector to = ptransform(“space:current”, “space:ndc”, getblurP(1.0));
vel = from - to;
vel.x *= res.x;
vel.y *= res.y;
normal Vector Type, 16 bit float recommended The normal vector XYZ written to the RGB values. Can be used for re-lighting in compositing.
position Vector Type, 32 bit float recommended The world position of the point being shaded. Can be used for re-lighting in compositing.
facing Float Type, 16 bit float recommended The “Normal dot View” value. A useful Image Plane to check the model / displacement / bump. Or to adjust the fresnel effect in compositing.
Point Cloud Cache (experimental)
PBR directly doesn’t support a feasible way to cache to point clouds. Because PBR doesn’t allow to shoot rays from any other point than the point that’s being shaded. The work around is to Cache in Raytrace Mode and use the Point Cloud in PBR. Unfortunatly, the speed gained is probably lost in setup time. Also, if not careful, it will cache more points than actually needed. If somebody wants to give it a try, here’s the setup:
First, a point cloud needs to be generated that contains the positions where you want to cache. This is not just the camera frustrum, but througout all the scene that contributes to the final image (anything visible in specular, diffuse..) Easiest way to do this, merge all geometry and use a scatter node to place points. Note that, points on a surface that’s subdivided on render time might need to be subdivided in Houdini before using scatter. (the shader will take care of displacement though)
Use an output node to write the point cloud to disk (ending with “.pc”). This will be the point positions that need to be cached.
Switch to Raytrace mode and add 6 user Properties to the Mantra Render Node.
Name of the Property Type Description
pccache Integer/Bool A switch to acess the different modes:
0: ignore PC. 1: calculate PC (if in raytrace mode) or use cache in PBR. 3: use cache on primary rays! (for debug).
scattermap String If in raytrace mode, points will be read from this map and cache will be calculated on the positions of these points. The cache then will be written to the pcirradmap pc file.
gisample Integer/Bool Number of gi samples to take on the cached points in raytrace mode (128 is a good value)
pcfilterpoints Integer/Bool PBR will filter this many points close by to approximate the incoming light. (5 is a good value)
pcradius Float The distance in world units that PBR will look for points.
pcirradmap String The Point cloud file that contains the actual irradiance cache data. Load this in Houdini to debug the result.
Set pccache to 1 and point scattermap to the point cloud you exported. Now, Mantra needs to raytrace to all points, to calculate the caching. For this to work, Mantra needs to actually “see” all of the points. Easiest way to accomplish this is to use a spherical camera and uncheck “Enable Hiding” in the Render tap. The actual quality of the render is not important, you can lower the image size and sampling. (it will use gisample value for quality of sampling) Because of the way Raytrace mode works, you’ll often need better quality on lights, so you might want to increase “Sampling Quality” on the lights. Render the frame. Now a Point Cloud you defined in “pcirrradmap” should have been created. Load it into Houdini to check the quality. To use this in PBR, switch to PBR and make sure pccache is set to 2. If you set it to 3, PBR will use the Point Cloud on primary rays (omitting all diffuse rays) and you can see the quality directly.