I have been attempting to implement a custom shader in Three.js, following various examples, but I am encountering issues. Below is the code snippet I have been working with:
var vertex = "void main(){vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );gl_Position = projectionMatrix * mvPosition;}";
var fragment = "precision highp float;void main(void){gl_FragColor = vec4(0.0,1.0,0.0,1.0);}";
material = new THREE.ShaderMaterial({
vertexShader: vertex,
fragmentShader: fragment
});
var mesh = new THREE.Mesh(geometry,material);
Despite my efforts, the result appears blank. Strangely enough, when I switch to using the following material:
material = new THREE.MeshBasicMaterial({ color: 0xff0000, wireframe: true });
Everything functions perfectly. What could be causing this discrepancy?