TSL update uniform

Hi,

when writing a shader and using uniforms, how to update the uniform´s value so the shader gets the updated value.

        const blue = uniform( 0.0 );

        const paintSome= Fn(() => {

          const attenuation = vec4(1.0, 1.0, blue.value, 1.0).toVar();          
          const finalColor = vec4(1.0).toVar();
          return finalColor.mulAssign(attenuation);   

        })()

        this.material.colorNode = paintSome;

The problem is - that when I initialize the program, attenuation gets the correct blue.value from const blue. If I later update blue´s value - the shader does not recognize the uniform´s update.

Try to use blue (without .value).

1 Like

banging my head …it works

1 Like