Advertisement Jump to content
Sign in to follow this  
skyemaidstone

3D Converting my DX9 HLSL to DX10/11

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

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
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!