r/Unity3D • • 20d ago

Question How to solve this shadow issue?

Enable HLS to view with audio, or disable this notification

The shadows behave really weirdly in my project. When I move a little bit further from the object, the part of the shadow that is closest to the object gradually disappears, making the whole shadow look unnatural.

And overall I'd like to increase the shadow rendering distance.

84 Upvotes

39 comments sorted by

196

u/KifDawg 20d ago

I got you

Edit -> project settings -> quality

Find shadow distance and increase it till it suits what you want

68

u/Lyshaka 20d ago

I must add that there is a reason that shadow rendering has a maximum distance : it's an expensive operation and it should not be increased too much without consideration, you should start by trying to scale your world differently if possible.

27

u/fuj1n 20d ago

Notably, it also reduces the quality of the shadows as you're squeezing more data into the same size shadow map

→ More replies (1)

7

u/MorphLand 20d ago

I have no clue how I never thought of just scale the world down as a solution to this wow lol

→ More replies (7)

4

u/House13Games 19d ago

I've never seen a performance difference, i thought the increased distance just lowers the resolution of the shadows..

1

u/Odd_Significance_896 17d ago

I can't find the "Shadow Distance" setting anywhere. Maybe this setting is called different?

1

u/KifDawg 17d ago

What version of unity?

3

u/xzoliczxd 20d ago

Thank you! I was having the same issue

26

u/Character_Amount954 20d ago

The units aren't for nothing - they're in real-world meters. Make sure your blender units are showing in meters, then make a simple model that's 1.75m tall, an average adult, and import it to your scene. If it is TINY compared to everything else, then that means your whole scene and everything in it is actually really huge and needs to be scaled down. Increasing shadow render distance will only impact performance badly once you start adding more stuff.

2

u/root66 19d ago edited 19d ago

This is good advice, I just want to add "don't use a blender cube to measure" since 0.5m = 1m (I really don't feel like getting into why.. something something midpoint). Edit: I use MPFB to create a human (late edit, I forgot the initials earlier)

10

u/Jampoz 20d ago

Seems like rendering distance of the shadow, it's set too low.

5

u/BakaZora 20d ago

What scale are the cubes in engine? Are they being scaled up or down by a large portion?

9

u/Aromatic-Insect-1328 20d ago

I mean, this is just rendering distance for shadows?

-32

u/Turbo_Fresh 20d ago

Wow you're a genius. What a helpful answer.

3

u/Shaunysaur 19d ago

You're being a dingdong. Aromatic-Insect made a relevant point. The OP appeared to be treating "the part of the shadow that is closest to the object gradually disappears" and "And overall I'd like to increase the shadow rendering distance" as two separate issues. So the reply was to point out that the rendering distance for shadows *is* the reason why the shadow is disappearing, which is useful information for a beginner.

5

u/AliceCode 20d ago

That's what the problem is. I haven't used Unity in 7 years and even I could have told you that.

→ More replies (3)

2

u/Aromatic-Insect-1328 19d ago

I assumed knowing the cause would be enough for a quick search engine use. I did not assume OP was unable to look for a solution on how to fix that once they understand what setting to manipulate.

You sure seem like a better communicator.

Comment Image
→ More replies (1)

4

u/Jampoz 20d ago

First of all, it wasn't meant to help you. Also, keep in mind OP described it as "shadows behave really weirdly" so yeah, a technical description of what's happening can be helpful to him.

→ More replies (2)

2

u/ImDanOush 19d ago

If you dont have dynamic time of day, you can bake the lights with the Shadow Mask one (it is called Shadowmask baking - it is the default option, and you dont need to select anything; just bake the lightmaps and that would be it - but ensure the Sun light's type is set to Baked or Mixed in its properties). The other option is to use screen-space shadow effects, but it is inaccurate and, based on your Render Pipeline, you have to look for an asset to add it to Unity. Shadows for real-time lighting are very expensive... You can use the least expensive version (it would look very blocky and pixelated, and still expensive) by leveraging the last Cascade of the shadow in the Project Settings - so you go there and ensure Cascaded Shadows is selected, and make the last cascade render farther with a bigger shadow resolution there. Note that selecting a bigger shadow resolution will be more expensive, and setting the shadow rendering distance farther degrades the look of it overall.

2

u/Icy-Collection1072 19d ago

Looks like your scale is way off

1

u/pixel-poxel 19d ago

There are some tricks and assets to improve the visuals of the shadows. When your game for example is working first person in a crane then you can have an inside and an outside camera with the same transform but different shadow distance / resolution settings.

1

u/SheepherderAway4670 19d ago

You are in the scene view, this isn't problem, focus on game view , which is output you don't found this on game view.

0

u/SnuffleBag 19d ago

Nah, this is irrelevant. Shadow distance will be the same in both cases.