I’d probably just read the asset handling documentation for Vite and ensure everything is correct: vitejs. const caxTexture = new THREE.TextureLoader().load('/assets/CalixHuang-eb3701c6.JPG') It may have something to do with the image paths you’re using, I note that the images are in the root of the repository, but that in the html they’re referred to just with their name: īut in the main.js file they’re referred to with the location you expect them to be post-build, which is within an assets/ folder. When performing an npm run dev the images do not load for me. When I perform an npm run build locally, and then do an npx serve inside the dist/ folder that it creates, I can see that the resulting build does contain your images and they load. The dist folder will be created when your Vite build occurs. I currently just have the model loaded in my project with none of the textures that should be associated with it. The node_modules folder will be created when Netlify automatically runs npm install for your build. I may have missed some steps, but the basic idea is to get your site running in the root, with all your dependencies in the same spot, and keep it simple.ĭont-commit-node_modules-or-dist 1260×444 61.4 KB Change the imports in your main.js file so they no longer reference.Run npm install in the root to ensure everything is in place.Copy all the files & folders from CalixHuangSite/ to the root.Remove the package.json and package-lock.json from the root.Add the three.js dependency to the package.json in CalixHuangSite/.To apply a texture on a 3D object, we will use the classes of the. These images are, for the most part, created with external tools (GIMP, Photoshop ), then, loaded in our scene thanks to the Three.js library. So to simplify things (and get it working), I would just… In the world of 3D, a texture generally represents an image applied on the surface of a 3D object. The structure of the repo seems a little unnecessary, since you’ve got three.js in a package.json at the root of the repo, and then all the other build dependencies in a package.json inside the CalixHuangSite folder.Īs your build is being performed with vite and you have no other config, the default folder for the output of npm run build is CalixHuangSite/dist/, and that is all that you would need to have deployed by Netlify.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |