0
\$\begingroup\$

I have this situation where I have parts of the same scene in each 4 half squares of a rendertarget rendered with the same view projection matrices. In my deferred pipeline I would like to sample with gatherRed the four pixels representing the same screen space location for each quarter. So there is this offset possibility but it is int2 not float2 so I don't get how to use these offsets. Is it pixel decal or something else? Obviously doing (screen = W1920-H1080):

 GatherRed(sPoint, input.tex.xy, int2(0,0), int2(960,0), int2(0,540), int2(960,540));

does not give me the expected result. Is it limited to closest pixels?

currently I'm doing 4 sampling that work : SampleLevel(sPoint, input.tex.xy + float(dx,dy)) where dx,dy are 0 or 0.5 or both.

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

This seems to be covered in the documentation for Gather.

The offset uses only the low 6 bits as a signed integer where 1 = 1 texel width, so it has a range of -32 to +31 texels on Shader Model 5+ (-8 to +7 on older models).

These functions are not appropriate for what you are trying to do with them. You should use four conventional texture samples, or if you only need one channel per view, stack all four into the same texture area on different colour channels.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks. I did not get this web page when searching for Gather uses. Makes sense. I have alerady used this 4 channel idea in another context. I can try for this one. \$\endgroup\$
    – philB
    Commented Jul 12, 2023 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .