I've spent quite some time browsing the internet but haven't found the right solution yet. I came across a list of uniform types used by THREE.js and believe the code below should be accurate. I'm defining a uniform array of Vector2 at the last line.
uniforms: {
"center": { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) },
"aspectRatio": { type: "f", value: null },
"radius": { type: "f", value: 0.1 },
"pointList": { type: "v2v", value: [] },
},
In my JavaScript script, I pass this array as shown below. I believe this should also work:
// Add effects
effect = new THREE.ShaderPass( THREE.MetaBalls2D );
effect.renderToScreen = true;
effect.uniforms[ 'aspectRatio' ].value = window.innerWidth/window.innerHeight;
effect.uniforms[ 'pointList' ].value = pointList //is an array of THREE.Vector2;
composer.addPass( effect );
Now my question is, how can I retrieve this uniform variable (pointList in this case) from the fragmentshader?