Jump to content

  • Log In with Google      Sign In   
  • Create Account

SampleCmp giving weird results


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Telanor   Members   -  Reputation: 1338

Like
0Likes
Like

Posted 17 September 2013 - 12:40 AM

I'm trying to use SampleCmpLevelZero for hardware PCF shadow filtering but for some reason it's making my shadow maps successively darker in further cascades (I'm using cascaded shadow maps as well).

This is what the scene looks like with shadows turned off (also looks identical to doing a standard Sample):

RuinValor 2013-09-17 02-29-53-75.png

And with the shadow maps on:

RuinValor 2013-09-17 02-29-56-55.png

And again with the debug output:

RuinValor 2013-09-17 02-29-58-98.png

Bottom image is the depth from the player's perspective, middle is the 4 cascades showing the depth from the light's perspective, and the top is the combined shadow map. This is my sampler state:
 
SamplerComparisonState cmpSampler
{
	Filter = COMPARISON_MIN_MAG_MIP_LINEAR;
	AddressU = CLAMP;
	AddressV = CLAMP;
	ComparisonFunc = LESS_EQUAL;
};
And sampling code:
 
return ShadowMap.SampleCmpLevelZero(cmpSampler, shadowTexCoord, lightDepth - SHADOW_BIAS);
If I change to using just a regular sample, there's no problem
 
float sample = ShadowMap.Sample(DepthMapSampler, shadowTexCoord).r;

return sample > lightDepth - SHADOW_BIAS;
Any ideas?

Sponsor:

#2 Telanor   Members   -  Reputation: 1338

Like
0Likes
Like

Posted 17 September 2013 - 02:53 AM

Found the problem. Turns out SampleCmp only works on a very small number of formats. I switched to a compatible one and the problem went away.

Edited by Telanor, 17 September 2013 - 02:53 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS