0

I'm trying to apply a texture of a little window repeated to the buildings I get from the example code:

https://maptalks.org/maptalks.three/demo/vectortilelayer-mvt.html

What I would like to do is to have one window (png 64x64) repeated in the buildings sides

I'm trying to put this texture:

texture.offset.set(0,0);
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(1,1);

var buildMaterial = new THREE.MeshPhongMaterial( { map: texture });

The problem is the texture is applied wrong in some buildings like stretch and all the windows are not the same for all the buildings that's the thing I would like to achieve.

I know the buildings mesh tile are made with a THREE.BufferGeometry of several buildings (extracted from the feature of the geojson data) and then created a Mesh with that BufferGeometry and then apply the material.

On the attached image you can see with red the wrong texture mapping and green what I would like to see.

Image of the texture mapping issues

Hope you can help me with this! Or maybe you know a code of getting the buildings with texture with maptalks.

  • You need to re-map the UVs of your buildings. [See here for an example](https://stackoverflow.com/questions/61783828/json-3d-model-only-using-1-pixel-of-a-texture/61784717#61784717) of how to perform accurate UV mapping. I don't think the library you're using lets you do this fine-tuned UV mapping, since the buildings are procedurally generated, but maybe you should [raise this issue on their Github](https://github.com/maptalks/maptalks.js/issues). – M - May 21 '20 at 18:44
  • yes, buildings are "procedurally generated" based on the geojson data and I know it's a difficult UV mapping. Many thanks for your comment and help! – sl252020 May 22 '20 at 02:49

0 Answers0