I implemented dual paraboloid shadows for point lights. The goal was to reduce the number of shadow passes. Also the target is GLES3.0 so no layered rendering is available. The shadows work, and actually the quality is not bad at all.

There is one issue though. I store both hemisphere shadow maps into a single atlas during the shadow pass. During the lighting pass I sample from that atlas,from the relevant part based on the direction (forward or backward). When the shadow crosses both maps there is a white seam in the middle. I tried to change the filter mode of the FBO texture, also changed wrapping mode, but nothing helps.

Here is the screenshot:

enter image description here

The point source is the small white sphere at the top and currently it is located so that the shader samples half from each map in the atlas.It results in the white line in the middle of the shadow.

Here is the code in the light pass:

float Shadow(vec3 viewPos,vec3 lightViewPos,vec3 viewNormal,float bias)
    vec3 vPosDP = vec3(u_lightViewMatrix * v_worldPosition);
    float fLength = length(vPosDP);
    vPosDP /= fLength;
    lightViewPos = (u_viewMatrix * vec4(lightViewPos,1.0)).xyz;
    vec3 L = normalize(lightViewPos - viewPos);
    float NdotL = saturate(dot(L, viewNormal));
    bias =  max(0.01 *(1.0 - NdotL), bias);
    float fDPDepth;
    float fSceneDepth;

    if(vPosDP.z >=  0.0)
        vec2 vTexFront;
        vTexFront.x =  ((vPosDP.x /  (1.0 + vPosDP.z))  * 0.25  + 0.25 );
        vTexFront.y =  ((vPosDP.y /  (1.0 + vPosDP.z))  * 0.5  + 0.5  );
        fSceneDepth = (fLength - u_nearFarPlanes.x) / (u_nearFarPlanes.y - u_nearFarPlanes.x);
        fDPDepth =   texture(u_shadowMap, vec3(vTexFront,fSceneDepth - bias));
        // for the back the z has to be inverted        
        vec2 vTexBack;
        vTexBack.x =  ((vPosDP.x /  (1.0 - vPosDP.z)) * 0.25  + 0.75);
        vTexBack.y =  ((vPosDP.y /  (1.0 - vPosDP.z)) * 0.5  + 0.5);

        fSceneDepth = (fLength - u_nearFarPlanes.x) / (u_nearFarPlanes.y - u_nearFarPlanes.x);
        fDPDepth =   texture(u_shadowMap, vec3(vTexBack,fSceneDepth - bias));
    return  fDPDepth;

I read that this shadow technique has negative effect when low res geometry is involved. Is my issue related to that effect?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.