Skip to content

Commit 90aa269

Browse files
committed
Replace example 3D model with permissively licensed one
The existing model had a permissive license at the time this tutorial was written, but the artist has since started selling the model so I've decided to switch to a different one to respect their wishes.
1 parent 8ce6698 commit 90aa269

25 files changed

Lines changed: 16083 additions & 31 deletions

code/27_model_loading.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
const uint32_t WIDTH = 800;
3232
const uint32_t HEIGHT = 600;
3333

34-
const std::string MODEL_PATH = "models/chalet.obj";
35-
const std::string TEXTURE_PATH = "textures/chalet.jpg";
34+
const std::string MODEL_PATH = "models/viking_room.obj";
35+
const std::string TEXTURE_PATH = "textures/viking_room.png";
3636

3737
const int MAX_FRAMES_IN_FLIGHT = 2;
3838

code/28_mipmapping.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
const uint32_t WIDTH = 800;
3232
const uint32_t HEIGHT = 600;
3333

34-
const std::string MODEL_PATH = "models/chalet.obj";
35-
const std::string TEXTURE_PATH = "textures/chalet.jpg";
34+
const std::string MODEL_PATH = "models/viking_room.obj";
35+
const std::string TEXTURE_PATH = "textures/viking_room.png";
3636

3737
const int MAX_FRAMES_IN_FLIGHT = 2;
3838

code/29_multisampling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
const uint32_t WIDTH = 800;
3232
const uint32_t HEIGHT = 600;
3333

34-
const std::string MODEL_PATH = "models/chalet.obj";
35-
const std::string TEXTURE_PATH = "textures/chalet.jpg";
34+
const std::string MODEL_PATH = "models/viking_room.obj";
35+
const std::string TEXTURE_PATH = "textures/viking_room.png";
3636

3737
const int MAX_FRAMES_IN_FLIGHT = 2;
3838

ebook/Vulkan Tutorial en.epub

-437 KB
Binary file not shown.

ebook/Vulkan Tutorial en.pdf

-535 KB
Binary file not shown.

ebook/Vulkan Tutorial fr.epub

-437 KB
Binary file not shown.

ebook/Vulkan Tutorial fr.pdf

-535 KB
Binary file not shown.

en/08_Loading_models.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ model that has lighting baked into the texture. An easy way to find such models
4848
is to look for 3D scans on [Sketchfab](https://sketchfab.com/). Many of the
4949
models on that site are available in OBJ format with a permissive license.
5050

51-
For this tutorial I've decided to go with the [Chalet Hippolyte Chassande Baroz](https://skfb.ly/HDVU)
52-
model by Escadrone. I tweaked the size and orientation of the model to use it
51+
For this tutorial I've decided to go with the [Viking room](https://sketchfab.com/3d-models/viking-room-a49f1b8e4f5c4ecf9e1fe7d81915ad38)
52+
model by [nigelgoh](https://sketchfab.com/nigelgoh) ([CC BY 4.0](https://web.archive.org/web/20200428202538/https://sketchfab.com/3d-models/viking-room-a49f1b8e4f5c4ecf9e1fe7d81915ad38)). I tweaked the size and orientation of the model to use it
5353
as a drop in replacement for the current geometry:
5454

55-
* [chalet.obj](/resources/chalet.obj.zip)
56-
* [chalet.jpg](/resources/chalet.jpg)
55+
* [viking_room.obj](/resources/viking_room.obj)
56+
* [viking_room.png](/resources/viking_room.png)
5757

58-
It has half a million triangles, so it's a nice benchmark for our application.
5958
Feel free to use your own model, but make sure that it only consists of one
6059
material and that is has dimensions of about 1.5 x 1.5 x 1.5 units. If it is
6160
larger than that, then you'll have to change the view matrix. Put the model file
@@ -69,8 +68,8 @@ texture paths:
6968
const uint32_t WIDTH = 800;
7069
const uint32_t HEIGHT = 600;
7170

72-
const std::string MODEL_PATH = "models/chalet.obj";
73-
const std::string TEXTURE_PATH = "textures/chalet.jpg";
71+
const std::string MODEL_PATH = "models/viking_room.obj";
72+
const std::string TEXTURE_PATH = "textures/viking_room.png";
7473
```
7574

7675
And update `createTextureImage` to use this path variable:

en/09_Generating_Mipmaps.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
## Introduction
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.
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.
33

44
Mipmaps are precalculated, downscaled versions of an image. Each new image is half the width and height of the previous one. Mipmaps are used as a form of *Level of Detail* or *LOD.* 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 mipmaps look like:
55

66
![](/images/mipmaps_example.jpg)
77

88
## Image creation
99

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 the mip levels after level 0 are commonly referred to as the *mip chain.*
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 the mip levels after level 0 are commonly referred to as the *mip chain.*
1111

1212
The number of mip levels is specified when the `VkImage` is created. Up until now, we have always set this value to one. We need to calculate the number of mip levels from the dimensions of the image. First, add a class member to store this number:
1313

@@ -105,7 +105,7 @@ We're now going to write the function that generates the mipmaps:
105105
```c++
106106
void generateMipmaps(VkImage image, int32_t texWidth, int32_t texHeight, uint32_t mipLevels) {
107107
VkCommandBuffer commandBuffer = beginSingleTimeCommands();
108-
108+
109109
VkImageMemoryBarrier barrier{};
110110
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
111111
barrier.image = image;
@@ -115,7 +115,7 @@ void generateMipmaps(VkImage image, int32_t texWidth, int32_t texHeight, uint32_
115115
barrier.subresourceRange.baseArrayLayer = 0;
116116
barrier.subresourceRange.layerCount = 1;
117117
barrier.subresourceRange.levelCount = 1;
118-
118+
119119
endSingleTimeCommands(commandBuffer);
120120
}
121121
```
@@ -331,7 +331,7 @@ It's not a dramatic difference, since our scene is so simple. There are subtle d
331331

332332
![](/images/mipmaps_comparison.png)
333333

334-
The most noticeable difference is the writing on the signs. With mipmaps, the writing has been smoothed. Without mipmaps, the writing has harsh edges and gaps from Moiré artifacts.
334+
The most noticeable difference is the writing on the papers. With mipmaps, the writing has been smoothed. Without mipmaps, the writing has harsh edges and gaps from Moiré artifacts.
335335

336336
You can play around with the sampler settings to see how they affect mipmapping. For example, by changing `minLod`, you can force the sampler to not use the lowest mip levels:
337337

en/10_Multisampling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Now run your program and you should see the following:
232232

233233
![](/images/multisampling.png)
234234

235-
Just like with mipmapping, the difference may not be apparent straight away. On a closer look you'll notice that the edges on the roof are not as jagged anymore and the whole image seems a bit smoother compared to the original.
235+
Just like with mipmapping, the difference may not be apparent straight away. On a closer look you'll notice that the edges are not as jagged anymore and the whole image seems a bit smoother compared to the original.
236236

237237
![](/images/multisampling_comparison.png)
238238

0 commit comments

Comments
 (0)