Skip to content

Commit 44e228d

Browse files
committed
tracking 7.7; culling note
1 parent 2f2b685 commit 44e228d

File tree

1 file changed

+8
-1
lines changed
  • articles/tutorials/advanced/2d_shaders/07_sprite_vertex_effect

1 file changed

+8
-1
lines changed

articles/tutorials/advanced/2d_shaders/07_sprite_vertex_effect/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Then you will not see much movement at all. This is because the `DebugOffset` va
215215

216216
The world-space vertices can have their `x` and `y` values modified in the vertex shader, but what about the `z` component? The orthographic projection essentially _ignores_ the `z` component of a vertex and treats all vertices as though they are an equal distance away from the camera. If you change the `z` value, you may _expect_ the sprite to appear closer or further away from the camera, but the orthographic projection matrix does not do that.
217217

218-
To check, try modify the shader code to adjust the `z` value based on one of the debug values:
218+
To check, try to modify the shader code to adjust the `z` value based on one of the debug values:
219219

220220
[!code-hlsl[](./snippets/snippet-7-21.hlsl?highlight=7)]
221221

@@ -268,6 +268,12 @@ And voilà, the text no longer disappears on its flip side.
268268
| :------------------------------------------------------------------: |
269269
| **Figure 7-9: A spinning text with reverse sides** |
270270

271+
> [!note]
272+
> What is _Culling_?
273+
>
274+
> The term, "Culling", is used to describe a scenario when some triangles are not drawn due to some sort of optimization. There are many _types_ of culling, but in this case, we are discussing a specific type of optimization called "Back-face Culling". Learn more about it on [wikipedia](https://en.wikipedia.org/wiki/Back-face_culling).
275+
276+
271277
You may find that the field of view is too high for your taste. Try lowering the field of view to 60, and you'll see something similar to this,
272278

273279
| ![Figure 7-10: A spinning text with reverse sides with smaller fov](./gifs/spin-3.gif) |
@@ -293,6 +299,7 @@ And instead of manually controlling the spin angle, we can make the title spin g
293299
## Applying it to the Game
294300

295301
It was helpful to use the `TitleScene` to build intuition for the vertex shader, but now it is time to apply the perspective vertex shader to the game itself to add immersion and a sense of depth to the gameplay. The goal is to use the same effect in the `GameScene`.
302+
296303
### The Uber Shader
297304

298305
A problem emerges right away. The `GameScene` is already using the color swapping effect to draw the sprites, and `SpriteBatch` can only use a single per batch.

0 commit comments

Comments
 (0)