textureLevel
Creates a texture sampling node that explicitly selects a Mipmap level (LOD). Functionally equivalent to using `textureLod` in GLSL: it keeps the sampler/filtering intact and only fixes the LOD.
Core Advantages
Deterministic LOD. Prevents derivative-driven level popping or shimmer, gives predictable sharpness/blur, and aligns precisely with custom filtering or nonstandard pipelines.
Common Uses
Lock to mip 0 for the sharpest detail (UI atlases, decals).
Force higher mip levels for cheap blur or far-distance denoising.
Select mip by roughness or distance to match nonstandard BRDF/IBL flows.
Avoid auto-LOD issues when derivatives are unavailable in certain stages.
How to adjust
Change the integer `level` (0-based) to pick the desired mip. Larger values yield blurrier results. Drive `level` with a uniform for animated transitions, or compute it from distance/roughness for artistic control. Use `textureLoad()` instead if you need nearest, non-interpolated texel fetches.
Code Examples
1// 1) Lock to mip 0 for crisp detail
2const sharp = textureLevel( myTexture, uv(), int( 0 ) );
3material.colorNode = sharp;
4
5// 2) Lock to mip 2 for a softer look
6material.emissiveNode = textureLevel( myTexture, uv(), int( 2 ) );