2
$\begingroup$

I have a model of a building with balconies and have a few issues with shadows when trying to display them with Eevee renderer (Cycles renders good though). Honestly, I'm new to blender so may be you will have some recommendations on how to work with these kinds of problems or where I could read about all the shadow issues and how to deal with them. Thanks in advance!

So. This is how it looks with face orientation: enter image description here

As you can see something's wrong with the way balconies shadows being rendered. Here (red outlines) must be shadow but it's not enter image description here

The same happens with the roof above the entrance enter image description here

And at last there's something's wrong with the roof. It's plain face and there're no edges or vertex inside but there's this weird shadow appear enter image description here

P.S. this balconies and the roof above entrance are the part of the building geometry - they are not separate geometries

UPD. I tried the recommendation to tweak contact shadow and got this. Now there are 2 types of shadows which overlap and this doesn't look good neither enter image description here

$\endgroup$
4
  • $\begingroup$ for the roof maybe share your file so that we can check: blend-exchange.com $\endgroup$
    – moonboots
    Commented Sep 26, 2022 at 7:45
  • $\begingroup$ the roof could be overlapping geometry $\endgroup$
    – Luciano
    Commented Sep 26, 2022 at 10:07
  • $\begingroup$ @moonboots here's the file $\endgroup$ Commented Sep 26, 2022 at 11:47
  • $\begingroup$ It looks like your problems come from very small dimensions of your object $\endgroup$ Commented Sep 26, 2022 at 15:22

2 Answers 2

3
$\begingroup$

It looks like at least 2 factors are important for the shadow:

  • In the Render panel > Shadows > Cascade Size:

enter image description here

  • For the light, enable the Shadow > Contact Shadow option and increase the Distance value:

enter image description here

Here is what it gives if I increase the Distance value in your file. Also, increasing the Clip Start value under Shadow seems to fix the artefact issue:

enter image description here

$\endgroup$
3
  • $\begingroup$ Thank you for the advice! I tried to tweak these following your recommendation. But alas this doesn't lead to any good result. I will attach to the question result which I got $\endgroup$ Commented Sep 26, 2022 at 11:48
  • $\begingroup$ See my edit, increasing the Distance value seems to work, also increasing the Clip Start value seems to fix the shading artefact $\endgroup$
    – moonboots
    Commented Sep 26, 2022 at 12:24
  • $\begingroup$ ok I got it. Thank you both, guys! @Nathan and moonboots, I employed both your advices and also decreased Light -> Shadow -> Bias to 0.001 which at last gave me ideal result that doesn't seem to depend from a point of view. I'm going to mark this reply as answer because it was first. But both your answers were very helpful $\endgroup$ Commented Sep 26, 2022 at 20:18
3
$\begingroup$

as though they levitate

That's a good description of the problem. This problem has acquired the name "Peter Panning" amongst people making rendering engines. Because Peter Pan flies. If you'd like, you can find a lot more information about this problem by searching for "Peter Panning shadows".

On the initial file, we see that you have a point light, and you've already enabled contact shadows (which is good.)

The shadows in Eevee can depend on the exact camera position, so I'm going to rotate you camera to face the building and look through it. Let's get an image of our starting point:

enter image description here

Eevee shadows work with a "shadow buffer"-- they do a render from the position of the point light, just rendering the depth. Then when they use the camera, the figure out what the position of a sample would be in that light's depth buffer and see whether it's the frontmost thing. This isn't the exact depth value; instead, a bias to the depth is applied to prevent small errors in precision from creating big, ugly glitches. This is generally an effective way to do things, but it leaves a lot of room for errors.

However, there are quite a few things that we can do to improve that precision. First, we can increase the cube size in render settings. Because the light is a point light, omnidirectional, its shadow buffer is stored as a cube map. If we were using a sun light, its shadow buffer would be a flat image (well, several flat images, it's a "cascade" of flat images), and we'd want to look at the cascade size instead.

Additionally, we should enable "high bit depth" in the shadow settings. If we think about the depth buffer being an image, the cube size refers to its XY, UV resolution, while increasing the bit depth is like rendering to floating point data instead of a 8 bit .png. This will allow the depth buffer to more accurately distinguish between nearby geometry to give more accurate shadows. The more accurate we can make the base shadows, the less we'll have to rely on kludges like contact shadows.

enter image description here

We can see that doing this gives us an immediate improvement to our shadows. However, some problems remain.

The shadow buffer is "biased" in order to prevent problems like shadow acne, where small errors create unpleasant artifacts. However, in our case, that bias is creating its own problems, where the shadows don't come all the way to the wall-- the bias is thicker than the shadowing geometry. So we can adjust our light's bias settings to eye to fix this issue:

enter image description here

I'd encourage you to set the bias to 0.0 and inspect the image, just to see the "shadow acne" artifacts that bias is designed to prevent.

Now, our scene is being shadowed mostly appropriately, but our contact shadows are creating some artifacts. Contact shadows are essentially a hack to make up for some of the problem involved in rasterization lighting. We can eliminate the worst artifacts simply by making the contact shadows smaller, which we'll do by adjusting their thickness:

enter image description here

We just do this to eye, making them as thin as we can make them while preserving the parts where we need those contact shadows to make it all work.

While you could continue to adjust some settings here and there (the light's clip start is set a bit low, which can interfere with precision, the same as setting a camera's near clip too low), you're not going to get a lot better than this. Unfortunately, rasterizer shadows require a lot of hacks to get right. The underlying idea behind shadow buffers is elegant, but the errors in precision from sampling create the need for a lot of different tweaks.

$\endgroup$
1
  • $\begingroup$ Wow thank you for such comprehensive explanation! I thought may be something's wrong with the geometry but I see it needs some fine tuning to get pleasing result $\endgroup$ Commented Sep 26, 2022 at 20:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .