public static int CalculateMipmapLvls(int width, int height) { return (int)System.Math.Log(width > height ? width : height, 2) + 1; }