-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed
Description
Description
This problem isn't new. It's been around for a long time.
When adding a texture to the stroke generated by SVGLoader.pointsToStroke, the resulting UV mapping is incorrect for straight parts and the last triangle.
The UV mapping for a Bezier curve look really good except at the end

The UV mapping for a straight line doesn't look good at all

The UV mapping for a curved lines looks good for the bends, but not for the straight lines

Reproduction steps
set stroke style
pass points into SVGLoader.pointsToStroke to get geometry
assign texture to material
add mesh to scene
Code
const style = SVGLoader.getStrokeStyle(0.12, "black", "miter", "butt");
const texture = new TextureLoader().load("./src/road.png");
const geometry = SVGLoader.pointsToStroke(
straightpoints.map((v) => new Vector2(v.x, v.y)),
style
);
const material = new MeshBasicMaterial({ map: texture });
const rect = new Mesh(geometry, material);
scene.add(rect);
rect.position.x = 0.2;Live example
https://codesandbox.io/p/sandbox/three-stroke-texture-uv-h9w76x?file=%2Fsrc%2Findex.js
Screenshots
Version
160
Device
Desktop
Browser
Edge
OS
Windows