2/21/12

Occlusion of alpha mapped objects

                     Getting occlusion with Maya is very easy. We have to do is simply set render layers and applying the occlusion pre-set. After we have to tweak the quality, spread and maximum distance etc. By pressing the render button we will get a nice occlusion output. If you don’t know the procedures just go through my previous tutorial about Render Pass in Maya
                          But the problem arises when we have some alpha mapped object such as trees. The problem is that the final output lacks
the transparency information of the alpha texture. Simply applying the alpha texture to the surface shader’s transparency slot won’t solve the problem. There is a simple work around there.
Here we start,
  • Create a simple scene containing two different trees from visor and a plane.
  • (I used oakHeavy(reduced its quality via mesh quality attributes) and sumacHeavy trees from visor).
  • Convert them to poly by modify>convert>paint effects to polygons.
Now the renders look like this.
occlussionocclussion
  • Now select the all objects and create a render layer. Rename it to occlusion and apply occlusion pre-set. Increase the quality to 64 and max distance to 2.
occlussionocclussion
  • Render the occlusion layer.
                             It is clear that Maya skipped the alpha map during the occlusion render.So we have to tell Maya that we need the alpha map information during the occlusion rendering.In order to do so we need to create some shader nodes.
  • Right click on occlusion layer and do overrides>remove material override.
clip_image002[13]
  • Go to hypershade and create a layered shader and rename it to occlusion_pre_1.
  • Assign the surfaceshader_1 to the Layered shader and remove the default material present in Layered shader.
clip_image004[33]
  • Now assign the file texture of oakleafheavy to the transparency slot of our occlusion_pre_1 and change the layered shader to layered texture.
clip_image006
  • Assign the occlusion_pre_1 to the Oakleaf.
  • Do the same step for the next leaf.
  • Finally assign the surfaceshader_1 to the rest of the objects.
clip_image008
And do the render. Now our final output looks like this.
final
final_alpha

Same way you can get luminance depth/reflection pass with transparency.

No comments: