Showing posts with label ambient occlusion. Show all posts
Showing posts with label ambient occlusion. Show all posts

Saturday, March 28, 2009

A quick way to add ray-traced occlusion in 3Delight for Maya

Here I'll share one of the ways to add ray-traced ambient occlusion in Maya with 3Dfm 4.0. The occlusion shader is added using a mental ray node called Mib_amb_occlusion.


First I create a default Maya torus with blinn material, and render it with shadow but no occlusion.





Now the occlusion step:

  • In hypershade, create a mental ray texture node called Mib_amb_occlusion. Then multiply it with the current shader(blinn1) and connect the output to a new surface shader's outColor attribute (you may need to open connection editor to connect the attribute). Assign the surface shader to the torus.




  • Select the torus, and in the 3Delight Shader Assignment Panel,create a delightGeoAttribute for the torus.




  • In attribute editor, add "visibility-> Diffuse Rays (occlusion)" attribute and set it to "opague". You may also add "Geometry->Polygons->Poly as subd" attribute to convert the poly torus to subd.




  • Now render it. Horaay, we got occlusion here, but it's pretty noisy, because the sample rate is too low ( 16 ).



  • To increase the sample rate, select the Mib_amb_occlusion node and go to attribute editor. Give "Samples" attribute a higher value. In this test scene I used 512.
  • Render it again. The occlusion now is much smoother.



(Now the optional part).
  • To output the occlusion (or other component) as a separate pass, you need to add a render pass. To do this, in the 3Delight menu, select "Add render pass".
  • In the attribute editor, expand the secondary displays tab, and check "Render Secondary Displays".
  • Then press Add, and create the pass you need. Basically there are 3 attributes you need to pay attention for each pass :"Image Filename"(file output path),"Display Driver"(file type), and"Display AOV"(the shading component,i.e. diffuse,specular,occlusion).


  • After the AOVs are created, press the render button in the attribute editor of selected render pass.


  • In addition to output in I-Display (assume you use it for the primary display), you'll get the AOV files. In this example, I got diffuse, specular, and occlusion passes.



That's it. Hope that this tutorial is helpful for you. If you find any technical error(s) in my explanation, I'll be grateful if you notice me in the comment box or send me an email : r4inm4ker at gmail dot com.