Dav*_*ews 6 lighting blender three.js 3d-model gltf
我想找到将搅拌机场景中的灯光添加到 THREE.js 项目中的最佳方法。我在任何地方都找不到如何将灯光从搅拌机导入到 THREE.js 的解释。您的 THREE.js 项目中应该已经有了照明。在处理大型场景时,这不是很有效。
这是我的导入声明
initGLTFLoader(){
this.gltfLoader = new THREE.GLTFLoader();
}
loadCTF(){
// Load a glTF resource
this.gltfLoader.load(
// resource URL
'ctf.gltf',
// called when the resource is loaded
function ( gltf ) {
// this console.log indicates that the light are actually in the import,
// but dont get added to the scene
console.log(gltf);
this.scene.add( gltf.scene );
}.bind(this),
// called while loading is progressing
function ( xhr ) {
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
},
// called when loading has errors
function ( error ) {
console.log( 'An error happened', error );
}
);
}
Run Code Online (Sandbox Code Playgroud)