Git Product home page Git Product logo

mmdloader-app's Introduction

MMDLoader-app

sample applications for THREE.MMDLoader

Demo

Demo

Videos

ScreenShot

Screen shot1

Miku license

You are allowed to use Crypton's Vocaloid(Hatsune Miku, Kagamine Rin, and so on) stuffs (MMD models, songs, and so on) only if you follow the guideline set by Crypton Future Media, INC. for the usage of its characters.

For detail, see http://piapro.net/en_for_creators.html

MMD assets license

https://github.com/mrdoob/three.js/tree/dev/examples/models/mmd#readme

mmdloader-app's People

Contributors

ethanaobrien avatar mrdoob avatar takahirox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmdloader-app's Issues

How to dispose a model ENTIRELY?

Excuse me,

I write a HTML and put a button under every mmd model,when user click it,it create a canvas to show the mmd model.

I simply create camera,light,scene,renderer & MMDLoader(as demo do),and when user close it,I simply set them to null.

let camera, scene, renderer, mesh, cav;
let loader;

function init(canvas, url) {

    camera = new THREE.PerspectiveCamera(45, 1, 1, 2000);
    camera.position.set(0, 10, 35);
    camera.up.set(0, 0, 1);

    scene = new THREE.Scene();

    var ambient = new THREE.AmbientLight(0x666666);
    scene.add(ambient);

    var directionalLight = new THREE.DirectionalLight(0x887766);
    directionalLight.position.set(-1, 1, 1).normalize();
    scene.add(directionalLight);

    renderer = new THREE.WebGLRenderer({antialias: true, canvas: canvas});
    renderer.setPixelRatio(window.devicePixelRatio);
    renderer.setSize(512, 512);
    renderer.setClearColor(new THREE.Color(0x000000));

    loader = new THREE.MMDLoader();
    loader.loadModel(url, (obj) => {
        mesh = obj;
        scene.add(mesh);
    }, null, null, path.dirname(url) + '/', path.extname(url).substring(1));
}

function animate() {
    if (!cav) return;
    if (!document.body.contains(cav)) {
        scene.remove(mesh);
        mesh.dispose();
        renderer.dispose();
        cav = camera = scene = renderer = mesh = loader = null;
        return;
    }
    scene.rotation.y = new Date().getTime() * 0.001;
    renderer.render(scene, camera);
    requestAnimationFrame(animate);
}

But,it lead to memory leak.Every view of a model add 400M~1G memory(depend on model size),deleteing the canvas doesn't decrease the memory.

So,how to unload a model properly?

why splash is not rendered

i tryed to migrate gpu water to nowdays three module.
i cant manage water splash. (why splash is not rendered?)

the water and mesh (model) is rendered properly.

// pass 1: render reflection to renderTarget for water

                camera.updateMatrixWorld(true);

                reflectionCamera.matrix.copy(reflectionMatrix).multiply(camera.matrix);
                reflectionCamera.matrix.decompose(reflectionCamera.position, reflectionCamera.quaternion, reflectionCamera.scale);

                mesh.visible = true;
                water.visible = false;
                splash.visible = false;
                //renderer.setFaceCulling(THREE.CullFaceFront);
                effect.render(scene, reflectionCamera, renderTarget);

                //renderer.setFaceCulling(THREE.CullFaceBack);
                // pass 2: render model

                mesh.visible = true;
                water.visible = false;
                splash.visible = false;

                effect.render(scene, camera);

                // pass 3: render water and splash

                mesh.visible = false;
                water.visible = true;
                splash.visible = true;

                renderer.autoClear = false;
                
                renderer.render(scene, camera);
                // just in case restore the parameters

                renderer.autoClear = true;

                mesh.visible = true;
                water.visible = true;
                splash.visible = true;

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.