2D effects using shaders


Searching for advice on how to apply effects/shaders when using PlayCanvas for 2D rendering.

If I have a character rendered as a simple 3D plane with a diffuse and opacity map:

How I can apply one of the following effects but only to the character? Not a fullscreen effect.

Applying a pixel shader for example using the diffuseChunk will animate the applied texture but only inside the non transparent rendered pixels (yellow border). Check this:

Do I have to utilize a vertex shader? I believe even with a tessalated plane quality will be bad.

Any ideas? It seems simple but I feel stuck :slight_smile:

I think I found the answer, just had to write a custom shader from scratch and not use PlayCanvas shader chunks. That way I can handle UVs and transparency all in one shader.

Does this help:


1 Like

Ah, very interesting! Yes, I see now which chunks to use exactly. Thanks @will

1 Like