i'm trying to load 4 textures and use them as a blended dynamic texture.
what i get is a black terrain, seems i'm doing something wrong with the creation of the blended material...
var xS = 63, yS = 63;
terrainScene = THREE.Terrain({
easing: THREE.Terrain.Linear,
frequency: 2.5,
heightmap: THREE.Terrain.DiamondSquare,
material: blend,
maxHeight: 100,
minHeight: -100,
steps: 1,
useBufferGeometry: false,
xSegments: xS,
xSize: 1024,
ySegments: yS,
ySize: 1024,
});
// Assuming you already have your global scene, add the terrain to it
scene.add(terrainScene);
var t1 = new TextureLoader().load('textures/sand1.jpg');
var t2 = new TextureLoader().load('textures/grass1.jpg');
var t3 = new TextureLoader().load('textures/stone1.jpg');
var t4 = new TextureLoader().load('textures/snow1.jpg');
var blend = THREE.Terrain.generateBlendedMaterial([
{texture: t1},
// Start blending in at height -80; opaque between -35 and 20; blend out by 50
{texture: t2, levels: [-80, -35, 20, 50]},
{texture: t3, levels: [20, 50, 60, 85]},
// How quickly this texture is blended in depends on its x-position.
{texture: t4, glsl: '1.0 - smoothstep(65.0 + smoothstep(-256.0, 256.0, vPosition.x) * 10.0, 80.0, vPosition.z)'},
// Use this texture if the slope is between 27 and 45 degrees
{texture: t3, glsl: 'slope > 0.7853981633974483 ? 0.2 : 1.0 - smoothstep(0.47123889803846897, 0.7853981633974483, slope) + 0.2'},
]);
any help is appriciated.
tahnks.