GLSL built-in function

textureProjLod()

Projected sampling with explicit mip level.

Demo version: GLSL ES 3.00 / WebGL 2Demo stage: Fragment

Syntax

gvec4 textureProjLod(gsampler2D sampler, vec3 coord, float lod)

Parameters

sampler
Bound fixture texture
coord
Lookup coordinate
lod
Mip level; zero is full resolution

Return value

Four filtered components from projectively divided coordinates at the explicit mip level.

Live example

Edit the code and the preview updates as you type.

What textureProjLod does

Projected sampling with explicit mip level.

Read the preview

The divisor in vec3(uv,0.8) changes framing, while u_parameter*6.0 changes mip detail. Set the LOD argument to 0.0 to inspect that framing with the sharpest source mip.

Core call

textureProjLod(u_texture,vec3(uv,0.8),u_parameter*6.0).rgb;

Projected coordinates still require division; do not drop their final component.

Experiment

Fix LOD at 3.0, then change vec3(uv,0.8) to vec3(uv,1.0). The full grid returns inside the frame, but still uses the same coarse mip level.

Specification

GLSL ES 3.00 built-in functions, chapter 8

Related functions