Skip to content

Commit

Permalink
docs: Add links to materials <-> postprocessors
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Aug 5, 2024
1 parent 2e4341f commit 004e96f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions site/docs/04-graphics/4.2-material.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ declare const game: ex.Engine;

Sometimes you need even more control about how your graphics render in your game! For example you might want a custom blend, a reflection effect, or a warping effect. With this api you can provide custom shaders to graphics.

If you want to apply a shader to the whole screen check out [PostProcessors](/docs/postprocessors)

:::warning

Materials are only supported in WebGL mode, this is the default mode for Excalibur but if you switch or fallback to 2D Canvas materials will not have an effect.

:::


## Creating Materials

We recommend using the [[ExcaliburGraphicsContext.createMaterial]] method to create materials.
Expand Down
10 changes: 9 additions & 1 deletion site/docs/12-other/12-post-processors/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ section: Graphics

[[PostProcessor|PostProcessors]] are a way to quickly modify every pixel on the screen with WebGL fragment shaders. This can be useful to give your game a certain aesthetic or effect.

:::warning

PostProcessors are only supported in WebGL mode, this is the default mode for Excalibur but if you switch or fallback to 2D Canvas materials will not have an effect.

:::

If you want to do per actor shaders check out [Materials](/docs/materials)

## Color Blindness

Choosing colors that are friendly to players with color blindness is an important consideration when making a game.
Expand Down Expand Up @@ -66,7 +74,7 @@ Post processors can also be use to produce some interesting custom effects.
There is a helper class [[ScreenShader]] to help build shaders for post processing. The only things that come predefined are the:

1. `v_texcoord` representing the current UV from [0, 1]
2. `u_texture` which is the texture representing the screen pixels
2. `u_image` which is the texture representing the screen pixels

In this example we can make the entire game gray scale:

Expand Down

0 comments on commit 004e96f

Please sign in to comment.