Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models are not working #38

Open
Kinmarui opened this issue Oct 11, 2015 · 12 comments
Open

Models are not working #38

Kinmarui opened this issue Oct 11, 2015 · 12 comments
Assignees
Labels

Comments

@Kinmarui
Copy link

Hi,
at first thanks for great port of threejs to java. Currently I'm having problems with loading models into it, hope you can help me.

When I loaded flamingo from demo it worked, but I tried to export cube from blender using threejs exporter and parallex can't load it I tried converting it using http://threejs.org/editor/ to export to scene or geometry (I can't select object ) but without success only STL type worked after loading in parallax. I've also tried using colladaLoader but didn't work :<

I've tried converting my scene(verticles:239k, faces:191k, objects:3,785) to STL and it looks like it's being loaded but 1,2 GB of ram later browser tab crashes, I hope Collada or JSON will have better performance.

Models I'm trying to load: https://www.sendspace.com/file/almqym
box.* files are from blender and rest was exported using threejs editor site

code I'm using

    protected void onStart() {
            // .. set camera and light
            new JsonLoader("./model/box.json", jsonModelLoadHandler);
    }

    private ModelLoadHandler jsonModelLoadHandler = new ModelLoadHandler() {
            @Override
            public void onModelLoaded(XHRLoader loader,
                    AbstractGeometry geometry) {
                ((JsonLoader)loader).morphColorsToFaceColors( (Geometry) geometry );
                ((Geometry)geometry).computeMorphNormals();

                MeshLambertMaterial material = new MeshLambertMaterial();
                material.setColor(new Color(0xffffff));
                material.setMorphTargets(true);
                material.setMorphNormals(true);
                material.setVertexColors(Material.COLORS.FACE);
                material.setShading(Material.SHADING.FLAT);

                Mesh mesh2 = new Mesh( geometry, material );
                getScene().add(mesh2);
    }

Also what should I know when using JSON and Collada loaders compared to OBJMTL loader which I used previously in JS?

@thothbot
Copy link
Owner

What you did, looks right.
We need to optimize all loaders.

Looks like https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender has changed data format, we need to update that loader

@thothbot thothbot added the bug label Jan 27, 2016
@thothbot thothbot added this to the ver 2.0 milestone Jan 27, 2016
@thothbot thothbot self-assigned this Jan 27, 2016
@andnovar
Copy link

For Json most of the exporters create 4.4 version and seems like Parallax is working with version 3.0. If you point me out to some resource on how to update the Loader I would do it.

@thothbot
Copy link
Owner

Hey, all loaders are alocated in the
extensions/parallax-loaders,

but I didn't finish port of existing code into 2.0 yet, when I finish, I'll let you know to make it working with 4.4.

@andnovar
Copy link

Hi, I found the new loaders thanks ! Looking forward for version 2.0

@thothbot
Copy link
Owner

Andres, I've ported Json loader into 2.0,
So if you have a time please upgrade it to the last version.

to run Parallax tests for GWT platform just type in console:

gradle :tests:parallax-tests-gwt:superDev

after that go to http://127.0.0.1:8080/parallax-tests-gwt/

@andnovar
Copy link

Thanks I'll give it a try.

@andnovar
Copy link

Alex, maybe it is quite a silly question but how do you add parallax 2.0 dev to an existing project that does not use gradle ?

@sguionni
Copy link
Contributor

Hi,
you have to migrate your project following this template : https://github.com/thothbot/parallax-application-template

@andnovar
Copy link

Hi, is there not other way ? I am adding functionality to a project that compiles with ant.

@thothbot
Copy link
Owner

Hi,
this is just a template with a gradle configuration file.
You can use maven or ant, but you need to setup your custom config using provided gradle template

Parallax is in beta status at the moment, jars are available on sonatype nexus repo

@andnovar
Copy link

Hi,

Thanks for the library btw. I tried the STLLoader and the JsonLoader. The STLLoader seems not to load right complex meshes see the pictures attached. I used this tool to generate the STL and JSON file https://mrdoob.github.io/three.js/editor/ . The image in red is in three.js editor and the other rendered with the latest 2.0 snapshot . Attached is also a simple cube and a sphere in json format that can not be loaded. However, I can still load the previous flamingo.js, horse.js, etc...

capturecom
capturecomparallax
geometry.zip

@thothbot
Copy link
Owner

Thank you for your tests, I'll update Parallax core in few days, and I'll test your geometry. I did huge refactoring to support latest threejs API (75). hope all will be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants