Image for Texture is deformed by the shape of ExtrudeShape-Mesh

Hello, I spent much too long for trying to solve the following on my own and I’m in despair:

A from the BabylonJS-Tutorial known image shall be used as a texture for an ExtrudeShape-Mesh but the result is a deformation, that follows the underlying shape of the mesh:


I use the obvious code for this task:

cap = BABYLON.MeshBuilder.ExtrudeShape(“capExtruded”, { shape: contour,
path: path, sideOrientation: BABYLON.Mesh.DOUBLESIDE, updatable: true, cap: BABYLON.Mesh.C AP_ALL }, scene);

let capMaterial = new BABYLON.BackgroundMaterial(“capMaterial”, scene);
cap.material = capMaterial;

capMaterial_Texture = new BABYLON.Texture('any-picture.jpg`), scene);
cap.material.diffuseTexture = capMaterial_Texture;

Anybody similar experiences and is there a work-around?

Hopeful greetings, Paul.

Hi @Paul_Middendorf and welcome. Caps have problems with texture if contour is concave. Try extrude polygon Create Parametric Shapes - Babylon.js Documentation instead.


Ups, I haven’t checked that possibility :roll_eyes:
Thank you very much, the texture isn’t deformed anymore:

Screenshot (5)

1 Like