View Full Version : How can I make soft edge shadows using raytrace shadows?

04 April 2002, 06:13 PM
I like that with "shadow map" shadows you can have a soft edge. Unfortunately when my lights are very far from meshes the shadow that they cast tends to be inaccurate.

I was told rather to use "raytrace shadowng" to fix this problem (which it does). While solving the above problem i've run into a problem with raytrace shadowing. The edges are way to hard and I need to know how to soften them up.

I know with "shadow maps" you can use your "samples" to adjust this but this option is not available with raytrace shadows!

What other methods can I go about making soft shadows without making ten million lights from 1 point?

04 April 2002, 06:30 PM
well i suggest you forget raytrace shadows unless you are willing to wait a lifetime for the render ....there is a way ..simply increase the shadow map resolution to a very high level it usually comes around 536 if i'm not mistaken ..increase that to 1600 and above
and bring the bias down to 0 leave the samples to default value .if you still don't get the shadow accurate enough just keep on increasing the map resolution ..:thumbsup:

04 April 2002, 07:10 PM
I messed around a little with it and found that the larger the map becomes the slower the render in any case:( I just hoped that with Max4 there wouldn't be this problem anymore but...................... O well. Maybe next version eh?:)

04 April 2002, 11:41 PM
yeah well its still much faster than raytraced shadows ..alright goodluck...

04 April 2002, 12:18 AM
And using Raytrace softshadows is really slow compared with other methods 8)

04 April 2002, 01:57 AM
A little explanation about shadow maps:

A shadow map is like a texture map, but not filled with color but with (32-bit) values that tell the light how far to shine before it reaches the first object. When you start your render and you see 'preparing lights', that's when the renderer is calculating how far it can shine at every point of the shadow map.

So if you wat to increase your precision, then you can make your map larger (increase the size), or make the area your light shines smaller.

So step one is to increase the size of the shadow map to like 1600 pixels.

Step two is making your light shine only where it needs too: setting the fallof of the light so that it shines only at the stuff that's on screen. If your light has a falloff of 180 degrees, then the shadow map is smeared out over that area, resulting in blurry shadows. (That's why I try to avoid shadow casting omni lights, they wast way to much shadow maps space, because the map is use all around the light, if you understand what I mean.)

You can also check the 'overshoot' value, then the light acts as an omni, but the shadow map will only be used in the area defined by the falloff.

So even if your light is very far away (is that really necesary?) you can focus your shadows on your object by making the falloff angle as small as possible, and using the overshoot option.

Then there is the bias parameter, this tells how for from the object the shadow appears. You ever had a little box who's shadow appeared 2 cm too far away? Decrease the bias to 0.1 and your problems are solved.
Setting Bias to a very low setting can cause problems when animating though, like objects casting shadows on their own surfaces when they don't need to (a sphere can cast shadows on its own surface for example). So if you see flickering shadows during your animation, try increasing your bias.

The last parameter is the sample range, very important!
If you think of the shadow map like a bitmap again, then this is the parameter that tells the renderer how much that bitmap should be blurred. If you have a shadow map that has a size of 256 pixels, then setting the blur to 26 will cause a blur of about 10 percent of the width of the shadow map.
Sample range and shadow map size are related to eachother, but if you think of the shadow map as an image that it's all pretty easy.
(btw, just like an image, your shadow map increases quadraticly in size, so if your shadow map is set to a size of 256, it uses about 262 Kb, but when you set it to 4096, it uses 64MB.)

In most animated movies only shadow maps are used. The reason for that is that Soft Raytraced shadows take way too long to render, and normal raytraced shadows look like shit. (For most scenes that is, maybe not for space scenes)
So don't be sad that you are stuck with shadow maps, basicly everyone is :)

And now it's time for a great tip: :bounce: Shadow only lights! :bounce:

These can be very usefull for making localized shadows were needed.

Set your spotlights multiplier to 0
Set the shadow color to white
Set the density to -1 (or another negative number to have stronger or softer shadows)

Now your light doesn't cast light, but it does cast a shadow!

Hey! Your question got me through a long render, thank you!


Marcel Vijfwinkel

I have much more renders to make and time to spend, so don't hesitate about asking questions...

04 April 2002, 02:03 AM
Another strange thing with RAYTRACED shadows it that the further you place the light away from the object, the longer it takes to render. (And this can be a dramatic distance, I had render times going from 3 min to half an hour in some cases).

If you want a light that seems to be coming from really far away, use a target direct light instead of a spotlight (or omni)
That type of light has parallel rays, just like the sun, but you can place it near to your objects.

So that's another reason to place your lights as closely to your objects as possible (if you can that is ofcourse).


04 April 2002, 04:39 AM
Hey Marcel,
That's a good, easy to understand way of putting it. You should write a little tutorial for newbies because it's the kind of thing that sounds so simple/understandable when you put it like you did.


04 April 2002, 12:14 PM
Thanks guys for all the replies and help. Thanks Marcel. I've used target direct but ignorantly still placed it at the same distance DUH:)! Never thought of putting it closer:)

My problem is I always use omni's thinking that that in real life every light is basically omni, just some have lamp covers etc.... causing the spotlight effect. I always preferred to make an omni and the lamp cover and simulate a spotlight not realising that the omni was having to calculate shadows for the entire world space?

Thanks man for making me realise that. I will try messing around with target direct!

04 April 2002, 02:40 PM
To be honest I never use any omni's anymore, only in really rare situations. I find that spotlights give me much better control over the lighting then omni. It's easier to place highlight and control shadows, falloff, etc. I like Final Renders cylindrical lights too!


CGTalk Moderation
01 January 2006, 06:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.