Jump to content
  • Advertisement
Sign in to follow this  
skyemaidstone

3D Converting my DX9 HLSL to DX10/11

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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: 

 

Share this post


Link to post
Share on other sites

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?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
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!