If you have used “Shadows Only” material option, you probably have noticed how hard it is to get it rendered properly. That setting makes material to render only shadows, rest of the surface becoming transparent. This can be especially useful when compositing 3D-graphics over images.
Unfortunately, it wasn’t previously working quite well under certain circumstances:
- Shadows were very faint unless lamp distance was set near infinity.
- Lamp “Energy” value was ignored.
- “Add” type Ambient Occlusion was calculated incorrectly when AO “Factor” was other than 1.0. (Lower factor made shadows fade off and higher factor made them stronger.)
- Same with Environment Lightning. Changing “Energy” from 1.0 didn’t work as expected.
So I implemented an alternative method, that can be chosen from a drop menu below “Shadows Only” option in materials panel.
Currently there are 3 shading types:
- Shadow and Distance: The old method.
- Shadow Only: New and improved method.
- Shadow and Shading: An all new option that even renders dark / lightless areas as shadows.
Here are some comparisons between previous and new method. Renders where “SO” is disabled are also included to see how shadows “should” look like. (Click image to make it larger.)
However, even this new method isn’t perfect. Due to color correction and scalable dynamic range in general, it’s impossible to calculate specific alpha for shadows so that it would match rendered image perfectly. But as far as I can tell, these new methods work very well in most cases!