Anyone have any good ideas on how to render shadows to texture in Maya?
I only want the shadows and not the actual light/dark shading from the surface angle compared to the light.
I've been messing around with Ray Traced shadows and the Batch Bake(mental ray) feature, but it's hard to separate the shadows from the rest of the shading. Only crude workaround I found was setting all the vertex normals for the object to point towards the shadow casting light. That way all surfaces would get the same full amount of lighting and will I still catch the shadow in a bake with the Light Only setting in the Batch Bake. Feels very dodgy, but I can't come up with anything better at the moment.
I know how to mask shadows for offline renders with the Use Background shader, but how do you transfer that to textures? T_T
Any suggestions would be appreciated. Thanks.
Replies
EDIT: use background shader no spec, no reflection will get you the shadows in the alpha but still probably not 100% of that you want since its only cast shadows now apparently self shadows. at least not in my quick tests
Thanks for giving it a go. Since I want to bake this to texture I couldn't find a way to utilize the Use Background? It doesn't seem to work in conjunction with the Batch Bake (Mental Ray).
I'm going to play around with this a bit later today since I've got some spare time to invest in learning new stuff this friday, wooo!
Create a new render layer, add all your lights and geo to it.
Right click the layer and choose attributes.
Left hold click presets and choose shadow.
Batch bake mental ray with bake shadows and light and colour as the color mode.
It should generate a lightmap with only the shadow information stored in the alpha channel, there shouldn't be any shading from the actual light source just a shadow mask.
maybe dissecting these two old convert to file scripts might give you some ideas?
Download copyConvertSolidTx.mel and performConvertSolidTx.mel
( not sure if they still work )
old school:
The original Gamasutra article circa 2001:
http://www.gamasutra.com/view/feature/3105/using_mayas_convert_to_file_.php
Have you tried the background shader? that will give you a render with a shadow in the alpha. And then baking that alpha onto yer object? Not sure if doing so with alpha is possible? In which case, I would try moving the alpha to one of the color channels manually? ( might need to turn off primary visibility on object u do not want contributing to the alpha )
Do u know chow to use the background shader fer shadow passes?
( http://mayazest.blogspot.com/2011/04/casting-shadows-from-physical-sun-on.html )
Seems to work just fine.
The downside is that they are treated as pointlights only.
Afaik the Use Background cannot be baked to texture with Batch Bake(Mental Ray)? Or am I missing something? Any other way to bake results of Use Background shader?
I ended up baking with Toon shader which worked out pretty nice. Going to give render layers and also the ambient light way a go as well I think.