threejs-es6-webpack-starter icon indicating copy to clipboard operation
threejs-es6-webpack-starter copied to clipboard

How can you use MTLLoader & OBJLoader?

Open joshbedo opened this issue 6 years ago • 2 comments

Trying to use these packages but it seems like I can't import the .mat and .obj. Is this a webpack issue where I need another loader?

joshbedo avatar Oct 14 '19 20:10 joshbedo

Three.js has its own loader for OBJ files, but I haven't (yet) used it in this repo.

Have a look at these links:

jackdbd avatar Oct 15 '19 07:10 jackdbd

First of all make sure you configure a new webpack rule, something like`

        //MTL
        {
            test: /\.(mtl)$/,
            use:
            [
                {
                    loader: 'file-loader',
                    options:
                    {
                        outputPath: 'assets/models/'
                    }
                }
            ]
        }

Beyond that, webpack will not get the textures referenced in your material file, so I believe a different loader is needed. No clue how to do that, I have only been able to load the .obj and then I get 404s from the textures.

captn-hook avatar Jun 23 '22 21:06 captn-hook