Extruded Geometries

HI,
I have created a basic, rectangular shape to which I have created a rectangular hole and extruded as per the attached image.

Once textured, the top texture is being repeated 2x in width and 2x in length and despite adjusting the repeat I cannot make the texture fill the top with no repeat.

Does anyone have any information on how to texture the surfaces with no repeat?

Many thanks.

Shape created with

var newshape = new THREE.Shape();
    newshape.moveTo(-slength / 2, swidth / 2);
    newshape.lineTo(slength / 2, swidth / 2);
    newshape.lineTo(slength / 2, -swidth / 2);
    newshape.lineTo(-slength / 2, -swidth / 2);
    newshape.lineTo(-slength / 2, -swidth / 2);

Hole Created with

    var hole = new THREE.Path();
    hole.moveTo(-((slength / 2) - rborder), ((swidth / 2) - rearborder));
    hole.lineTo(((slength / 2) - lborder), ((swidth / 2) - rearborder));
    hole.lineTo(((slength / 2) - lborder), -((swidth / 2) - fborder));
    hole.lineTo(-((slength / 2) - rborder), -((swidth / 2) - fborder));
    newshape.holes = [hole];

Extrusion settings

var extrudeSettings = {
      depth: sdepth,
      steps: 1,
      material: 1,
    };

Ok, so I have worked out its a Uv generation issue and started building a custom UV generator to handle this.

So far I can get the rectangular shape with no hole to texture correctly.

and with hole to texture correctly on the bottom face

but I am getting something weird on the top face one corner. ( bottom left in the image )

Needs a little work to be 100% but looks close to what I require.

Generating your own UVs is a good solution.

For future reference though, there is also texture.repeat, texture.offset, and texture.rotation. Those can be used to adjust how textures are mapped/repeated/rotated.

1 Like

Many thanks for your reply!

I had tied repeat and offset, but with Extruded Geometry could not get the texture as required.

So changed for the THREE.ExtrudeGeometry UV Generator to a custom UV Generator to fix the issue.

1 Like