How to blending color in buffer geometry

Please I need to color each face with differenr color without blending color using buffer geometry .

const colors = [];

// Set the color for each vertex
for (let i = 0; i < 201; i++) {
  for (let j = 0; j < 13; j++) {
    // Set the color for each vertex based on the face index
    if (i <201 && j <2) {
      colors.push(1, 0, 0); // color the first face as red
    } 
else if (i <201 && j>10) {
      colors.push(1, 0, 0); // color the first face as red
    }
 else  {
       const color = new THREE.Color('gray'); // Red color for example

  // Push the color values to the colors array
  colors.push(color.r, color.g, color.b);
    }
  }
}

I want to be like this:
this one

if the BufferGeometry is indexed it will always cause blending between neighbouring vertex colors, you should be able to use BufferGeometry.toNonIndexed() to ensure each face has sharp colors and prevents blending…

1 Like