Maya Raytrace shadow fix

An old tutorial repost.

Here is an “updated” temporary solution for Maya 4 if you are trying to raytrace a scene that has file textures with transparency, casting shadows.
Future versions of Maya should solve this problem.

As you know, you can obtain shadows from textures with a transparency channel only in raytrace mode.

The issue is that, if you are using Blinns or Lamberts, Maya will not read the objects, on which these shaders and textures are applied,
as completely transparent when casting the raytraced shadow.


Basic Lambert shader with a file texture and alpha applied.


Raytrace rendering, with raytraced shadows, of a textured plane.
Notice the edges of the plane in the shadow.

A solution can be found nesting a Surface Shader into another one, using a BlendColors node.


Shader network that removes the plane edges in the casted shadow.

Reading key:
(I will consider surfaceShader2 the nested one, and surfaceShader1 the one applied to the object casting shadows)

blendColors.output into surfaceShader1.outColor
file.outAlpha into surfaceShader1.outTransparencyR
file.outAlpha into surfaceShader1.outTransparencyG
file.outAlpha into surfaceShader1.outTransparencyB

surfaceShader2.outTransparencyR into blendColors.blender
file.outColor into blendColors.color2
The blendColors.color1 has to be pure black.

file.outAlpha into surfaceShader2.outTransparencyR
file.outAlpha into surfaceShader2.outTransparencyG
file.outAlpha into surfaceShader2.outTransparencyB


Final rendering.

The nesting is necessary to force the main Surface Shader to accept a keyed color information, otherwise you would
get a black texture map in the rendering. Notice the brighter color texture map as well.

The network shown assumes that your texture map has an alpha channel with black information on white background.


Color map.


Alpha channel.

enjoy!

Share: