NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.29k stars 139 forks source link

Range and meaning of 'mip_level_bias' #98

Closed wbhu closed 1 year ago

wbhu commented 1 year ago

Hi,

Thx for your awesome work. Could you please give some information about the range and meaning of 'mip_level_bias' for the ‘nvdiffrast.torch.texture’ function. Let's say we have N levels mip-maps, does it mean mip_level_bias=0.0 stands for level=0 and mip_level_bias=1.0 stands for level=N-1?

s-laine commented 1 year ago

If you provide no texture coordinate derivatives, mip_level_bias will determine the used mip level directly. The range is from 0 to number of mip levels: value 0.0 selects base texture, value 1.0 corresponds to the first mip level, i.e., the first downsampled version of the texture, and so on. The value is clamped internally to between 0.0 and maximum mip level.

If you provide both texture coordinate derivatives and mip_level_bias, the latter is added to the mip level that that is calculated based on the texture coordinate derivatives, after which the result is clamped internally to between 0 and maximum mip level.