I'm trying to render a model created by SnappyTree/Proctree ( http://www.snappytree.com/ ).
I found this question, that showed how to render the trunk geometry using Three.js instead of proctree.js's author's GLGE project. I've got that working now but the texture on the twigs (branches) doesn't align properly. Any ideas how to make the texture fit on?
This is how the material is created:
// Load texture from data URI in js fiddle
var twigTexture = getTexture('branch');
// Scaling the texture seems to help
twigTexture.wrapS = THREE.RepeatWrapping;
twigTexture.wrapT = THREE.RepeatWrapping;
twigTexture.repeat.set( 1/2.5, 1/2.5 );
// immediately use the texture for material creation
var twigMaterial = new THREE.MeshLambertMaterial({
map: twigTexture,
transparent: true,
side: THREE.DoubleSide
});
This is how it renders:
With a solid color, it's clear that the branch vertices/faces are in the correct places:
Each branch should look like the texture image:
faceVertexUvs
are not correct for the branches. I would expect the branch uv coords to be 0 or 1, only. – WestLangley