I am facing a challenge with applying a shader to a single face Mesh in Three.js.
Upon applying the shader material to the mesh, it seems to only read a single pixel of the shader and apply that value to the entire face. I have tested this using the following example:
A single face mesh has been included in each shader example, and the issue persists across all examples.
// defining the geometry (after BoxGeometry in the example)
let triangleGeometry = new THREE.Geometry();
triangleGeometry.vertices.push(new THREE.Vector3( 0.0, 1.0, 0.0 ));
triangleGeometry.vertices.push(new THREE.Vector3( -1.0, -1.0, 0.0 ));
triangleGeometry.vertices.push(new THREE.Vector3( 1.0, -1.0, 0.0 ));
triangleGeometry.faces.push(new THREE.Face3( 0, 1, 2 ));
// defining the mesh (after box mesh in the example)
let triangleMesh = new THREE.Mesh( triangleGeometry, material );
triangleMesh.position.x = i - ( params.length - 1 ) / 2;
triangleMesh.position.y = i % 2 - 0.5;
scene.add( triangleMesh );
https://i.sstatic.net/jofVa.png
Despite trying this on multiple examples, the issue persists. I am curious about what I might be overlooking.