증강 현실을 사용하는 Three.js 프로젝트가 있으며 이제 텍스처가있는 모델을로드하려고합니다. 웬일인지 나의 모델은 검은 색이다. 나는 질감이 없다. 나는 이미지를 내보내는 블렌더 박스를 체크했다. t-rex (모델이 사용하고있는 모델)의 .js 파일에서 텍스쳐를 나열했지만 내 애플리케이션은 그것을로드하지 않는다.Three.js에서 텍스처를로드 할 수 없습니다.
EDIT (ADDED CODE) I 모델을로드하는 데 사용하는 코드는 : 나는 마커 함께 일하고 있어요 때문에
new THREE.JSONLoader().load("models/trex.json", function(geometry) {
var material = new THREE.MeshFaceMaterial();
var dino = new THREE.Mesh(geometry, material);
dino.position.z = -50;
dino.scale.x = dino.scale.y = dino.scale.z = 2;
dino.updateMatrix();
dino.overdraw = true;
marker.object3d.add(dino);
});
나는 마커를 보여 주면 내가 원하는 마커 객체에 이것을 추가 마커에 그려지는 trex (또는 바로 위에).
TREX 모델이 하나와 동일하지만 믹서기를 열고 수출 three.js를 위해 블렌더의 최신 버전을 사용했습니다 : http://alteredqualia.com/three/examples/webgl_trex.html
이 또한 내 trex.json 파일은 다음과 같다 :
{
"metadata" :
{
"formatVersion" : 3.1,
"generatedBy" : "Blender 2.63 Exporter",
"vertices" : 23273,
"faces" : 23268,
"normals" : 20842,
"colors" : 0,
"uvs" : [11497],
"materials" : 1,
"morphTargets" : 0,
"bones" : 0
},
"scale" : 0.0500,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material.001",
"blending" : "NormalBlending",
"colorAmbient" : [0.2933282256126404, 0.2933282256126404, 0.2933282256126404],
"colorDiffuse" : [0.2933282256126404, 0.2933282256126404, 0.2933282256126404],
"colorSpecular" : [0.13438941538333893, 0.13438941538333893, 0.13438941538333893],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "trex_image_copy.png",
"mapNormal" : "trex_image_bump.png",
"mapNormalFactor" : 12.0,
"mapSpecular" : "trex_image_spec.png",
"shading" : "Phong",
"specularCoef" : 511,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 15597568,
"DbgIndex" : 1,
"DbgName" : "Material",
"blending" : "NormalBlending",
"colorAmbient" : [0.7257574200630188, 0.7257574200630188, 0.7257574200630188],
"colorDiffuse" : [0.7257574200630188, 0.7257574200630188, 0.7257574200630188],
"colorSpecular" : [0.0, 0.0, 0.0],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "trex_image_copy.png",
"mapLight" : "trex_image_eye.png",
"mapLightWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 1,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 60928,
"DbgIndex" : 2,
"DbgName" : "Material",
"blending" : "NormalBlending",
"colorAmbient" : [0.7257574200630188, 0.7257574200630188, 0.7257574200630188],
"colorDiffuse" : [0.7257574200630188, 0.7257574200630188, 0.7257574200630188],
"colorSpecular" : [0.0, 0.0, 0.0],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "trex_image_copy.png",
"mapLight" : "trex_image_eye.png",
"mapLightWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 1,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
}],
"vertices":
나는 상자를 그리기하고 있지만, JSON 형식의 파일을로드 한 후 나던 작업 텍스처를 표시 작동하는지, 텍스처를 추가 tryed했습니다.
고맙습니다.
이 솔루션은 다음 릴리스와 함께 작동
문제 코드는 어디에 있습니까? main.js에서 trex.json에 대한 참조를 찾을 수 없습니다. 또한 거대한 아카이브를 제공하는 대신 모델 로딩 코드를 붙여 넣을 수 있으므로 냄새가 나는지 신속하게 파악할 수 있습니다. zip을 다운로드하면 잠재적 인 도우미가되기 어려울 수 있으며 본격적인 프로젝트가 아닌 작은 독립 실행 형 테스트 사례가 바람직합니다. – Tapio
로컬로 또는 웹 서버에서이 방법을 사용하고 있습니까? – Neil
@ Tagio 코드에서 다른 부분이 잘못되었다고 생각하기 때문에이 작업을 수행했습니다. trex.json을 151 행으로 검색합니다. 어쨌든 나는 질문을 고칠거야, 고마워! – DanFritz