I don’t know if there’s a more standard name for this, but this is a feature that would be very useful for what I’m trying to do, and I wanted to get some feedback to see if other people would find a need for this or if this sounds too niche.
Say you’re trying to make a slightly modified lighting effect, like this toon shader by @dave https://playcanvas.com/project/355024/overview/example-toon-shading
To do this, you have to write your own shader. But that means you have to give up or rewrite a lot of functionality that PlayCanvas’ built in shaders handle for you, such as setting up all the light sources and passing them to the shader.
In the example project above,the light source is grabbed by name in
toon.js and passed to the shader. Adding more lights, or different kinds of lights, would involve rewriting a lot more functionality from the PlayCanvas standard material.
What if there was an option to pass a shader chunk/snippet to be included at the end of any material’s final shader? That way you could keep all the functionality already there, but only tweak/override what you need.
A robust implementation might be similar to Unity’s surface shader idea, where you define custom lighting functions and it generates the full vertex/frag shader with your function embedded in.