I believe I have something working now!
I added a “customAttributes” flag to the pc.StandardMaterial
options, like so:
var material = new pc.StandardMaterial();
material.onUpdateShader = function (options) {
options.useInstancing = true;
options.customAttributes = true;
return options;
};
And then I monkey patched the createShaderDefinition
function to add extra attributes:
var origFunc = pc.programlib.standard.createShaderDefinition;
pc.programlib.standard.createShaderDefinition = function createShaderDefinition(device, options) {
var result = origFunc.apply(this, [device, options]);
if (options.customAttributes) {
result.attributes['MY_CUSTOM_ATTRIBUTE_1'] = pc.SEMANTIC_TEXCOORD6;
result.attributes['MY_CUSTOM_ATTRIBUTE_2'] = pc.SEMANTIC_ATTR2;
...
result.attributes['MY_CUSTOM_ATTRIBUTE_5'] = pc.SEMANTIC_ATTR5;
}
return result;
}
This may be similar to what was suggested in this post: Custom vertex attributes in chunk
I’d love to hear back if there is a better way to do this, but I think we’re unblocked for now. Thanks for the help and suggestions, everyone.