Hi,
I’ve been writing a few custom shaders and augmenting existing ones, and I can’t quite get my head around how you are supposed to use other parameters than the ones specified by phong-material.
There’s no problem setting a parameter with a custom name and using it inside a shader. The problem is that if any code anywhere calls material.update(), any custom parameters get flushed by this:
this.clearParameters();
Is there a workaround to make sure that custom parameters are persisted? I can’t rely on the order of script execution to make sure that nothing calls material.update() later in the same frame once I’ve updated my custom parameters.
Otherwise I’ll have to resort to either changing the source and remember to apply my alterations every time you update it, or to extend for example clearParameters() to trigger an event or such to inform other parts of the code that a material has wiped it’s parameters.