Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unplugin-3d-object

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin-3d-object

Import 3d objects with obj, mtl and textures whilte importing .obj file

  • 0.0.1-beta.1
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

unplugin-3d-object

Load whole 3d object while importing .obj files.

Things to-do

  • Multiple mtl lib support;
  • Parse MTL properties, not only maps;
  • Build-in three-loader support;
  • Tests (file names, parsing, etc.);

Install

npm i unplugin-3d-object
# or
yarn add unplugin-3d-object
# or
pnpm i unplugin-3d-object
Vite
// vite.config.ts
import loader3dObject from 'unplugin-3d-object/vite'

export default defineConfig({
  plugins: [
    loader3dObject({ /* options */ }),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import loader3dObject from 'unplugin-3d-object/rollup'

export default {
  plugins: [
    loader3dObject({ /* options */ }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-3d-object/webpack')({ /* options */ })
  ]
}


Nuxt
// nuxt.config.js
export default {
  buildModules: [
    ['unplugin-3d-object/nuxt', { /* options */ }],
  ],
}

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-3d-object/webpack')({ /* options */ }),
    ],
  },
}


How it works?

Plugin load .obj, scan for mtl libs and trying to load them. From mtl plugin also trying to load textures. Plugin transform .obj files to OBJ type.

Example

import house from 'house/house.obj'
// ...
createObject(house.obj, house.mtl.toString(), house.mtl.paths)

Example with three.js

import house from 'house/house.obj?three'
// ...
scene.add(house)

Example: playground

Warnings

If .obj file require texture or mtl file that can not be found it will throw warning.

Make sure change absolute paths to relative in .obj and .mtl

You can turn off warnings by passing warnings: false in plugin options if you don't care about missing assets.

Keywords

FAQs

Package last updated on 06 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc