[Solved] How can I update a shader variable?

I need to update shader variables in real time, but if I try the following I get a black screen:

 material.uniforms.enable = 0.0;   //<<<<<<<

 var material = new THREE.ShaderMaterial( {
 uniforms: { 
    		tL: { value: Ltexture.texture },
    		wres: { value: 1.0/w},
    		hres: { value: 1.0/h},
    		enable: { value: 1.0}	
    	vertexShader: vshader,
    	fragmentShader: ttscreen 
} );

Try it like so:

material.uniforms.enable.value = 0.0; 
1 Like

Any error messages in the browser console?

Is it a real sequence of lines? You set the value of a uniform before you have the object of the uniform.

Thanks @Mugen87, it works!

Hi prisoner849, no other problem, thanks.