Changing these snippets in the library code:
var color_fragment = "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif";
var color_pars_fragment = "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif";
var color_pars_vertex = "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif";
var color_vertex = "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
....
gl.vertexAttribPointer( programAttribute, 3, type, false, 12, 0 );
....
' attribute vec3 instanceColor;',
' attribute vec3 color;',
to
var color_fragment = "#ifdef USE_COLOR\n\tdiffuseColor *= vColor;\n#endif";
var color_pars_fragment = "#ifdef USE_COLOR\n\tvarying vec4 vColor;\n#endif";
var color_pars_vertex = "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec4 vColor;\n#endif";
var color_vertex = "#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor *= instanceColor;\n#endif";
....
gl.vertexAttribPointer( programAttribute, 4, type, false, 16, 0 );
....
' attribute vec4 instanceColor;',
' attribute vec4 color;',
makes it possible to use per vertex transparency in meshes (where vertexColor is used) and also apply opacity per instance in instanced meshes.
I havenāt checked all materials but there is an example of instanced and simple mesh:
https://jsfiddle.net/tfoller/kyam29g5/12/
With the abovementioned changes made, this is how to provide full color for instanced geometry:
mat.transparent = true;
stars.instanceColor = new THREE.BufferAttribute(new Float32Array(color), 4);
and for normal geometry:
geo2.setAttribute('color', new THREE.Float32BufferAttribute(color2, 4));
mat2.vertexColors = true;