我已經轉換使用python工具 OBJ文件到JSON模式,我想在這裏加載它 是代碼JSON模型紋理不加載
var camera, scene, renderer;
var mesh, aircraft;
function addModelToScene(geometry, materials)
{
aircraft = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
scene.add(aircraft);
}
function init()
{
camera = new THREE.PerspectiveCamera(45, window.innerWidth/window.innerHeight, 0.1, 20000);
camera.position.z = 30;
scene = new THREE.Scene();
var jsonLoader = new THREE.JSONLoader(true);
jsonLoader.load("XA-20.js", addModelToScene);
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
}
function animate()
{
requestAnimationFrame(animate);
aircraft.rotation.y += 0.02;
renderer.render(scene, camera);
}
模型加載,但它沒有 紋理模型文件是很大的,所以我不能將它張貼在這裏 但也有材料
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "plane",
"colorAmbient" : [0.117647, 0.117647, 0.117647],
"colorDiffuse" : [1.0, 1.0, 1.0],
"colorSpecular" : [0.75294099999999997, 0.75294099999999997, 0.75294099999999997],
"illumination" : 2,
"mapBump" : "XA-20_Razorback_Strike_Fighter_N.png",
"mapDiffuse" : "XA-20_Razorback_Strike_Fighter_P01.png",
"specularCoef" : 8.0
},
{
"DbgColor" : 15597568,
"DbgIndex" : 1,
"DbgName" : "glass",
"colorAmbient" : [0.117647, 0.117647, 0.117647],
"colorDiffuse" : [1.0, 1.0, 1.0],
"colorSpecular" : [0.75294099999999997, 0.75294099999999997, 0.75294099999999997],
"illumination" : 2,
"mapDiffuse" : "Glass_Cockpit.png",
"specularCoef" : 8.0
},.......
和烏布蘇以及
"uvs": [[0.72626,-0.65659,0.72655,-0.62558,0.72427,-0.6262,0.72391,-0.66141,0.73223,-0.62103,0.73212,.......
任何線索,我可以尋找解決方案?
嗨我也遇到了這個問題。我正在加載一個模型,如果我使用CanvasRenderer,並且看到模型完成了紋理,但是當我使用WebGLRenderer時,只顯示一個黑色模型。還有什麼我忘記了嗎? – arunondeck