PlaneGeometry with different materials + uv mapping

Hi all,

i currently want to split up a planegeometry in multiple textures and then do UV mapping for each of these textures. My original code was geometry.faceVertexUvs[0][ib] = uvs; However since r125 i can’t use this anymore but it doesn’t seem to work and i’m wondering whether this is due to the fact that geometries are indexed now? So what I want to do split the planegeometry into 4 different textures and now i want to rotate them individually with UV mapping… but I’m clueless

I tried:

  	var uv_map = [
  		new THREE.Vector2(0, 0), 
  		new THREE.Vector2(1, 0), 
  		new THREE.Vector2(1, 1), 
  		new THREE.Vector2(0, 1),
  	];
for (let index = 0; index < planegeometry.index.length; index+=6) {
		const a = planegeometry.index.getX(index)
		const b = planegeometry.index.getX(index+1)
		const d = planegeometry.index.getX(index+2)
		// shared vertice
		const b_ = planegeometry.index.getX(index+3)
		const c = planegeometry.index.getX(index+4)
		// shared vertice
		const d_ = planegeometry.index.getX(index+5)

		if(b != b_ && d_ != d) {
			console.log("@@ERRROR:",a,b,b_,c,d,d_)
		}
		

		const uvAttribute = planegeometry.getAttribute("uv");

		//a
		uvAttribute.setXY(index, uv_map[0].x, uv_map[0].y)
		//b
		uvAttribute.setXY(index+1, uv_map[1].x, uv_map[1].y)
		//d
		uvAttribute.setXY(index+2, uv_map[3].x, uv_map[3].y)
		//_b
		uvAttribute.setXY(index+3, uv_map[1].x, uv_map[1].y)
		//c
		uvAttribute.setXY(index+4, uv_map[2].x, uv_map[2].y)
		//_d
		uvAttribute.setXY(index+5, uv_map[3].x, uv_map[3].y)

}

https://codepen.io/kolarius/pen/MWEBPep

fyi: it is indeed not possible with indexed