Problem with deferred rendering real time shadows.


Since some time we have serious problem with the real time shadows in Unity 3.2 Pro. It manifests like this:

1) There are simply no more real time shadows for directional and spotlights when using deferred rendering. In any scene in our main project. (They did work for the longest time. They still do appear as baked shadows. I can't really say, when we lost them, but I suspect it happened with our upgrade to 3.2)

2) Strange blending artifacts appear when we combine our (directional) lights with beast light maps.

Take a look at the following screenshot. It's a scene with a directional light, casting soft shadows on a terrain (random texture) with baked dual lightmaps. I took the screenshots while zooming out with the camera. Look at the strange bright border with the stepped, sharp edges. It appears approx. in the region where real time lighting and the baked light map should blend.

alt text

As you can see, there are still shadows in the baked light map, but none in the real time This is really troublesome and I ran out of ideas on how to fix it. Any ideas?

Thank you!

Try re-baking your light maps. A missing light map can really mess with your shadows in an area.

As a side note: the "blending artifact" is slices of the terrain mesh either being completely shadowed or completely unshadowed. The terrain is rendered in patches in case you didn't know, in order to keep the mesh size from being too large.

Also check to make sure that you don't have your shadow distance set too high, quality can really degrade at large numbers.

We fixed the problem!

It's cause was old shader code that was incompatible with the new rendering functionality of Unity.

First step was the deletion of the standard asset shaders, which we imported for reference some time ago. This fixed the light map blending problems, but still did not bring back real time shadows for most of our objects (specifically, the pixel-lit ones).

The second step was the modification of some old shader code in a Vertex-Lit shader. The problematic line was some ShaderLab Tags. The debugger turned them up as errors after I re-imported all the still remaining shaders in our project.

Offset [_ShadowBias], [_ShadowBiasSlope]

Commented the line out andto my great reliefwe have shadows again!

Thanks everyone!

make sure the static function of the objects are enable. You can check it in the inspector of the object. (right up in the inspector)

Good luck