This topic is 910 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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

Filter:             ANISOTROPIC 16x

LOD Clamp:   0-FLT_MAX

Mip Bias:       0

Share on other sites

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 on other sites

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

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 on other sites

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

The WARP driver does not fix the issue either.

Share on other sites

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

Share on other sites

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

Share on other sites

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

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

1. 1
2. 2
3. 3
Rutin
16
4. 4
JoeJ
13
5. 5

• 9
• 14
• 10
• 25
• 9
• Forum Statistics

• Total Topics
632645
• Total Posts
3007632
• Who's Online (See full list)

There are no registered users currently online

×