I am trying to create a dynamic ShaderMaterial that allows both the fragment shader source and the set of uniforms to be modified at runtime. Defining the uniforms in the constructor works correctly, but I have not been able to update the uniform list dynamically after instantiation.
Working demo (click on the sphere) : A ShaderMaterial where uniforms declared in the constructor update correctly when the shader is recompiled.
However, the next playground shows the issue: when the uniforms are not declared in the constructor, I cannot add them later at runtime:
Broken demo: A ShaderMaterial whose fragment code updates, but where dynamically adding uniforms fails.
I attempted the following:
this.options.uniforms = ['worldViewProjection', 'plane'];
and:
this.getEffect().uniforms = ['worldViewProjection', 'plane'];
prior to recompilation, but neither approach succeeded.
Is there a supported way to update uniforms dynamically?
