Skip to content Skip to sidebar Skip to footer

Three.js Collada Textures Not Loading

1) start local web server C:\Users\Public\Documents\Rick>http-server . -p 8832 --cors Starting up http-server, serving . on: http://0.0.0.0:8832 Hit CTRL-C to stop th

Solution 1:

I had the same problem. ColladaLoader.js currently does not address CORS out-of-the-box. In order to render your textures, it implements either the Loader class or the ImageLoader class (depending upon the situation). Both need to have the CORS origin assigned to either '' or 'anonymous' if you want to avoid cross-origin errors in all cases for Collada references.

Go to this line in ColladaLoader.js:

texture = loader.load( url );

Add this line right above it:

loader.crossOrigin = '';

Then go to this line in the same script:

loader = new THREE.ImageLoader();

And add this line right below it:

loader.setCrossOrigin( '' );

And voila! My cross-origin errors went away after I made this change.

Post a Comment for "Three.js Collada Textures Not Loading"