Jump to content
  • Advertisement
Sign in to follow this  
kevinvannerum

SampleGrad on TextureCubeArray

This topic is 910 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 all,

 

I'm currently implementing a light probe system. I'm passing the captured data of my 8 closest (specular) light probes to the shader as a TextureCubeArray. I'm using a workflow similar to clustered lighting to determine the list of which probes are needed.

 

Because I have a list, with a variable number of applicable probes per pixel, I need to use SampleGrad in my evaluation loop as the shader otherwise tries to enforce an unroll.

 

This is the call to my local specular probes (shader model 5 SampleGrad) :

float3 EnvColor = Loc_Spec.SampleGrad(LinearSampler, float4(dir, lightProbeIndex), SampleGrad_Probe_DDX, SampleGrad_Probe_DDY, LOD).rgb;

My problem: It always samples the first cube in the array. I can pass whatever for 'lightProbeIndex', it does not make a difference.

Capturing the executable however, shows that Loc_Spec is a correctly build array of 8 cubes, each with 6 correctly ordered faces, as expected.

 

Has anyone encountered a similar problem with SampleGrad before?

 

Greetings.

 

PS: Captured Texture/Sampler characteristics below for added info.

 

Texture

 

Type:              Cube Array

Width/Height:  128

Depth:            1

Array Size:     48

Format:          R11G11B10_FLOAT

 

Sampler

 

Addressing:    UVW: CLAMP

Filter:             ANISOTROPIC 16x

LOD Clamp:   0-FLT_MAX

Mip Bias:       0

 

Share this post


Link to post
Share on other sites
Advertisement

What is your lightProbeIndex ranging from/to? I think it needs to be in whole steps, like 1.0 for second cube in array, 2.0 for third etc. :)

Share this post


Link to post
Share on other sites

Do you believe this issue is specific to SampleGrad or do Sample / SampleLevel exhibit the same behaviour?

Have you tried the WARP driver to rule out a driver bug?

Share this post


Link to post
Share on other sites

There was a lack of a decent SRV description for the TextureCubeArray type. That slipped past since I had no hand in that part and the capture gave correct results. Thx for the hint :)

Edited by Kevin Van Nerum

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!