ZBrushCentral

Using Matcaps in Maya with shadows

Hi

I’m not sure if this was posted on here or not but I didn’t see anything about a method like this. I’ve only been using ZB for a few weeks ( so don’t laugh at my model :wink: ) but figured I’d contribute this for those who’d like to know. This is one level stepped down from my high res model, appx 900,000 faces.

I am doing this in Maya 2009 on Mac OS X but it should work in any version/platform of maya that the shaders are compatible with. This doesn’t use displacement, bump or normal but I can show how to add those as well in another post if anyone wants to know.

Here is what you will need:

  1. a model (I know, obvious)

  2. MinMatcap Shader Download

  3. P_Shadow Shader Download

  4. Mix20layer Shader Download

Basically import your model into maya and assign a Mix20Layer (Mix8Layer will work too if you have that instead).
Next you are going to click the checkbox next to “base.color” and create a MinMatcap. Alternatively you can create MinMatcap thorugh hypershade (it’s in the MR materials) and middle mouse drag it to the base.color. Click the checkerbox next to the “Matcap Sample” file path which will create an MR Texture node, and then click the folder icon in the MR Texture next to “Image Name:” and choose a matcap image. This can be your own image, but for this I just used the zbrush red clay sample that came with the shader.

Next, back in your Mix20Layer, under “layer.1” section you will make sure “Enable” is checked on, blending mode is set to “multiply”, “o.factor” (this is opacity) is set to .6 and then click the checkerbox next to “color.1” and create a p_shadow shader. There is barely anything in the shader, just make sure “Self Shadow” is checked on or you will get gaps in the shadow, and Mode should be set to 0. Modes 1 and 2 just relate to light linking I believe.

Next, open render globals and make sure mental ray is the renderer. In the common tab go to the very bottom and disable default light. You can also up your sampling and lower contrast threshold in quality tab if you want a better render.

If you render now, your image is going to look dark because we have no light and the p_shadow is basically adding 60% black on top of your matcap. If you want to see what the matcap looks like, just assign the MinMatcap directly to your object and render, it doesn’t needs any light. If you do this, remember to apply the Mix20Layer back to it.

For the final step, create a simple spot light, and turn OFF “emit diffuse” and “emit specular”. Position your light where you would like the shadows to be, making sure the cone is larger than your object and the penumbra encompasses it. Turn on quadratic for decay rate if you want more accurate falloff. Hit “7” on your keyboard in perspective view so you can see the light and crank up the intensity until it’s enough without blowing out the model. Mine is at 9090.900. Truthfully, I don’t think it will matter since we are dealing with shadows only, but it might be good if you decide to use this light in future renders it will be setup already.

Next, open up the shadow portion of your light, turn on “raytrace shadows” and set the “angle” to 20 and the 'shadow rays" wherever you like. the more rays you use, the softer the shadow will look and the longer it will take to render. Mine is at 10. I use raytrace, you can use depthmap if you like. p_shadows should catch both if I remember correctly. I just like the look of raytrace better.

Now you should be good to go. Hit render and you will have a Zbrush-like matcap with shadows. See attachments for each step and render tests.

Hope this helps someone.

D

Attachments

ZBrush_matcap.jpg

Mix20Layer.jpg

minMatcap.jpg

MR_texture.jpg

p_shdow.jpg

spotlight_lookThroughSelected.jpg

Spotlight_settings.jpg

Maya_matcap.jpg

Maya_matcap_with_shadow.jpg

matcap_slimy.jpg

Maya_matcap_shading_network.jpg

I just noticed this forum doesn’t show file name’s so here’s a list from left to right, top to bottom of what each file is.

  1. Zbrush example
  2. Mix20Layer attributes
  3. MinMatcap Attributes
  4. MR Texture Node
  5. P_shadow attributes
  6. Light position (looking through selected)
  7. Light Settings
  8. MinMatcap Render
  9. Mix20Layer Render
  10. Alternate Matcap “Slimy”
  11. Maya Shader Network

Okay so I know if anyone bothers reading this (and doing this) you may notice that p_shadows, just like maya’s use background shader, doesn’t give the cleanest look to the shadows and sometimes you will get very hard edges even when the shadow angle is high on your light.

For those who don’t mind typing a short line of MEL code, here is a very similar way to do this with much cleaner shadows and occlusion by using one of mental ray’s hidden production shaders. It’s not perfect, but neither is a matcap approach :wink:

Steps:

Click in the command line input (the bottom left text field in the maya UI) and type the following MEL code:

createNode mip_matteshadow;

Now you can select the matteshadow node in hypershade to edit the attributes in the Attribute editor. Set the following attributes:

Background: Pure White
Catch Shadows: Check On
Shadows: Black
Ambient: Pure White
No Self Shadow: Uncheck
Use Dot NI: Check On
Ao On: Check On

All the rest should be on by default.

Now, if you select the Mix20Layer that we created in the first tutorial and middle mouse drag the mip_matteshadow1 shader to the color.1 channel it won’t work. To get around this, go to hypershade, select your Mix20Layer and shift select the matteshadow node and graph both networks. Left click on the output (little black outlined triangle on bottom right of node) in mip_matteshadow1 and choose “result > result” and then left click on the Mix20Layer input (little solid black triangle on bottom left of node) and choose f_colorLayer_1.

You’ll want to set the o.factor to 1 because this shader is lighter than the p_shadow. You should also delete the p_shadow shader OR delete the connection from it’s out alpha value which won’t be disconnected automatically.

Hit Render and you’ll have your shadows.

For darker shadows you can use negative values in the shadow color of the matteshadow or enable another layer in Mix20Layer and attach it the same way and use multiply overlay mode. If you use multiple layers, you must set the n.layers value on top of Mix20Layer to an integer that matches the number of layers (excluding the base). If not, the new layers won’t render. So if you add an additional layer, make n.layers 2.

For more detail you can up the samples of the AO in the matteshadow and adjust the Ao distance and increase the shadow rays in the light.

Keep in mind that light settings are scale dependent. So light angle will differ from scene to scene.

Attachments

mip_matteshadow1_attributes.jpg

mip_output.jpg

mix20_input.jpg

mix20layer_attributes.jpg

mix20_with_mip.jpg

For those of you who want a quick a dirty solution because you like the matcap look as a base but want clean shadows and possibly more light effects… here goes.

Create a lambert, mia material, blinn, or whatevr you like. I’m keeping reflection off for mine.

in the color channel of the shader, click the checkerbox and choose the MinMatcap and add the matcap sample to the MR texture as mentioned in the first post. Apply the base shader to your object with diffuse value set to 1 to ensure matcap color is 100%, make sure emit spec and diffuse are ON in the light, and render. Viola. You have matcap as a surface but the shadows work as they will with any regular shader.

To make it a bit brighter (at least with my original setup), turn on final gather, set accuracy to 50, point density to .1 and create an IBL. turn off primary visibility for the IBL, set the type to texture, and the texture channel to gray (V to .5 in the color palette).

Attached images are the lambert, then lambert with FG/IBL, then mia_material with FG/IBL.

Attachments

lambert_matcap.jpg

lambert_matcap_FG.jpg

mia_matcap.jpg