I am facing some difficulties with the use of a cubemap shadow associated to a poinlight (represented as the yellow bicone in the picture). The shadow map itself is generated properly (see picture).

I’m using a R32F texture to store a Dist = dot(Lightpos-vertex.pos) value. This is made on a vertex basis meaning that I sent to the pixel shader the color obtained in the geometry shader. Below part of the GS.
for( int f = 0; f < 6; ++f )
{
f=(f==2)?f+1:f;//don’t render the Y top as I don’t need it
matrix M = LightViewProjCube[f];
output.RTIndex = f;
for( int v = 0; v < 3; v++ )
{
float3 P = LightPos.xyz-input[v].Pos.xyz;
output.Color = dot(P,P)+1;//+1 to avoid self shadowing because I use cullback
output.Pos = mul( input[v].Pos, M );
CubeMapStream.Append( output );
}
CubeMapStream.RestartStrip();
}
In the rendering pass I calculate the Len = dot(Lightpos-vertex.pos) as well in the pixel shader (not in the vertex shader as in the RasterTek DX11 tutorial). Below part of the code.
float Shadow = 1;
// LightDirAmbient.w contains the number of point lights for this object
for ( int n=0;n<(int)LightDirAmbient.w;n++)
{
txProj = LightPos[n].xyz-Input.WorldPos.xyz;
float Len = dot(txProj, txProj);
//the squared distance is normalized to 1 using 1/(r*r) where r is the radius of the light n
LTNE.y = clamp(1-LightPos[n].w*Len,0,1);//LPos.w contains 1/(r*r) of light n
txProj = -txProj;//txProj is also used for my lighting. Must be inverted for the shadowmap sampling.
LTNE.z = txShadowArrayCubeMap[n].Sample(samLinear, txProj).r;
Shadow*=( LTNE.z < Len )? 1-LTNE.y:1;//attenuate shadow intensity over distance
In this particular scene I observe this shadow parts missing between red lines. I don’t understand why. In the scene the building is excluded from shadowcube rendering to be sure the problem is not distance fighting.
I’m using usual viewproj matrices for pointlights with PIDIV2 fov, 0 nearplane, 500 farplane. My point lights have max radius 500 units, using higher farplane does not change the problem. It seems not related to the camera position as well. There is apparently a link with the spherical shape of the light.