Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 889c9fd

Browse files
committed
Rewrite introduction
1 parent f32a534 commit 889c9fd

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

09_Generating_Mipmaps.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
## Introduction
22
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.
33

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:
65

76
![](/images/mipmaps_example.jpg)
87

9-
108
## Image creation
119

1210
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

Comments
 (0)