Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-245

Mipmap Level Choice

Problem

Choose the mipmap level for a texture given how many texels map to one pixel: level = max(0, floor(log2(texels_per_pixel))).

The signature is mipmap_level(texels_per_pixel). Return an integer.

Hint

Minification needs blurrier mip levels to avoid aliasing.

Test cases

case 1
in: [4]
expected: 2
case 2
in: [1]
expected: 0
case 3
in: [8]
expected: 3
case 4
in: [0.5]
expected: 0
Starter codePython
import math
def mipmap_level(texels_per_pixel):
    # Your code here
    pass

4 test cases · run your code against them in the editor