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

Skip to content

Commit 8843f33

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 72359e2 commit 8843f33

21 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

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

fr/08_Charger_des_modèles.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ Nous n'allons pas utiliser de lumières pour l'instant. Il est donc préférable
4141
ombres pour que nous ayons un rendu plus intéressant. Vous pouvez trouver de tels modèles sur
4242
[Sketchfab](https://sketchfab.com/).
4343

44-
Pour ce tutoriel j'ai choisi d'utiliser le [Chalet Hippolyte Chassande Baroz](https://skfb.ly/HDVU) créé par Escadrone.
44+
Pour ce tutoriel j'ai choisi d'utiliser le [Viking room](https://sketchfab.com/3d-models/viking-room-a49f1b8e4f5c4ecf9e1fe7d81915ad38) créé par [nigelgoh](https://sketchfab.com/nigelgoh) ([CC BY 4.0](https://web.archive.org/web/20200428202538/https://sketchfab.com/3d-models/viking-room-a49f1b8e4f5c4ecf9e1fe7d81915ad38)).
4545
J'en ai changé la taille et l'orientation pour l'utiliser comme remplacement de notre géométrie actuelle :
4646

47-
* [chalet.obj](/resources/chalet.obj.zip)
48-
* [chalet.jpg](/resources/chalet.jpg)
47+
* [viking_room.obj](/resources/viking_room.obj)
48+
* [viking_room.png](/resources/viking_room.png)
4949

5050
Il possède un demi-million de triangles, ce qui fera un bon test pour notre application. Vous pouvez utiliser un
5151
autre modèle si vous le désirez, mais assurez-vous qu'il ne comprend qu'un seul matériau et que ses dimensions sont
@@ -58,8 +58,8 @@ Ajoutez deux variables de configuration pour la localisation du modèle et de la
5858
const uint32_t WIDTH = 800;
5959
const uint32_t HEIGHT = 600;
6060

61-
const std::string MODEL_PATH = "models/chalet.obj";
62-
const std::string TEXTURE_PATH = "textures/chalet.jpg";
61+
const std::string MODEL_PATH = "models/viking_room.obj";
62+
const std::string TEXTURE_PATH = "textures/viking_room.png";
6363
```
6464

6565
Changez la fonction `createTextureImage` pour qu'elle utilise cette seconde constante pour charger la texture.

fr/09_Générer_des_mipmaps.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ createImage(texWidth, texHeight, mipLevels, VK_FORMAT_R8G8B8A8_SRGB, VK_IMAGE_TI
107107
```
108108

109109
Comme pour les autres opérations sur les images, la commande `vkCmdBlitImage` dépend de l'organisation de l'image sur
110-
laquelle elle opère. Nous pourrions transitionner l'image vers `VK_IMAGE_LAYOUT_GENERAL`, mais les opérations
110+
laquelle elle opère. Nous pourrions transitionner l'image vers `VK_IMAGE_LAYOUT_GENERAL`, mais les opérations
111111
prendraient beaucoup de temps. En fait il est possible de transitionner les niveaux de mipmaps indépendemment les uns
112112
des autres. Nous pouvons donc mettre l'image initiale à `VK_IMAGE_LAYOUT_TRANSFER_SCR_OPTIMAL` et la chaîne de mipmaps
113113
à `VK_IMAGE_LAYOUT_DST_OPTIMAL`. Nous pourrons réaliser les transitions à la fin de chaque opération.
@@ -132,7 +132,7 @@ Nous allons maintenant écrire la fonction qui génèrera les mipmaps.
132132
```c++
133133
void generateMipmaps(VkImage image, int32_t texWidth, int32_t texHeight, uint32_t mipLevels) {
134134
VkCommandBuffer commandBuffer = beginSingleTimeCommands();
135-
135+
136136
VkImageMemoryBarrier barrier{};
137137
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
138138
barrier.image = image;
@@ -142,7 +142,7 @@ void generateMipmaps(VkImage image, int32_t texWidth, int32_t texHeight, uint32_
142142
barrier.subresourceRange.baseArrayLayer = 0;
143143
barrier.subresourceRange.layerCount = 1;
144144
barrier.subresourceRange.levelCount = 1;
145-
145+
146146
endSingleTimeCommands(commandBuffer);
147147
}
148148
```
@@ -391,7 +391,7 @@ différences.
391391

392392
![](/images/mipmaps_comparison.png)
393393

394-
La différence la plus évidente est le texte sur le paneau, plus lisse avec les mipmaps.
394+
La différence la plus évidente est l'écriture sur le paneau, plus lisse avec les mipmaps.
395395

396396
Vous pouvez modifier les paramètres du sampler pour voir l'impact sur le rendu. Par exemple vous pouvez empêcher le
397397
sampler d'utiliser le plus haut nivau de mipmap en ne lui indiquant pas le niveau le plus bas :
@@ -406,4 +406,4 @@ Ce paramètre produira ce rendu :
406406

407407
[Code C++](/code/28_mipmapping.cpp) /
408408
[Vertex shader](/code/26_shader_depth.vert) /
409-
[Fragment shader](/code/26_shader_depth.frag)
409+
[Fragment shader](/code/26_shader_depth.frag)

fr/10_Multisampling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ Lançez votre programme et vous devriez voir ceci :
262262
![](/images/multisampling.png)
263263

264264
Comme pour le mipmapping, la différence n'est pas forcément visible immédiatement. En y regardant de plus près, vous
265-
pouvez normalement voir que, par exemple, les bords du toit sont beaucoup plus lisses qu'avant.
265+
pouvez normalement voir que, par exemple, les bords sont beaucoup plus lisses qu'avant.
266266

267267
![](/images/multisampling_comparison.png)
268268

@@ -302,7 +302,7 @@ amélioration de la qualité du rendu :
302302

303303
## Conclusion
304304

305-
Il nous a fallu beaucoup de travail pour en arriver là, mais vous avez maintenant une bonne connaissances des bases de
305+
Il nous a fallu beaucoup de travail pour en arriver là, mais vous avez maintenant une bonne connaissances des bases de
306306
Vulkan. Ces connaissances vous permettent maintenant d'explorer d'autres fonctionnalités, comme :
307307

308308
* Push constants

images/drawing_model.png

-44.5 KB
Loading

0 commit comments

Comments
 (0)