Jump to content
  • Advertisement
Sign in to follow this  

Shadow Volume artefacts

This topic is 5458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im getting these weird lines from my extruded shadow volume. here is the vertex shader:
    float3 Pos = mul(float4(InPos, 1), (float4x3)World);  
    float3 Normal = normalize(mul(InNormal, (float3x3)World));   
    //float4 Pos = mul(float4(InPos, 1), World);
    Out.TextureUV = InTexCoord;
    //generate shadow projection vector
    float3 LightToVertex = -(Pos - LightSource);
    //calculate if current vertex is on a backface
	float backFace = dot(LightToVertex, Normal);
    //extrude backfaces to an arbitrary distance (with smoothing)
    if (backFace < 0.0)
		Pos -= (10*LightToVertex) * (-backFace);
	//transform position to projection-space
    Out.Pos  = mul(float4(Pos, 1), ViewProjection);              // position (projected)
    return Out;

I render one pass to the depthstencil using CCW culling (incrementing stencil) and a second with CW culling and decrementing the stencil value. heres a screen of my problems. what could be wrong?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!