Per Object Uniforms

Hmm, I though this would set the uniform per object each frame:

mesh.onBeforeRender = function(renderer, scene, camera, geometry, material){
	
	if( this.userData.customUniforms ){				
		
		if( material.userData.shader ){		

			for( var name in this.userData.customUniforms ){
				
				material.userData.shader.uniforms[name].value = this.userData.customUniforms[name];															
			
			}
			
		}
		
	}
	
};

Am I misunderstanding this?

jsfiddle

While your plugin is super cool, I would like to have this working in “raw” three.js. I probably will wind up using your plugin though. It’s too bad onBeforeRender doesn’t just work out of the box without adding frame sync operations and such.