Adverti horiz upsell
Faking ray-traced shadows with depth-map shadows i
Faking ray-traced shadows with depth-map shadows i
sdb1987, updated 2005-09-16 14:43:17 UTC 62,866 views  Rating:
(3 ratings)
Page 2 of 2

Here is a sample image at Dmap filter size constant value of 1 (as you get by default when U create a light)





This one at the max value of dmap filter size (here 50)
(note how blurred the shadow is even at the object's very location)






And the last one everybody expects: the soft shadow image (Oooooohhhh!!)



It works, isn't it!!?

It works perfectly well with few objects to cast shadows. But when your scene gets more complicated, you'll may have to create exclusives lights. You noticed that shadow was fading away as the distance from the object increase, its because shadow color is fed by 3 curves (R/G/B) also driven by sample distance.

---

For easier control, I have created 3 locators. One constrained at the light source (light_from), the second (light_to) located at the object, and the third (dmapFilter_max) at the distance you want your shadows to be at the 'blur' max value.

Then create a distanceBetween node (type in script editor: createNode distanceBetween) (Thanks Daniel...), then connect the 'light_fromShape.center' locator in distanceBetween1.Point1, 'light_toShape.center' to distanceBetween1.Point2. The result is the distance from 'light_from' to 'light_to'.

A second distanceBetween (distanceBetween2) is used to calculate the distance where shadow is as blurred as you wanted.

And I have added 2 extra-attributes to the curve node: 'Light2obj' (fed with the distanceBetween1.distance, and 'Obj2dmap_max' which is controlled by the expression AnimCurveName.Obj2dmap_max = distanceBetween1.distance + distanceBetween2.distance).

So you can easily see the values you have to enter to get soft shadows



Here was the trick. I'm sure there's a thousand differents ways to get the same effect, but as far as I'm concerned, I hope you all have understood how to do the same for your scenes. You can download the scene I created for that tutorial tut_dmap.mb (58k)

If you have any comments, critics, or improvments, I'll be glad to read you at pixho@pixho.com