We have a nice chunk system which allows us to create shaders, override some parts and etc.
But it could be even more powerful with custom attributes.
Currently, we have custom vertex attribute semantics such a pc.SEMANTIC_ATTR0-15, but we can’t set in into a shader’s definition for “standard” for instance.
We also have pc.shaderChunks.collectAttribs
which can detect custom attributes in code and add it before compiling process.
What do you think? If it’s okay for workflow, I would like to try to implement and make PR.
It’s pretty easy to achieve:
attributes = pc.extend(attributes, pc.shaderChunks.collectAttribs(vshader));
return {
attributes: attributes,
vshader: vshader,
fshader: fshader,
tag: pc.SHADERTAG_MATERIAL
};
Over there https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/standard.js#L1307