Giter VIP home page Giter VIP logo

loadbigobj's Introduction

Threejs大型obj文件的秒加载实现

原理: https://www.jianshu.com/p/5c2cafcea26c

例子中的3d模型使用的是100m的陆羽模型 原下载地址 https://www.artec3d.com/3d-models/lu-yu.

image.png

luyu.obj obj模型文件

luyu.gltf obj转gltf文件 (obj2gltf -i luyu.obj -o luyu.gltf)

luyu2.gltf gltf文件压缩后的文件 (gltf-pipeline -i luyu.gltf -o luyu2.gltf -d)

1 安装BrowserSync npm install -g browser-sync

2 执行 browser-sync start --server --files "css/*.css, *.html"

3 打开 http://localhost:3000/loadobj.html

这里面的代码是加载obj文件和gltf文件

image.png

4打开 http://localhost:3000/login.html

这是模拟登陆页面 在这个页面启动webwork 异步加载和解压缩模型

image.png

5 点击链接进入模型页 使用indexdb加载模型 加载只需要1.3s

image.png

loadbigobj's People

Contributors

kaikai55 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.