Note that there are some explanatory texts on larger screens.

plurals
  1. POThreeJS load time and texture rendering problems
    primarykey
    data
    text
    <p>I have a 3D object of a chair made in Blender and exported as a .obj and .mtl. First of all, the load time is a horrendous 40+ seconds; I have no idea why (Visual Studio possibly?) Second, the images textures are not loading properly. With no ambient or directional lighting I get a silhouette. With the lighting I get a slight hint of gray to give a little depth but nothing close to the many colors in the original object. I have only been working with ThreeJS for a few days now so I'm quite new to it. Hence, I am at a loss. I have read several artciles related to my issue but none seem to solve the problem. I even went so far as to add an addon to Blender to export to .js. I could not get it to even load properly (I assume it had to do with the fact I kept the same loader info from the .OBJMTLLoader and the .JSONLoader doesn't support or needs more than what I gave; I just am not familiar enough with it know). Any ideas/suggestions? Here is my script: </p> <p>`</p> <pre><code> &lt;script src="js/three.min.js"&gt;&lt;/script&gt; &lt;script src="js/controls/TrackballControls.js"&gt;&lt;/script&gt; &lt;script src="js/loaders/MTLLoader.js"&gt;&lt;/script&gt; &lt;script src="js/loaders/OBJMTLLoader.js"&gt;&lt;/script&gt; &lt;script src="js/Detector.js"&gt;&lt;/script&gt; &lt;script&gt; if (!Detector.webgl) Detector.addGetWebGLMessage(); var container; var camera, controls, scene, renderer; init(); animate(); function init() { container = document.createElement('div'); document.body.appendChild(container); camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.01, 1e10); camera.position.z = 2; //controls controls = new THREE.TrackballControls(camera); controls.rotateSpeed = 5.0; controls.zoomSpeed = 5; controls.panSpeed = 2; controls.noZoom = false; controls.noPan = false; controls.staticMoving = true; controls.dynamicDampingFactor = 0.3; scene = new THREE.Scene(); scene.add(camera); //lights var ambient = new THREE.AmbientLight(0xCCCCCC); scene.add(ambient); var directionalLight = new THREE.DirectionalLight(0xCCCCCC); directionalLight.position.set(0, 0, 2).normalize(); scene.add(directionalLight); //main img var material = new THREE.MeshBasicMaterial({ color: '0xCCCCCC' }); var loader = new THREE.OBJMTLLoader(); loader.addEventListener('load', function (event) { var geometry = event.content; //var mesh = new THREE.Mesh(geometry); scene.add(geometry, material); }); loader.load('chair.obj', 'chair.mtl'); // renderer renderer = new THREE.WebGLRenderer({ antialias: false }); renderer.setSize(window.innerWidth, window.innerHeight); container.appendChild(renderer.domElement); // window.addEventListener('resize', onWindowResize, false); } function onWindowResize() { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize(window.innerWidth, window.innerHeight); controls.handleResize(); } function animate() { requestAnimationFrame(animate); render(); controls.update(); } function render() { var timer = Date.now() * 0.0005; renderer.render(scene, camera); } &lt;/script&gt; </code></pre> <p>`</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload