Intrinsics1 min read

sample_bias_offset

Samples a texture with a LOD bias and integer texel offset.

Reading Time
1 min
Word Count
113
Sections
7
Try It Live

Test sample_bias_offset in a live shader

Open the playground, start from a visual preset, and wire sample_bias_offset into the fragment stage to see how it behaves with real values.

Open Playground

The sample_bias_offset function samples a texture with automatic LOD selection, adds a LOD bias, and applies a constant integer texel offset.

Live Demo

Signature

bwsl
sample_bias_offset :: (texture2D tex, sampler samp, float2 uv, float bias, int2 offset) -> float4 {...}

Parameters

ParameterTypeDescription
textexture2DTexture to sample
sampsamplerSampler state
uvfloat2Texture coordinates
biasfloatLOD bias
offsetint2Integer texel offset applied to the sample

Return Value

Returns the filtered sample value after applying the LOD bias and texel offset.

Example

bwsl
float sharpen = -0.5;
float4 right = sample_bias_offset(detailTex, uv, sharpen, int2(1, 0));

Compiled Output

When compiled to GLSL:

glsl
textureOffset(tex, uv, offset, bias)

See Also