I have a solar system...

enter image description here

The central star has a point light attached to it.

enter image description here

However, objects don't cast shadows on each other...

enter image description here

Planets are < 20 units from the star, so it's not a light falloff issue.

The point light is the only light source in the scene.

There are occasions when it works - moon 3 of planet 5 correctly casts a shadow on its parent and siblings, whereas none of the others do.

Here's a video showing the issue more clearly: https://youtu.be/rmlWlXjygk0

Note that there are issues both casting and receiving shadows for all but the outermost moon.

enter image description here

Everything is set to both cast and receive shadows, objects are in the correct layers and not marked static...

enter image description here

I've tried changing from forward to deferred but that only prevented me seeing any shadows at all.

What am I missing? How can I get Unity to cast shadows correctly?

  • \$\begingroup\$ A point light turns out to be a poor model for lighting in space. You waste most of the shadow map texels on emptiness, leaving too little resolution to get good shadows on tiny moons. You may want to consider a spotlight or directional light for each cluster of objects instead. \$\endgroup\$
    – DMGregory
    Jan 24 '21 at 16:59
  • \$\begingroup\$ @DMGregory If I could think of a way to do that, I would... But I specifically need up to a dozen or so objects lit from a central point. The ability to fast forward time is a key mechanic and the player has free control of the camera, so I'm not sure how I could fake it with light in any one direction. Since I'm talking about 10 or 20 objects total, is there anything more brute force/tailored I could do? Eg calculating shadows manually and amortising over a number of frames? [Incidentally, while resolution is a concern, only the outermost moon/planet works... which seems inverted] \$\endgroup\$
    – Basic
    Jan 24 '21 at 17:22
  • \$\begingroup\$ Also @DMGregory [sorry to double-post]. If this were a resolution issue, wouldn't the planet always shadow the moons consistently? In the video you can see the smallest moon, farthest out both casts and receives shadows whilst the other two do not. \$\endgroup\$
    – Basic
    Jan 24 '21 at 17:31
  • \$\begingroup\$ I did not say this was solely a resolution issue. I said that resolution will be one of the issues that make point lights a less than ideal solution. You can create and move lights dynamically as easily as you create and move planets, so there's no reason that moving planets would present an unsolvable obstacle for local lights. \$\endgroup\$
    – DMGregory
    Jan 24 '21 at 18:06

You must log in to answer this question.

Browse other questions tagged .