From b0db627cbf6b4f989eb8126e4a5b023fa21fdc6f Mon Sep 17 00:00:00 2001 From: Erik Onarheim Date: Thu, 18 Jan 2024 10:29:07 -0600 Subject: [PATCH] docs: Add premultiplication info --- site/docs/04-graphics/4.2-material.mdx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/site/docs/04-graphics/4.2-material.mdx b/site/docs/04-graphics/4.2-material.mdx index 4d1510da6..736386172 100644 --- a/site/docs/04-graphics/4.2-material.mdx +++ b/site/docs/04-graphics/4.2-material.mdx @@ -58,6 +58,16 @@ Excalibur only supports GLSL ES 300 shaders `#version 300 es`, this version decl ::: +:::warning + +Excalibur deals in pre-multiplied alphas! This means your shader transparency might not be what you expect. + +Generally this can be solved by adding `fragColor.rgb = fragColor.rgb * fragColor.a;` or similar to your code. + +Check out [this great post](https://www.realtimerendering.com/blog/gpus-prefer-premultiplication/) about premultiplied alphas + +::: + Once a [[Material|material]] is created it can be added/removed from the [[Actor|actor's]] [[GraphicsComponent|graphics component]] by accessing the [[GraphicsComponent.material]] property. ## Passing parameters to Materials