Wednesday, August 14, 2013

Rendering Maya plants in Mentalray

                             In this post I'm going to show you how to render plants in mentalray using mental ray materials. Also you can use this method for trees as well as grasses.
                             First create some plants and change render settings to mentalray. Then convert them to polygons(Modify->Convert->Paint Effects to Polygons). Go to hypershade. Now you can see two new phong materials created with textures. One for the leaves and the other one for branches. Go to its input and output connections. Create a mia_material_x, gammaCorrect, reverse and a luminance node. Now make the following connections using drag and drop with middle mouse button(We use gammaCorrect for reduce gamma if we enable mentalray physical sun and sky).
  • texture(can be a ramp texture) and gammaCorrect:- outColor to value.
  • gammaCorrect and mia_material_x:- outValue to diffuse.
  • file node and reverse:- outTransparency to input(You have to enable Show Hidden for both left and right sides in the connection editor).

  • reverse and luminance:-output to value.
  • luminance and mia_material_x:- outvalue to cutout opacity.
                             Assign the mia material to leaves and delete the unused materials(phong, multiplydivide etc). For the branches don't use reverse and luminance because it doesn't have any transparency. Only leaves texture has the transparency.

                               Now you can render the plants in mental ray but you have to make some modifications to these nodes to make plants realistic. Let's begin with gamma node. Lower the Gamma to something like 0.4.

                                Then go to attributes of the mia material. Increase the roughness little bit. Expand the reflection section. Increase the reflectivity(1.000). Decrease the glossiness(0.15).  It is better to increase reflection.

                                Expand the advanced reflection section. Turn off Skip Reflection On Side(for leaves only). Increase the transparency little bit under refraction section if you are using translucency. Expand the advanced refraction. Turn on Thin Walled(for leaves only).

                                 Expand the BRDF. Decrease the both 0 degree reflection and the 90 degree reflection. Turn on ambient occlusion. You can increase samples and the distance for better results.  

                                You can add your own texture map or color for the translucency or the same file texture with multipledivide(multiply by 4) node. Translucency weight depends on your plant type. Make sure to set up the color offset to dark green of the texture file(for better translucency).

                               Use production setting with final gather enabled for the mentalray. Render your scene.

No comments:

Post a Comment