Skip to content

Commit 3cfce22

Browse files
committed
adding mgcb
1 parent 168f4aa commit 3cfce22

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
55.4 KB
Loading

articles/tutorials/advanced/2d_shaders/09_shadows_effect/index.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ In the sequence below, the left image is the just the `LightBuffer`. The middle
4545

4646
| The `LightBuffer` | The `ShadowBuffer` | The multiplication of the two images |
4747
| --------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------ |
48-
| ![Figure 9-4: a light buffer](./images/dbg_light_map.png) | ![Figure 9-3: A shadow map](./images/dbg_shadow_map.png) | ![Figure 9-5: The multiplication](./images/dbg_light_map_multiplied.png) |
48+
| ![Figure 9-4: a light buffer](./images/dbg_light_map.png) | ![Figure 9-3: A shadow map](./images/dbg_shadow_map.png) | ![Figure 9-4: The multiplication](./images/dbg_light_map_multiplied.png) |
4949

5050
The mystery to unpack is step 1, how to render the `ShadowBuffer` in the first place.
5151

@@ -68,9 +68,9 @@ However, the `SpriteBatch` usually only renders rectangular shapes. Naively, it
6868

6969
This diagram shows an abstract pixel being drawn at some position `P`. The corners of the pixel may be defined as `G`, `S`, `D`, and `F`.
7070

71-
| ![Figure 9-5: A diagram showing a pixel](./images/pixel_math.png) |
71+
| ![Figure 9-4: A diagram showing a pixel](./images/pixel_math.png) |
7272
| :---------------------------------------------------------------: |
73-
| **Figure 9-5: A diagram showing a pixel** |
73+
| **Figure 9-4: A diagram showing a pixel** |
7474

7575
Our goal is define a function that transforms the positions `S`, `D`, `F`, and `G` _into_ the positions, `A`, `a`, `b`, and `B`. The table below shows the desired mapping.
7676

@@ -149,6 +149,10 @@ Once all of the positions are mapped, our goal is complete! We have a vertex fun
149149

150150
To start implementing the effect, create a new Sprite Effect in the `MonoGameLibrary`'s common content effect folder called `shadowHullEffect.fx`. Load it into the `Core` class as before in the previous chapters.
151151

152+
| ![Figure 9-5: Create the `shadowHullEffect` in MGCB](./images/mgcb.png) |
153+
| :---------------------------------------------------------------------: |
154+
| **Figure 9-5: Create the `shadowHullEffect` in MGCB** |
155+
152156
Add it as a class member:
153157

154158
[!code-csharp[](./snippets/snippet-9-08.cs)]
@@ -332,7 +336,7 @@ And then in the pixel shader function, add this line to the top. The [`clip`](ht
332336

333337
[!code-hlsl[](./snippets/snippet-9-40.hlsl)]
334338

335-
Now the slime looks well lit and shadowed! Feel free to play with the size of the shadow caster as well as the exact points themselves.
339+
Now the slime looks well lit and shadowed! In the next section, we will line up the lights and shadows with the rest of the level.
336340

337341
| ![Figure 9-12: The slime is well lit](./images/shadow_map_hex_3.png) |
338342
| :------------------------------------------------------------------: |

0 commit comments

Comments
 (0)