• Advertisement
Sign in to follow this  

weird SampleCmpLevelZero behaviour

This topic is 3354 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

Hi again while implementing shadow mapping I came across this problem
SamplerComparisonState samplerShadowMap
    ComparisonFunc = Less;
    AddressU = Clamp;
    AddressV = Clamp;

float fragmentdepth = input.PosSM.w / SMfar;

float shadowed = SMtexture.SampleCmpLevelZero( samplerShadowMap , float2( 0.5 * input.PosSM.x / input.PosSM.w + 0.5f , 1.0f - ( 0.5 * input.PosSM.y / input.PosSM.w + 0.5f ) ) , fragmentdepth );

It's supposed to compare the value in the shadowmap against fragmentdepth and return whether it passes. But SampleCmpLevelZero looks as if it doesn't even compare the depth values at all, it simply samples the texture. I've tried replacing the texture to a bitmap, and indeed, SampleCmpLevelZero returned the exact colors. I thought it's supposed to compare values and only return either 1 or 0. What is happening? Am I doing something wrong or is this a bug?

Share this post

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

  • Advertisement