blob shadow z-fighting on iphone

I can't seem to get my blob shadow from z-fighting with the ground plane on iphone. The shadow looks fine in Unity. I'm using the blob from iPhone Standard Assets.

I've followed suggestions on other threads: turned off mips, tried RGBA 16 and 32 bit, set it to orthographic, scripted it to follow my player rather than parenting to get rid of rotations, turned off cast/receive shadows on the ground planes, etc.

My ground geometry is a maya .mb with "meshes have colliders" checked. The ground texture is using the Diffuse shader, but I've tried iphone/Vertex Colored and just about ever other shader. Basically I have the same setup as the Penelope project.

I'm starting to wonder if this is a bug.

alt text

I can imagine you're tired of trying everything but one more thing you could try is modifying the Camera near and far plane, increasing value for near, decreasing value for far as much as possible. If you basically have a flat underground you could also consider using a plane with the shadow on it instead of a shadow projector, easier and faster. Place the plane a few cm above ground (and/or modify the texture offset of the shader).

I'm using shadows on Unity too, and they are a little CPU intensive for my proyects, but try this:

The projector ignore layers property is also useful for some glitches like that, just put your ground in a completely different layer and make the projector ignore all layers except that. It worked for me :)

I found the solution. Add the following line under Pass {} in the ProjectorMultiply.shader:

Offset -1, -1

Here's the complete shader with the line added.

Shader "Projector/Multiply" {
   Properties {
      _ShadowTex ("Cookie", 2D) = "gray" { TexGen ObjectLinear }
      _FalloffTex ("FallOff", 2D) = "white" { TexGen ObjectLinear   }
   }

   Subshader {
      Tags { "RenderType"="Transparent-1" }
      Pass {
         ZWrite Off
         Offset -1, -1
         //Fog { Color (1, 1, 1) }
         AlphaTest Greater 0
         ColorMask RGB
         Blend DstColor Zero
         SetTexture [_ShadowTex] {
            combine texture, ONE - texture
            Matrix [_Projector]
         }
         SetTexture [_FalloffTex] {
            constantColor (1,1,1,0)
            combine previous lerp (texture) constant
            Matrix [_ProjectorClip]
         }
      }
   }
}

Offset is described in the Culling & Depth Testing doc: "For example Offset 0, -1 pulls the polygon closer to the camera ignoring the polygon's slope, whereas Offset -1, -1 will pull the polygon even closer when looking at a grazing angle."