更改背景
let scene = new THREE.Scene()
scene.background = new THREE.TextureLoader().load(image);
scene.background = new THREE.Color(color)
更改对象材质
// Create 1 material
var material = new THREE.MeshPhongMaterial();
let buildingObjs = [];
for (var i = 0; i < 2000; i++) {
var geometry = new THREE.BoxGeometry( 1, 1, 1 );
// Use that same material on 2000 meshes
var building = new THREE.Mesh( geometry, material );
buildingObjs.push(building);
}
buildingObjs[500].material.color.setHex( 0x333333 );
更改对象纹理
var material = new THREE.MeshBasicMaterial();
var geometry = new THREE.BoxGeometry( 1, 1, 1 );
var cube = new THREE.Mesh( geometry, material );
scene.add( cube );
var loader = new THREE.TextureLoader();
loader.load('https://s3-us-west-2.amazonaws.com/s.cdpn.io/259155/THREE_gates.jpg', function(tex) {
cube.material.map = tex;
});