Converting my DX9 HLSL to DX10/11

Started by
2 comments, last by skyemaidstone 6 years, 6 months ago

Just a quick one (hopefully). I'm trying to use hardward PCF that's apparently built in later than dx9 so I'm updating some old shaders.

I was using:

distanceStoredInDepthMap = tex2D(ShadowMapSamplerHQ, lightSamplePos);    
                shadowCondition =  distanceStoredInDepthMap  <= (realDistanceToLight);    

                float lit = float(ShadowMapHQ.SampleCmpLevelZero(cmpSampler, lightSamplePos, realDistanceToLight));
                


distanceStoredInDepthMap = tex2D(ShadowMapSamplerHQ, lightSamplePos);	
shadowCondition =  distanceStoredInDepthMap  <= (realDistanceToLight);	

I'm trying update it to use the comparison method on the Texture2D object;


float lit = float(ShadowMapHQ.SampleCmpLevelZero(cmpSampler, lightSamplePos, realDistanceToLight));

But it's just returning 0. I've just left SamplerComparisonState as defaults.

Sorry if this is a dumb question.

Advertisement

Are you sure that cmpSampler has been setup correctly? You will have to configure it via the API. Use Renderdoc to double check ;)

FWIW, hardware PCF is available in D3D9 but it's a bit messy. See: 

 

So essentially what i'm doing is correct with SampleCmpLevelZero is it? It compares whatever is at that texture coordinate with the float I pass in parameter 3 (using whatever samplercomparisionstate is have set)? Or have I misunderstood something else?

 

This topic is closed to new replies.

Advertisement