I am trying to render plants with transparent textures. I use discard in the shader that creates the shadow map, but I get blocky holes in the shadow:
This is the shader that I'm using:
uniform mediump vec2 uvOffset;
uniform highp mat4 matrixPVM;
attribute highp vec3 inVertex;
attribute mediump vec2 texCoordAttr;
varying mediump vec2 texCoordVar;
void main(void)
{
gl_Position = matrixPVM * vec4(inVertex, 1.0);
texCoordVar = texCoordAttr.st + uvOffset.st;
}
uniform sampler2D sampler2d;
varying mediump vec2 texCoordVar;
void main(void)
{
lowp vec4 texColor = texture2D(sampler2d, texCoordVar);
if (texColor.a < 0.001) discard;
}
As you can see the opaque objects have the shadow rendered correctly. I tried doubling the resolution of the map and changing the alpha compare number, but makes no difference.
Anyone know a solution to this problem?