SampleLevel and interpolation

Started by
3 comments, last by JB3DG 10 years, 2 months ago

Hi guys

Are there any special requirements in the D3D setup for using SampleLevel multiple times in a pixel shader on the same texture? Eg say I want to sample 4 points around the current texture coordinate for an edge detection system. Anything special required on the D3D interface?

Thanks

JB

Advertisement

Nope, nothing special required. It should work as expected.

Also FYI if you need to sample in a fixed pattern, it can be helpful to make use of the integer offsets.

Thanks. How does one make use of integer offsets then?

// This will sample, and offset the sample position to the right two texels and down one texel
int2 offset = int2(2, 1);
float4 texSample = MyTexture.SampleLevel(MySampler, TexCoord, mipLevel, offset);

aha. Thanks a bunch

This topic is closed to new replies.

Advertisement