hi im trying to showing color for fbx.file on html5
but it just showing on black and white
and i don’t know why it working like that,…
please help me…
below code, and error
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - FBX loader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css">
</head>
<body>
<div id="info">
</div>
<script src="../build/three.js"></script>
<script src="js/libs/inflate.min.js"></script>
<script src="js/loaders/FBXLoader.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="js/WebGL.js"></script>
<script src="js/libs/stats.min.js"></script>
<script>
if ( WEBGL.isWebGLAvailable() === false ) { //?? 되면 에러문 출력
document.body.appendChild( WEBGL.getWebGLErrorMessage() );
}
var container, stats, controls;
var camera, scene, renderer, light;
var clock = new THREE.Clock();
var mixer;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 10, 3000); // 각도,물체절단비율 /개체 거리 기본값 10 /기본값 2000 /
camera.position.set( 600, 700, 100 ); // (물체와의 거리 , 내려다 보는 높이 , 회전 율 )
scene = new THREE.Scene();
scene.background = new THREE.Color(0xa0a0a0); // 벽면 밑 뒷 배경 색
scene.fog = new THREE.Fog( 0xa0a0a0, 100, 1000 ); //바닥 색, 안개 짙은 농도 , 빛 강도 ( 0xa0a0a0,1000,1000) // 색 입히면
light = new THREE.HemisphereLight( 0xffffff, 0x444444 );
light.position.set( 0, 200, 0 );
scene.add( light );
light = new THREE.DirectionalLight( 0xffffff );
light.position.set( 0, 200, 100 );
light.castShadow = true;
light.shadow.camera.top = 180;
light.shadow.camera.bottom = - 100;
light.shadow.camera.left = - 120;
light.shadow.camera.right = 120;
scene.add( light );
// scene.add( new THREE.CameraHelper( light.shadow.camera ) );
// ground
var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2000, 2000 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
mesh.rotation.x = - Math.PI / 2;
mesh.receiveShadow = true;
scene.add( mesh );
var grid = new THREE.GridHelper( 2000, 20, 0x000000, 0x000000 );
grid.material.opacity = 0.2;
grid.material.transparent = true;
scene.add( grid );
// model
var loader = new THREE.FBXLoader();
loader.load( 'models/fbx/OLTC_Machine_Dec28.fbx', function ( object ) {
// mixer = new THREE.AnimationMixer( object );
// var action = mixer.clipAction( object.animations[ 0 ] ); //animate를 위한 부분 주석 해제시 이미지 로딩 되지 않음
// action.play();
object.traverse( function ( child ) {
if ( child.isMesh ) {
// child.material.wireframe =true; //wire 선 노출
child.castShadow = true; //그림자 ( 바닥 Mesh 있을 때 적용)
child.receiveShadow = true;
}
} );
scene.add( object );
},undefined,function(error){
console.error(error);
}
);
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight ); // html 화면에 출력 되는 사이즈
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );
controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.target.set( 0, 400, 0);
// controls.target.set( 0, 400, 0 ); ( 0, y 값, 0)
controls.update();
window.addEventListener( 'resize', onWindowResize, false );
// stats
stats = new Stats();
container.appendChild( stats.dom );
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
requestAnimationFrame( animate );
var delta = clock.getDelta();
if ( mixer ) mixer.update( delta );
renderer.render( scene, camera ); //주석시 실행되지 않음
stats.update();
}
</script>
</body>
</html>
THREE.WebGLRenderer 106dev
three.js:34710 THREE.FileLoader: HTTP Status 0 received.
(anonymous) @ three.js:34710
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:3273 THREE.FBXLoader: FBX binary version: 7400
FBXLoader.js:293 FBXLoader: THREE.TGALoader is required to load TGA textures
parseImage @ FBXLoader.js:293
parseImages @ FBXLoader.js:232
parse @ FBXLoader.js:144
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
2FBXLoader.js:314 FBXLoader: Image type "dds" is not supported.
parseImage @ FBXLoader.js:314
parseImages @ FBXLoader.js:232
parse @ FBXLoader.js:144
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:293 FBXLoader: THREE.TGALoader is required to load TGA textures
parseImage @ FBXLoader.js:293
parseImages @ FBXLoader.js:232
parse @ FBXLoader.js:144
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:314 FBXLoader: Image type "dds" is not supported.
parseImage @ FBXLoader.js:314
parseImages @ FBXLoader.js:232
parse @ FBXLoader.js:144
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
8FBXLoader.js:293 FBXLoader: THREE.TGALoader is required to load TGA textures
parseImage @ FBXLoader.js:293
parseImages @ FBXLoader.js:232
parse @ FBXLoader.js:144
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for bottom_oltc_machine_me.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for bottom_oltc_machine_gl.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for bottom_oltc_machine_d.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for bottom_oltc_machine_n.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for Glass_oltc_machine_d.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for Glass_oltc_machine_spe.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for Top_oltc_machine_metal.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for Top_oltc_machine_glosl.tga
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for Top_oltc_machine_d.TGA
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:420 FBXLoader: TGALoader not found, creating empty placeholder texture for Top_oltc_machine_n.TGA
loadTexture @ FBXLoader.js:420
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_global_diffuse_cube map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_global_specular_cube map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_brdf_lut map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_metallic_map map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_roughness_map map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:501 THREE.FBXLoader: unknown material type "unknown". Defaulting to MeshPhongMaterial.
parseMaterial @ FBXLoader.js:501
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_global_diffuse_cube map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_global_specular_cube map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_brdf_lut map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_metallic_map map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:646 THREE.FBXLoader: Maya|TEX_roughness_map map is not supported in three.js, skipping texture.
(anonymous) @ FBXLoader.js:646
parseParameters @ FBXLoader.js:595
parseMaterial @ FBXLoader.js:488
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
FBXLoader.js:501 THREE.FBXLoader: unknown material type "unknown". Defaulting to MeshPhongMaterial.
parseMaterial @ FBXLoader.js:501
parseMaterials @ FBXLoader.js:457
parse @ FBXLoader.js:146
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
models/fbx/specular_cube.dds:1 GET file:///C:/Users/User/Downloads/three.js-dev/three.js-dev/examples/models/fbx/specular_cube.dds net::ERR_FILE_NOT_FOUND
Image (async)
load @ three.js:35205
load @ three.js:35321
loadTexture @ FBXLoader.js:436
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
models/fbx/diffuse_cube.dds:1 GET file:///C:/Users/User/Downloads/three.js-dev/three.js-dev/examples/models/fbx/diffuse_cube.dds net::ERR_FILE_NOT_FOUND
Image (async)
load @ three.js:35205
load @ three.js:35321
loadTexture @ FBXLoader.js:436
parseTexture @ FBXLoader.js:358
parseTextures @ FBXLoader.js:344
parse @ FBXLoader.js:145
parse @ FBXLoader.js:123
(anonymous) @ FBXLoader.js:54
(anonymous) @ three.js:34715
load (async)
load @ three.js:34695
load @ FBXLoader.js:50
init @ webgl_loader_fbx.html:84
(anonymous) @ webgl_loader_fbx.html:40
models/fbx/ibl_brdf_lut.dds:1