Hi there,
I tried to rebuild the MeshMatcapMaterial with a custom shader.
Here was the model I started with: three.js/meshmatcap_frag.glsl.js at dev · mrdoob/three.js · GitHub
My code is here:
var customUniforms = THREE.UniformsUtils.merge([
THREE.ShaderLib.matcap.uniforms,
{ map: { value: matcap } },
{ diffuse: { value: new THREE.Color( 0xFF0000 ) } },
{ opacity: { value: 0.5 } }
]);
// material
material = new THREE.ShaderMaterial( {
vertexShader: THREE.ShaderLib.matcap.vertexShader,
fragmentShader: THREE.ShaderLib.matcap.fragmentShader,
uniforms: customUniforms,
transparent: true,
flatShading: false
} );
material.defines['USE_MATCAP'] = true;
object = new THREE.Mesh( geometry, material );
So I created a ShaderMaterial using the vertex shader and fragment shader from THREE.ShaderLib and
I also added a customUniforms including the matcap texture.
… But the object stays black, even if the matcap works on an other 3D object without this custom shader.
Could anyone help? Thanks in advance!
Have a nice day
Minh