SampleGrad on TextureCubeArray

Started by
7 comments, last by kevinvannerum 8 years ago

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

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. :)

.:vinterberg:.

That's exactly how I try to address them :) (Although, in desperation, I tried every other possibility as well)

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?

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

It is an issue with SampleGrad. I previously had a working test with SampleLevel.

The WARP driver does not fix the issue either.

Have you tried not passing LOD (last parameter, it's optional)?

.:vinterberg:.

Yes, same result. Always first cube, but in that case also always highest mip of course.

Can you show me the SRV description you use to create the SRV?

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

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 :)

This topic is closed to new replies.

Advertisement