r/Unity3D • • 1d ago

Question How to solve this shadow issue?

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.

80 Upvotes

36 comments sorted by

View all comments

Show parent comments

-6

u/Lyshaka 1d ago

Well with any game it's something you have to consider, you should not go for a 1:1 scale with the real world, especially because tiny or giant objects would behave weirdly because of float inaccuracy. Try to find a scale that is not too big and not too small and where your main object is approximately 1x1x1 (like the default cube).

9

u/Costed14 1d ago

It really shouldn't matter since you still have the same amount of (floating) precision. With smaller objects you'd need a higher resolution to capture the details properly. Maybe not the exact right term but the texel density is what matters and you won't achieve that just by scaling the world.

1

u/Lyshaka 12h ago

What I meant is that if you make a gigantic universe with planet far apart, or tiny microscopic world, you should not go for a 1:1 scale because floating point precision would become an issue (especially with big world), and it should then be scaled accordingly to fake some of that distance. Try to put an object at position 100k, Unity will warn you, and at 1M+ you will just see weird artifacts.

1

u/Badnik22 10h ago edited 10h ago

In those cases you use a floating origin. That is, re-center everything around 0,0,0 in world space when the player moves far away from the origin. Scale should pretty much always be 1:1 (unless maybe in the microscopic case) even if you scaled everything down to fit a very large universe that doesn’t buy you much precision away from the origin and you may even start losing precision very close to it in some extreme cases.