Strange shadow behaviour in Blender

Hi!
I wonder if anyone else has observed the following weird behaviour:

I have created a sphere on top of a surface, added splotlights and checked that the sphere casts a nice dark shadow under itself.

If I flatten the sphere to a thin dish ("howering a bit above the surface), it still casts a proper shadow on the surface.

However, if I now move the dish closer to the surface the shadow becomes weaker and weaker the closer I get!

This problem causes things to seem to float above any surfaces that they are really very close to.

Any help is appreciated!
Thanks

Try increasing the value of the clip start (ClipSta). It usually clears up problems like this.

I would never have guessed that one!
Very counter-intuitive…
Any idea what is going on?

For any other readers: ClipSta is a property of the lights.

Many, many thanks for your help! :slight_smile:

Regards
Patrik[/b]

Well, when I started Blender nobody said there was going to be any math… :wink:

Clipstart defines the distance to the virtual plane where the calculation for shadows begins. 3 guesses what Clipend is for! Everything after ClipSta and before ClipEnd can cast a shadow from that lamp.

Why moving ClipSta away from the lamp can improve the shadows is a complete puzzle to me. Like I said, it’s a math thing.

Let’s hope someone who knows Blender’s internals sheds some light on this one!

the less distance between clip sta and clip end, the more precise the shadow buffer is.

Martin

Intrigued by all this I decided to test changing ShadowBufSize, and as it turns out improvments were easily seen all the way up to the maximum limit of 5120 (kB, I assume it means).
The improvment from the default low value to the maximum was massive!
(The larger buffer size gave much better defined shadows and cleaner and brighter non-shaded areas.)

Thanks all for your help!
Now on to trying to get those environment maps actually do domething…

The Buffer Size parameter is a resolution. That means the shadow buffer is a 5120 by 5120 greyscale image.

Martin

I always set ClipSta to 2.5 and all shadows look good. However, I don´t understand it either…

ClipSta should not be set to a ‘fixed’ value, it should be tuned on a case by case basys.- Same for ClipEnd.

ClipStrat must be maximum possible, clipEnd minimum.

Might I suggest reading the guide?

http://download.blender.org/documentation/html/x1295.html
and
http://www.rt22fi.it/modules.php?op=modload&name=News&file=article&sid=8&mode=thread&order=0&thold=0
<edit>WARNING the above link is WRONG… I meant
http://download.blender.org/documentation/html/x1382.html
but I cutted & pasted the wrong link…
</edit>

Stefano

Hi Patrik,

You should also try to play with the bias, maybe decrease the value a bit.

Serialsiner.

try this from oldsite

http://oldsite.blender3d.org/showitem.php?id=128

also in french at blender-cafe.org

+++

I’ve found that the tutorial by David Weese over at Blended Planet is an excellent resource/guide to figuring out shadows in Blender.

http://www.blendedplanet.com/tut_shadows.htm

This followed by the tutorial at Blender Cafe (the one posted by Xand) are definitely the ones to read.

Round Table 22 Firenze ?

Will you watch my last vacation slides with us Sunday ?

:smiley:

dang

tooo many windows opened, must have cut the wrong link :expressionless: :expressionless:

Stefano

[quote=“S68”]

dang

Stefano[/quote]

That’s all right : reminded me the time :wink:

the postnuke template system is either a piece of shit, or the people that make them are too lazy to change the layout, but somehow all postnuke/phpnuke pages look THE SAME. :expressionless:

A shadow buffer is basically an image rendered from the light source’s point of view. However, it only renders the depth of each pixel (i.e. like a z-buffer).

During final rendering, each pixel of the final image is transformed to the correct position in the shadow buffer view. If the the depth of that final-image-pixel is further away than the depth of the shadow-buffer pixel, then it is considered to be in shadow (otherwise it is not).

However, because there is only a single depth stored for each pixel in the shadow-buffer, it can’t accurately represent surfaces that are diagonal (in terms of depth) relative to the shadow-buffer. This can cause self-shadowing problems (where a point on a surface casts a shadow on itself). This would be easier to explain with pictures, but for now just take my word on it.

To solve this, you can artificially push the depth of all the pixels in the shadow-buffer deeper. This is what the “bias” value is: the amount by which each shadow-buffer pixel is pushed deeper.
Of course, this causes problems in and of itself, because this may cause some objects that should be in shadow to be lit. So, one should always choose as small a bias value as possible without causing self-shadowing artifacts.

In Blender, the bias is relative to the distance between ClipSta and ClipEnd (I have no idea why), thus pushing them closer together effectively reduces the bias.

I hope this helps. I really need to make a web-page that explains all this with pictures and such…

That certainly would be welcomed. In the mean time that’s the best explanation I had yet.

Thanks.

I just whipped up a web-page that explains (in a simplified way, but that is still completely useful) how shadow-buffers work, and what the various parameters do. And it uses pictures! Yay! :slight_smile:

Here it is:
http://www.brunslo.com/cessen/shadow_buffers.php

Hope this helps!