Question: texture for extruded shape geometry

Hello, I’m doing some shape extrusions that are using a material with an aoMap associated texture.
In order to get the right visualization, I have to set the texture.repeat values as stated in the comment below:

// it's necessary to apply these settings in order to correctly display the texture on a shape geometry
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set( 0.008, 0.008 );

found in the Three.js webgl_geometry_shapes.html example

Setting this values everything works fine.
Can anyone explain the reason for such a value?
I did not find any explanation in the official documentation.


ShapeGeometry uses vertex position values in order to generate uv data (see here). This means the texture coordinates of ShapeGeometry exceed the usual range of [0,1]. Without scaling you won’t get proper results.

Yeah, that’s surprising for users.
What’s the reason of such an approach and its advantage?
Why not use something like that under the hood of THREE.ShapeGeometry():

Um, maybe the original author could not think of a better approach^^. TBH, I don’t know.

Yeah, I think this could work. But keep in mind that it’s a breaking change. Users will have to adjust their code if they are going to upgrade the lib. If @mrdoob think it’s worth, you can create a PR with the change. I’m open for it :+1:

1 Like