Macro-Based Shader Lighting?

It looks like what I was trying to reach for here is something that does exist today! You can pass a chunks object to a StandardMaterial to override any default shader chunks:

https://developer.playcanvas.com/en/api/pc.StandardMaterial.html#chunks

This project has an example using it: Warp a Sprite with GLSL | Learn PlayCanvas

This is exactly what I was looking for and it means you could do such a toon lighting as I describe in the top post here, without having to write a complete custom shader, and it’ll automatically work for any number of lights/with any other supported light effects like fog etc.

2 Likes