Does anyone know the standard Mipmap lod logic in WebGPU or WebGL?

42 Views Asked by At

In wgsl, tiling mipmap textures creates unsightly artifacts at the edges. This is probably because the derivation fails on the edges. The sampler weights the mipmaps according to the gradient of the UV coordinates. I now want to create a manual mipmap lod weighting in the shader. The problem with the edges would be easily solved. I just have to determine the lod with the gradients dpdx and dpdy with a small delta away from the edge within the texture and use the value for the edge itself. It would be even easier if wgsl had a command with which I could read the mipmap lod of the buildIn mipmap lod weight function, but that probably doesn't exist. So I have to reproduce the mipmap lod logic and extend it to include the correction on the edges.

And that's why I'm looking for a precise description of how WGSL does this internally. Alternatively, an exact description from GLSL would also help, because I could easily translate that.

Does anyone know exactly how the mipmap lods are weighted with the gradients by wgsl or glsl?

0

There are 0 best solutions below