ZBrushCentral

Tutorial: Renderman displacement rendering with Zbursh3 - MD3 Tips& Tricks

I’ve spent the last few months trying to find the best settings to render high quality 32-bit Displacement maps from Zbrush3 MD3 with Renderman. Finally it seems I’ve nailed it, I found it so frustrating that there was so little written about this topic, I had to find out mostly everything myself, I hope by sharing this knowledge I ll save some time for other artists.

Renderman has such a great potential when it comes to rendering Displacements, but its also extremely difficult to set up to get a high quality precise renders without seams. So here is the list, this isnt a complete guide, more of an update/correction to the old Zbrush to Renderman guide, also check out Scott Spencer’s Zbrush to Maya pipeline for the maya import settings.

1) Tool: Displacement:SmoothUV, This is the single most important setting if you are using Rendertime SubD-s with Rfm, or using a Standalone Renderman renderer, as if this is not turned on the UV coordinates are not going to be interpolated as Renderman expects them. This will result in bad seam artifacts and generally a very poor representation of your hi-res model, as all the internal UV coordinates will be dislocated so basically everything will be moved off target. ( However if you wish to use basic Maya SubD-s with Rfm, then it Should NOT be turned on) (Smooth UV is a great addition to ZB3.1, this option wasnt working in Zbrush2 with MD2)

2) Tool: Displacement:Adaptive, Also highly important and must be turned on so your Displacements render precisely
adaptive-smooth2.gif

3) Tool:Geometry:Cage: Another important setting, I found I get the best results from using the Cage, instead of the level1 or even a morph target( don’t forget, if your character is already rigged you can always use this new geometry as a parallel blendshape)

4) Manual UVs: you must have high quality, relaxed, manually created UVs. I also use “Stretch to Square” option in Maya under Window/UVtexture Editor/Polygons/Layout UVs. This will maximize the space available, although this will distort proportions, but if you are painting your texture maps in Zbrush or any 3D paint package, it wont matter, and this will increase the practical resolution of your maps quite a bit.

Renderman is super sensitive to UV seams, so its generally a good idea to have as few seams as possible, and try to hide them at places that arent visible. And this is also a good reason why you should avoid any automatic mapping such as GUV or AUV tiles.

As although for still images AUV/GUV wont cause any problems, but UV seams MAY show up when animating with Motion-blur.

Another tip: If you are mapping some simpler objects you could try to make all borders straight/perpendicular, this will also help to eliminate visible seams.

5) Hi-res to Low res ratio: be reasonable, if you are pushing it too far you will get cracks along seams as well as a general stretching around the UV border areas. This also highly depends on the angles you are displacing, like if its a simple shape, you might be able to get away with more extreme displacement, but if you are displacing something complex like a character, in my tests I found a good ratio to be a 8000poly lowres to a 2 mil hi res. Again this really depends on the type of character you are doing, but this is something important to keep in mind, always do tests before you start rigging, and if you followed all the other rules, and still get seams, then you might want to render from a higher level that you were originally planning for.

6) MD3 settings from top down: 0,1001,4096(or what you want), 100, 0, 8. These are actually the defaults. The most important from these settings is the Border and the Texture size. I did a lot of tests with this as well, and Border 8 is the best value, anything less may result in visible seams, anything more may be too much. As for the texture size its always ‘the bigger the better’ you will get more accurate more artifact free as you use larger and larger maps.

7) Quick Code: DE-LBEK-EAEAEA-D32, This is still the best quick code for renderman, I did some tests with A.D factor set to Off or Auto, but this resulted in a lower quality displacement. Seamless didnt seem to do much, Smooth just generally blurred the whole map, leave these settings off.

8) Merge UVs in Maya, Zbrush3.1 unfortunaly has a bug and will export your UV’s all broken up into individual UV islands for each polygon. So when importing back to Maya, open up the UV texture Editor, and select all, and select Polygons/Merge UVs with a very low Distance Tolerance. See 4) why this may be neccesary.

PS: I seen people changing the Color Balance in Maya from 2.2/-1.1 to 1/-0.5 for ZB3.1, but for Renderman I still got best results with the original settings.

Although you can relax your UVs in a dedicated UV editing program, but I found this method of relaxing/evening out UVs in Zbrush better than the basic Maya Relax, this will help to eliminate artifacts such as spikes along UV seams:

  1. export your lowest level of your Ztool that has UVs
  2. in a new Ztool, Import it
  3. Turn on Tool: Geometry: SUV, then Divide it once or more ( the amount of relaxation will depend on this, if you divide it more than once, you will relax more, i found dividing it to level 3 and above to be a good value, of course it depends on what was your level 1)
  4. Go back to Level 1, then export it
  5. import it back into your original Ztool( make sure you use a morph target before you do this, as this new Level1 wont be identical to your old Level1)

Here is a screenshot of whats happening to the UV coordinates:
SUV2.gif

I left this tip separate from the main post, as this isnt part of the ‘core’ tips. Also if anyone else has any comments/corrections please feel free to add it. Also additional tutorials/tips are welcome:)

Extremely valuable advice! :+1:

Many thanks!:smiley:

Hey midnightgreen,

Thanks for posting this! I’ve been trying to figure out this puzzle myself for quite some time, although I just haven’t had the time to do any in depth trial and error.

The results from Mudbox or Cyslice’s 32 bit displacement maps in PRman are astoundingly accurate and easy to use, so I’ve been dying to see if Zbrush’s can compare, namely because of the extraction time involved. Zbrush’s displacement extraction is incredibly fast (but this might be a disadvantage to Zb).

Have you been able to compare these results with displacement maps extracted via raycasting, such as Mudbox? I’d love to have this area (32 bit displacement) a bit more documented by Pixologic.

Also, I noticed that you are having trouble with Zbrush exporting your UVs unwelded. The fix for this is to open up the Export menu inside the Tool Palette, and check the “Mrg” button, which merges uvs on export. Might also be beneficial to uncheck the Grp button

The fix for this is to open up the Export menu inside the Tool Palette, and check the “Mrg” button, which merges uvs on export

as i said this is where the ZB3 bug comes into play, it wont work, I already posted it in another thread.

I heard good things about Cyslice’s displacement, it was actually recommended to extract displacements for Renderman before Zb3.1 came along in this thread.

Ah, sorry about that. I didn’t know it was broken in 3.1, what an unfortunate bug. I haven’t used Cyslice personally, but a colleague of mine claims that its displacement extraction is even cleaner than Mudbox’s, which has already proven to work extremely well. With the added benefit of being able to extract on the renderfarm, it sounds like the best option available. Price, however, is another story :lol:

Yes I would like to see some comparisons, but to be honest I never used Mudbox, all I can say is that with Adaptive, SmoothUV and Cage turned on, you will get pretty damn close to what you see in Zbrush.

The screenshots I attached are from a Level2 2000poly to 2 Mil Hi-res displacement, with only a 2048x2048 map, and its in fact almost indistinguishable from the original.( bearing in mind that the screenshots are just from the head, and that had like only 500 polys, so its pretty damn impressive, how far you can push it with the right settings)

The only reason why I will go for a Level3 (8000 lowpoly) for the final render, is because that even though 2000 is accurate enough for fine details, it still has most of the UV seams showing up.

My only problem is that Dsubpix doesnt work with with Adaptive, there were some talks about this function to be implemented to be able to work in conjunction with Adaptive, but it seems it was never done after all. Maybe in the next revision of MD3 :slight_smile:

PS If you are loaded with RAM, then you can always ‘fake’ Dsubpix, just before creating the displacement maps, just subdivide your model once or twice more ( you will need a lot of RAM for that…) and then create the displacement maps. That will in effect have the same effect as if you would have used Dsubpix, but as i said you will need a lot of RAM for that.

Hi, thanks midnightgreen for all this very valuable info. Im trying to get 32bit map to render with RfM 2.0 but somehow it doesnt accept them. I can render nice disp. with 16 bit tiffs, but with 32bit I have had no luck so far. RfM basically just does nothing. I tried it with really simple maps and objects but still no luck. Is there anything special I have to pay attention to? Thanks in advance

Here is a Very short breakdown of my full Zbrush to Renderman pipeline,

  1. Activate ‘Cage’ then Export out the .OBJ
  2. Create Displacement map out of Zbrush as outlined in First post
  3. In Maya import it (look at Scott Spencer’s import settings, but basically just set “Create Multiple Objects” False, and Group to be ‘off’)
  4. Select the Object, enter attribute editor, and add Attributes/Renderman/Subdiv Scheme
  5. In Hypershade, create new material, click on the arrows to show the Input/Output connections, open up its ‘Shading Group’ in the Attribute Editor.
  6. Under ‘Displacement mat’ click on the Checker, Then select ‘File’
  7. Back in the Hypershade double click on the “File” node,
  8. Set Filter Type to “Off”, under Color Balance set Alpha gain to 2.2 and Alpha Offset to -1.1
  9. Finally under the “Image Name” select your .tif file. (at this point you may get an error message in the Output window saying that it must be 16 bits, but just ignore that, it applies to only the maya software renderer)
  10. Drop the Shading Group onto your object

Select Renderman for renderer and then hit Render… thats all there is to it, you dont need anything else, if you followed some other guide that may have been written for Mental ray in mind not Renderman and thats why it didnt work.

PS: When attaching the Subdiv Scheme, you could also set Render Stats/Double Sided - off, it should save some rendertime.

Hey midnightgreen. Thanks for those deailed instructions, not easy to find this sort of stuff. I got it working now (the 32bit ones) and rendering displacements in RfM is so mmmmhhh : ) yummy!

Thanks again!

Thank You midnightgreen for your instructions about displacments and renderman.
One little correction concerning point 8) Merge UVs in Maya
It´s not a zBrush 3.1 bug, you simply have to activate Mrg under Tool --> Export. By default it´s deactivated.

Thomas

3Dthomas: I have set this option on number of times and it was not always that it worked. Sometimes even if it was on, I had to merge them in Maya. In ZB2 it always worked, in ZB3.1 for some reason its a bit of a gamble. I just did a test and it worked, but then again I remember that last time it didnt, I even started a Thread about it, as I mentioned earlier.

But also I’m not saying that you should not set this on when exporting the Cage .OBJ, but its best to do a test when importing back to maya, just select a few verts and then click “select Shell” and if it doesnt select the whole thing then it didnt work, and you need to Merge them back together.

I thought I got it working, but when I retried it … : ( bad luck
I still get not get this 32bit thing going. I try to export it and than I have this 32bit RGB tif (correct? or rather grayscale?), which I load in Maya. But when I try to render it with RfM it says “conversion to iff failed”. Now when I paint a dummy map in Photoshop I can render it fine. When I open the displacement map from zbrush in Photoshop and save it under a different name it renders fine???
Me feels very very dumb
:o

One thing I have noted is that RfM got a map it doesn`t like, there is no use in trying to load another one, cause it will fail to render at all. When I assign a new map and restart maya, it renders the map fine.

buexe: i think you are dong something fundementally wrong… it should not convert it to .iff. you are only converting it to .iff if you are rendering with mental ray, Renderman creates shaders in the Renderman directory and they have a file extension of .SLO i think…

Are you Sure-sure you are not rendering it with mental ray? Try unloading the mayatomr.dll plugin in the plugin-manager just to make sure you are not using it accidentally.

buexe: I also had some problems to get the displacments get running. In my case I found the filename zBrush was using for the exported files (via DExporter) wasn´t accepted by renderman (for example “elefant_displ_32bit+renderman.tif”), and I also got some strange iff-conversion messages …
After simply renaming the file to “elefant_displ_32bit_renderman.tif” worked for me.

midnightgreen: I will observe the “merge-thing”. Till now it worked for me…

Ahhh, you guys are saints. After renaming the maps, they render directly : )
Now, here is a hint from me. If you have artifacts on displacements from raytrace shadows, add the trace dsiplacement attribute on the shape node.

And for those lazy people (like me) here is a MEL script that will create s displacement network on the currently selected object(s), you can put into a shelf or whatever you prefer. Here is what it does:

  1. adds the subdiv attr
  2. creates a displace node with a file texture
  3. sets alpha gain and offset to the correct values ( for 32bit maps)
 
 
if ( !`pluginInfo -q -loaded RenderMan_for_Maya`)
loadPlugin RenderMan_for_Maya;
 
$objs = `ls -sl -l `;
for ($o in $objs)
{
string $shapes[] = `listRelatives -s -pa`; 
$shape = $shapes[0];
 
// Add Subdivision attr
if( !`attributeExists "rman__torattr___subdivScheme" $shape` ) 
{
string $cmd = ("rman addAttr \"" + $shape + "\" \"rman__torattr___subdivScheme\"");
eval($cmd);
}
// Make it participate in Raytracing
setAttr ( $o +".visibleInReflections") 1;
setAttr ( $o +".visibleInRefractions") 1;
 
string $sgs[] = `listSets -type 1 -object $shape`; 
$sg = $sgs[0];
 
// Create file and place2D 
string $file = `shadingNode -asTexture file`;
string $uv = `shadingNode -asUtility place2dTexture`;
 
//Set values for 32 bit displacement files
setAttr ($file+".alphaGain") 2.2;
setAttr ($file+".alphaOffset") -1.1;
setAttr ($file+".filterType") 0;
 
connectAttr -f ($uv + ".coverage") ($file + ".coverage");
connectAttr -f ($uv + ".translateFrame") ($file + ".translateFrame");
connectAttr -f ($uv + ".rotateFrame") ($file + ".rotateFrame");
connectAttr -f ($uv + ".mirrorU") ($file + ".mirrorU");
connectAttr -f ($uv + ".mirrorV") ($file + ".mirrorV");
connectAttr -f ($uv + ".stagger") ($file + ".stagger");
connectAttr -f ($uv + ".wrapU") ($file + ".wrapU");
connectAttr -f ($uv + ".wrapV") ($file + ".wrapV");
connectAttr -f ($uv + ".repeatUV") ($file + ".repeatUV");
connectAttr -f ($uv + ".offset") ($file + ".offset");
connectAttr -f ($uv + ".rotateUV") ($file + ".rotateUV");
connectAttr -f ($uv + ".noiseUV") ($file + ".noiseUV");
connectAttr -f ($uv + ".vertexUvOne") ($file + ".vertexUvOne");
connectAttr -f ($uv + ".vertexUvTwo") ($file + ".vertexUvTwo");
connectAttr -f ($uv + ".vertexUvThree") ($file + ".vertexUvThree");
connectAttr -f ($uv + ".vertexCameraOne") ($file + ".vertexCameraOne");
connectAttr ($uv + ".outUV") ($file + ".uv");
connectAttr ($uv + ".outUvFilterSize") ($file + ".uvFilterSize");
 
// Create Displacement node
string $displace = `createNode displacementShader`;
 
// Connections
connectAttr -f ($file + ".outAlpha" ) ($displace + ".displacement");
connectAttr -f ($displace + ".displacement") ($sg +".displacementShader"); 
}
select -r $objs;
 

very cool!
Thank You for sharing your melskills!

Hi There, I’m trying to get rid of some nasty UV spikes. I was about to try your zbrush relax option. But I’m a little unsure of the final step.

When I re-import the relaxed mesh into level 1 of my original tool, exactly what should I do next?..

Should I switch to a stored morph of the original level 1 and then re-bake a displacement map?

If this is so, should I be using the relaxed level 1 obj as my mesh in maya or should I use the original level 1 Obj?

thanks in Advance.:+1:

  1. yes you should definitely switch back to your morph target before you do anything, doing so will change the geometry back to how it was before(otherwise the displacement map generated wont be correct) That will keep the geometry as it was but updates the UV’s to the new one. And yes you should use this new model with updated UV’s for both displacement generation and import to maya.

  2. also another trick I have found when it comes to eliminating spikes is to make sure that there are absolutely no UVs that are overlapping, you can find overlapping UVs by

a) UV Texture Editor/Layout UVs/optionbox/ - Separate: All Intersecting.

After pressing “Layout UVs”, if there are any extra unwanted UV islands that means that you did have some uverlapping UVs to begin with, and you need to fix that, and reimport into Zbrush.

b) Also make sure that there are no concave UV’s either, as those will become overlapping UVs when the model is SubD’d at rendertime.

Martin