I am struggling to figure out what I am doing wrong in this situation. My goal is to load a simple skybox, but I am not seeing any results. Most solutions I have found reference the THREE.ImageUtils.loadTextureCube
method which is now deprecated. I can't seem to locate any examples using the new THREE.CubeTextureLoader
.
It's worth noting that I am utilizing this in conjunction with the Three.js YouTube loader example available at:
var loader = new THREE.CubeTextureLoader();
textureArray = ['galaxy_starfield.png', 'galaxy_starfield1.png', 'galaxy_starfield2.png', 'galaxy_starfield3.png', 'galaxy_starfield4.png', 'galaxy_starfield5.png'];
loader.setPath('./img/');
var textureCube = loader.load([
'galaxy_starfield.png', 'galaxy_starfield1.png', 'galaxy_starfield2.png', 'galaxy_starfield3.png', 'galaxy_starfield4.png', 'galaxy_starfield5.png'
]);
var skyMaterial = new THREE.MeshBasicMaterial({
color: 0x444444,
map: new THREE.TextureLoader(textureArray),
opacity: 0,
transparent: true
});
var skyGeometry = new THREE.BoxGeometry(2000, 2000, 2000);
var skyMesh = new THREE.Mesh(skyGeometry, skyMaterial);
scene.add(skyMesh);
I'm unsure of where I went wrong. There are no visible errors (aside from one caused by ad blocker). Could there possibly be an issue with CubeTextureLoader?
All the references I've come across involve ImageUtils.loadTextureCube:
comparing methods of creating skybox material in three.js
Three.js skybox not loading completely or at all