Jump to content
  • Advertisement
Sign in to follow this  
hmmcoffee

weird SampleCmpLevelZero behaviour

This topic is 3450 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
{
    Filter = COMPARISON_MIN_MAG_MIP_POINT;
    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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!