I’m having a problem with inconsistent shadowing. First problem is that some objects are breaking the shadows like in the picture. Second, my character doesn’t respond to any shadows. In both cases “cast shadows” and “receive shadows” are on on. This is also true of the object the player is standing on. All lights in the scene are mixed with “hard shadows” set as their shadow type. I am using mobile shaders that don’t have any emissive properties. I’m not sure what I am missing.
How big is the ground mesh that’s not receiving any shadows? How many shadow casting point or spot lights do you have in your scene? And how many of those lights are affecting that mesh that’s not receiving shadows?
If you increase the Pixel Light count in the quality settings to 100, does the problem resolve itself?
If the answer is “yes” to that last question, that means the answer to the first set of questions is “fairly large / more than one / more than the pixel light count”. Basically when using forward rendering, a single mesh can only be affected by a specific number of shadow casting lights, and that number is set by that Pixel Light setting. If you have a lot of lights affecting a single mesh, than only some semi-random selection of those lights will be able to cast a shadow on the surface, and you can have up to 4 additional “per vertex” point lights that only affect the surface’s diffuse lighting without any shadows.
I upped the pixel light count up to 100 and it had no effect. The number of lights I have is minimal. A directional light, and one point light right next to the character in the picture above. I don’t know what the vertex count of the model is but it’s shown in the picture above (it’s the ramp that the player is on). I can say that the model has been optimized for mobile. Any other thoughts?
What shader are you using on that ground? Is it the same one as on the other surfaces?
Well, those were good questions. I was using “Mobile/Bumped Diffuse” on that ground. I switched back to the standard shader and the shadows behaved as expected. I’m new to writing for mobile and I just thought that should be the way to go. Should I be using the standard shader if I want shadows? Which shader should I use? I’m not sure of the difference other than the way they display shadows.
The built in Mobile shaders don’t support shadows from anything but a single directional light. The Standard shader is more expensive than the Mobile shaders, in part because they support additional light shadows. But also because it’s a more complex shader. However I would stick to the Standard shader for now unless you’re having performance problems.
I was thinking of sticking with the standard shaders for now. I don’t see any real performance issues. Thanks for the explanation.