ZBrushCentral

Tutorial: Rendering 32-bit displacements in Renerman for Maya 1.1

Hi, All

I recently purchased Renderman for Maya, and have been trying it out with Zbrush generate displacements. Though, I’m still having some issues with getting pore level details to render, and an ocassional AUV seam plroblem. I think I’ve puzzled out a workflow that seem to work so far. Since I haven’t seen any posts on this “new” rendering option; I decide to post up my findings.

Creating Displacement Maps in Zbrush:
  1. Use the Multi Displacement 2 (MD2) plugin, it generates a 32-bit displacement maps that are exported with their scale baked into them, eliminating the need to record an alpha depth factor. Since RenderMan For Maya can render 32 bit floating point images very quickly, there is no reason to not use the plugin; especially since the 32 bit maps hold far more info than the 16 bit versions.

  2. Select the D32 option and enter the DE-LBEK-EAEAEA-D32 Quick Code. This is a 32-bit export options designed to work with Maya. Click Close.

    1. You may now switch to your original morph target and/or generate your mesh based on subdivision level 1.
  3. Click the Create All button in the MD2 menu and ZBrush will ask you for a destination folder and base file name, and automatically export the map based on these settings as it works.

    Rendering Displacement Maps in RfM:

  4. Import your low resolution mesh into Maya; go to File>Import and select OBJ for file type. Make sure that Create Multiple Objects is set to false on this screen. Always be aware of vertex order and the importance of maintaining it between applications.

    1. Witht the mesh selected, go to Modify>Convert>Polygons to Subdiv; to convert the mesh into a subdivision surface.

    2. With the mesh selected press Ctrl+A to open the attribute editor.

  5. Since RfM automatically tesselates subdiv and nurbs surfaces, so you do not have to uncheck feature displacement on the meshes shape node, you also do not have to make any adjustments to the shape nodes tessellation sample count simply leave it at its default value.

    1. Open Hypershade by going to Window>Rendering Editors>Hypershade.

    2. Create a Lambert material by dragging it to the workspace from the left side window.

  6. Middle-mouse-button drag a displacement node over it. Select Displacement Map from the connection editor window that appears.

    1. Double click the displacement node to open the attributes.

    2. Click the checker box (to the right of the Displacement entry box) and select the file from the popup window.

  7. In the file node we will add our displacement map. It should open automatically when you click the file button but if not double click the node in the hypergraph.

    1. Click the folder icon to the right of Image Name to browse to the displacement map.

    2. Open Color Balance on this screen and set Alpha Gain to 2.2 and Alpha Offset to -1.1.

  8. Go to Window>Rendering Editors>Render Globals to open your render globals window. If it is not already set, choose Renderman from the dropdown box.

    1. Click Render View to see the result.

    Trouble Shooting: From the Rfm Docs:

    While RenderMan displacements are both detailed and fast, there are a couple of issues that you should be familiar with. The most important concept is displacement bounds. Displacement bounds set up a bounding box around the object, for use when the object is rendered. The bounding box determines when the object is loaded by RenderMan. If a displacement shader pushes an object outside of its bounding box, you will see that part of the displacement is being clipped.

    The solution in this case is to increase the bounding box. If you need to adjust displacement bounds, simply add the RenderMan displacement attributes to the shader. You can do this by following these steps:

    1) Open the displacement shader in the Attribute Editor.

    2) From the Attribute Editor Menu: Attributes-> RenderMan-> Add Displacement Attrs

    Now that you’ve added displacement attributes they will appear at the bottom of the shader under the Extra RenderMan Attributes tab. Open this tab and adjust the Displacement Bounds attribute. The correct setting will vary depending on the size of your object in world space. Generally, a good value to start with is the farthest distance an object may be displaced, as measured in default Maya units, and adjust from there. Note that too large of a displacement bound can cause an object to consume more memory than needed, so the tightest displacement bound possible is recommended.

    Test Renders:



Note:

If anyone has any corrections or additons feel free to post them!

hi;

how did you load a 32 bit channel in maya???
i get this info in Output Window:
ERROR, D:/temp/new1001-D32.tif: TIFF image class not supported (must be 8 or 16 bits)

and a lot of warning data in the script editor:

============================================================================
AEassignTextureCB file1.fileTextureName “D:/temp/new1001-D32.tif” “image”;
// Error: Image conversion (to IFF) failed //
// Result: 1 //
// Error: Image conversion (to IFF) failed //
// Warning: Failed to open texture file D:/temp/new1001-D32.tif //
// Error: Image conversion (to IFF) failed //
// Warning: Failed to open texture file D:/temp/new1001-D32.tif //
// Error: Image conversion (to IFF) failed //
// Warning: Failed to open texture file D:/temp/new1001-D32.tif //
// Error: Image conversion (to IFF) failed //
// Warning: Failed to open texture file D:/temp/new1001-D32.tif //

thank’s

You can just ignore that error message. Maya does not natively support 32-bit images. So, Maya will not render them with the Maya software renderer, and you won’t see the actual map is hypershade. But the map will load. As long as you have Renderman selected within render globals it should render; because the plugin is what actually reads the 32-bit file.

Edit: Added a .pdf with a more detailed tutorial on displacement and subsurface scattering in Renderman for Maya.

Okay, here are some of my tests using the original Pixolator head. It uses a 16-bit map generated from the tool palette. With the this mesh I ended up using an alpha gain of 10 times the Zbrush alpha depth factor. so, if you want to try it out use a value of 8.34, not 0.834 for the AG; and -4.17 for the Alpha Offset value.

You can find the mesh and displacement map here:

http://www.zbrushcentral.com/zbc/showthread.php?t=20310&highlight=displacement+rendering

I have to say that I am very pleased with the ease and speed of this new rendering plug-in. Pixar really out did themselves with the level of integration it has with Maya.

Hi,

As rachid, i have the same mistake loading the 32 bits maps.
I understand that rfm support 32 bits, but i cannot render the file using renderman renderer.

Any help please ?

thx

no progress!!! can’t render a 32 bits chanel in rfm 1.1…so what’s the problem!!!
can you send me your scene file with that 32 bits channel, i’am using Maya 7.01 and rfm 1.1
thank’s

hi
now i can render the 32 bits channel with rfm 1.1 thank a lot!
i have one question
when u render a tif.32 bit channel with mentalray u convert it to .map file with imf_display utility, but the result with that converted file is not a 32 bit channel it’s a 8 bit channel!!!
thank’s

Hi ,

What did you do to render a tif 32 bits ?

Can you send me too, an exemple.

thanks.

Hi, Guys

Looping - I’m sorry I can’t post the file its over 8 MB’s. Did you follow the pdf, it’s pretty explicit. Tell me what specific step is giving you problems.

Rachid - Yeah, MR map files aren’t supported in Rfm; so you would need to generate a new displacement map in ZB. If you look in the bin file for Rfm you will find a .tex utility that converts .tiff files to Renderman’s native format. Its not something that you have to do, as Rfm complies your shaders any way. But you can bake out you .tiff files as adjusted .tex files. So, now you have a displacement map that has its zero displacement point adjusted to Maya’s format. If you do that you won’t have to worry about alpha depth factors anymore.

By the way you should start a new project and scene if you getting errors. I’ve noticed that the compiler sometimes hangs in the rendering stage. When you quit Maya and reopen the file, you have corrupted renderman shaders that don’t always work very well.

Okay I’ve moved on from displacment mapping in RfM; I’ve got a system that works well for my needs.

Anyway, I’ve moved on to rendering normal maps in RfM. For though interested you can find a ready made shader and detailed instructions here:

http://www.drone.org/tutorials/rayDisplace_renderman.html

Hopefully I’ll have something worthwile to post tomorrow, from my experiments.

Edit: I’ve given up on normal mapping in RfM, it makes sense to use them in Mental Ray or the Maya Software renderer; but renderman is so fast and accurate with displacement that there was no reason to use additional maps.

ok. so much thanks for your post!:+1:

Yes,

It works…
If i build manually the shader tree it works. (perhaps a maya problem)

Thanks enigma for your help.

i have one question.

when i rendered with RfM , i found problem AUV Tiles Boder appear to renderd output.

i tried to changed MD2 boder into 1 value, but still have same result.
how can i solve this problem ?

hope to reply from u soon.

thanks a lot.:wink:

Attachments

boder.jpg

hi,
thank for help enigma!
in general, the procedure to make displacement map in ZB is:
import the model,do a morph target, subidivise, sclupt and generate a displacement at lower level than export both map and the low resolution model!!!
once in maya
if the render is rfm the model imported must be converted to subiv
if the render is mray make Subdivision Approx in Approximation Editor
and uncheck Feauture displacement in Displacement map (ctrl+a)
and for Alpha Gain and Alpha Offset
(file.alphaOffset = -file.alphaGain /2;)

at this point all work fine!
but what if i have already a smothed head model (14872 faces) textured and rigged for facial animation with complex combined blendshapes and expression ??? and i want just to add a 32 bit displacement map and render with rfm?
do i convert my smothed model to subdiv??? of cource i can’t!!!

i’am not sure if what i did is true at 100%, but…

i think i don’t need to reimport my model,i’ve one rigged in maya!!!
so i’ve imported just that 32 bit map and applied to my existing model, also i’ve pluged normal map to the bump slot!! ( normally outColor of normal maps is connected to the normal camera of shader,but how use it with rfm that is a question?!!! )

thank’s again

Hi, Guys

I’m glad that I could help!

Rachid - Your in luck their is an easy way to do this!

  1. Select the polygon mesh, and hit ctrl+A to open you attribute editor.
  2. Go to attribute > renderman > subdiv scheme

  1. This adds an extra attribute that lets you decide to type of subdivision algorithm is used.

  1. Make sure that your displacement map is assigned and that you have correctly entered your Alpha settings.

  2. Render!

The important thing here is that you don’t have to convert you polymesh to a subD surface for renderman to slice the mesh up into micro-polygons for displacement. As a side note you could always add a rendermans subDiv attribute, rather than converting your polygon mesh to Maya. I tend to use subdiv conversion, as it eliminates the chances of non-quad and non-manifold geometry causing problem at render time. But other than that, I’ve tested the methods to be equally fast.

PS. If you have any more questions, or problems I’d be happy to help.

Hi, Grayscaledepth

Ha! I know exactly what your problem is its your UV’s!

Do this
:

  1. Go back to Zbrush and load your model, go to level 1.

  2. In the Texture pallet create a new texture, 2048X2048 or 4096X4096. The texture must be the same size that you will use for your displacement.

  3. Now go to Tool > texture. Make sure that AUVratio is set to 1. Click AUV, and then check your UV’s. If you see any cracks hit the fix UV button.

  4. Open up the MD2 Plugin. Set your map size to match the texture you generated in step 2. Set you border width to 8.

  5. Generate your displacement map.

  6. Plug this new map into your shader. Make sure tha filtering is turned off on the file node.

  7. Test render.


Notes:

The reason you generate the texture in step 2, is to tell Zbrush what resolution to generate your UV’s at. If your don’t specify the size, Zbrush defaults automatically to a 1024X1024 scale. If you then generate a 2048 or 4096 displacement map; your UV’s get resized causing breaks at the UV borders.

The steps above should help but there are almost always seams or artifacts; however minor. AUV make the problem more visible because every polygon edge has a seam. Using GUV tiles will reduce the problem some. But to be honest, you would probably be better off a different UV solution. Here’s a link to an excellent free UV pelting plugin for Maya.

http://forums.cgsociety.org/showthread.php?t=299454&highlight=pelting

With something like this there is only one seam and its location is chosen by you.

Good Luck!

very cool thing, now i can combine displacement and SSS shader in rfm!
thank a lot for help enigma

thanks for Enigma help.
i tried to remove cracks as your method, but i got those still.
now i try to pelt mapping.
i found somthing happy :lol:
thanks again!
you are my RfM’s farther.:slight_smile:

This is not strictly Zbrush related information but still useful.

At the begining of the thread their is a Detailed PDF on how to set up SSS; unfortunately its missing something very important…pictures of the effect! So, here follows a pictorial explanation for a few of the more important attribute settings.

Okay, first off here is an example of what you should see after initally applying the Subsurface Attribute to your material:

Note that the first image shows our default prism with no scattering effect, the second shows the same prism with the default SSS attribute applied to it. The third image shows it with the tint values adjusted. Finally, the last image shows the tinted prism with it Scattering Strength reduced by half.

  1. Scattering Strength it is the most important attribute by far forgetting good SSS. Here is a picture to give you an idea of how adjusting this attribute will effect your SSS.

Scattering strength has a range of values between 0-10. Zero effectively equals no SSS, while 10 is virtually guaranteed to blow out your image. I’ve found that that a strength on 0.3 - 0.9 works best for humanoid skin; and have never needed to go above 2.0 for even waxy or milk-like substances. The value you enter here is somewhat dependent on the size of the mesh in question, however.

  1. The second most important attribute for good SSS in RfM is the Scattering Free Path. This Attribute controls how far the illumination penetrates into the mesh before being reflected.

Okay, this attribute is even more dependent on the scale of your object than Scattering Strength. Notice that in the second image which has a free path distance of 0.1 the light is blowing out. This is because the distance is to short and the light is reflecting almost as soon as it strikes the mesh’s surface. Conversely in the last image the free path distance is to large; and the light is passing completely through the object before it can be reflected.

More to follow with a somewhat more interesting model, as an example.

Hi
I did everithing what was written with alpha gain and offset but I get this strange result, like it’s some kind of deformation hapenin on UV maping. See for yourself. Although hair looks fine this strange wrinkles on face and moulth are showing.

Attachments

head.jpg