You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 09_Generating_Mipmaps.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,10 @@
1
1
## Introduction
2
2
Our program can now load and render 3D models. In this chapter, we will add one more feature, mipmap generation. Mipmaps are widely used in games and rendering software, and Vulkan gives us complete control over how they are created.
3
3
4
-
Mipmaps are precalculated, downscaled versions of an image. Each new image is half the width and height of the previous one. The smaller images are used when an object is far away from the camera. Since the smaller images use less memory, they are faster to sample from. Since they are precalculated, using them avoids artifacts such as [Moiré patterns](https://en.wikipedia.org/wiki/Moir%C3%A9_pattern). An example of what mip maps look like:
5
-
4
+
Mipmaps are precalculated, downscaled versions of an image. Each new image is half the width and height of the previous one. Mip maps are used as a form of *Level of Detail.* Objects that are far away from the camera will sample their textures from the smaller mip images. Using smaller images increases the rendering speed and avoids artifacts such as [Moiré patterns](https://en.wikipedia.org/wiki/Moir%C3%A9_pattern). An example of what mip maps look like:
6
5
7
6

8
7
9
-
10
8
## Image creation
11
9
12
10
In Vulkan, each of the mip images is stored in different *mip levels* of a `VkImage`. Mip level 0 is the original image, and each mip level after that is half the size of previous level. The number of mip levels is specified when the `VkImage` is created. Up until now, we have always set this value to one. In `createTextureImage`, we need to calculate the number of mip levels from the dimensions of the image. First, add a class member to store this number:
0 commit comments