Any 3d model loader for jogl?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Any 3d model loader for jogl?

paulados
Hi everybody

I am looking for a framework for making an augmented reality application in android. I have seen that this framework can be used in android and I think it could be useful for me. However I also need to load 3d models (static and dynamics, I suppuse that 3ds, obj and md2 formats) and I have not found any 3d model loader in jogl.

I have seen some questions asking for objects loaders, and anyone uses a different one (normally one implemented by their own). Those that have had experience on it, do you recommed any object loader for using with jogl? I think that it is better not to try to reinvent the wheel, if it can be avoided

Thank you and best regards
Paula.
Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

gouessej
Administrator
Hi

JOGL and JOGL-utils contain several loaders for Wavefront OBJ and 3DS formats. Ardor3D contains the most robust OBJ and MD2 loaders that I know but using it under Android isn't trivial whereas it's very well under desktop environments. Ardor3D supports Collada and it has an OBJ exporter too. Good luck.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

paulados
Hi !!

Thank you very much for your soon answer. I'll take a look at utils and Ardor3D and to any other suggestions  

P.D: I was really getting mad looking for 3d model formats and loaders

Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

gouessej
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

elect
In reply to this post by gouessej
gouessej wrote
Hi

JOGL and JOGL-utils contain several loaders for Wavefront OBJ and 3DS formats. Ardor3D contains the most robust OBJ and MD2 loaders that I know but using it under Android isn't trivial whereas it's very well under desktop environments. Ardor3D supports Collada and it has an OBJ exporter too. Good luck.
I am gonna use this thread in order to avoid to open a new one on the same argument

I just wanted to ask if the Ardor3D obj loader is still the best nowadays or some better ones came out
Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

gouessej
Administrator
This post was updated on .
JogAmp's Ardor3D Continuation is the best way of loading and viewing WaveFront OBJ models, it's quite reliable even though a very few features are missing and the OBJ exporter works very well too :) I'll write a tutorial about it soon.

Edit.: It will probably support PLY, STL and BVH too in the future.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

elect
This post was updated on .
gouessej wrote
JogAmp's Ardor3D Continuation is the best way of loading and viewing WaveFront OBJ models, it's quite reliable even though a very few features are missing and the OBJ exporter works very well too :) I'll write a tutorial about it soon.

Edit.: It will probably support PLY, STL and BVH too in the future.
Do you have a link to pass?

Edit: is this one? http://jogamp.org/jogl-demos/src/demos/util/ObjReader.java

Ps: I have already my own stl loader (both binary/ascii), let me know if it can help

Ps2: what about Ardor3D 2? Can you describe me the current situation about Ardord 3D right now? I saw the author left and I read over internet some discussion about Ardod3d vs jm3..
Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

gouessej
Administrator
No it isn't this one. JogAmp's Ardor3D Continuation is still on Github and very actively maintained:
https://github.com/gouessej/Ardor3D/blob/master/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java

I already have a STL loader that someone else implemented but yours could be helpful if something goes wrong during the tests, in order to make some comparisons and fix it.

JogAmp's Ardor3D Continuation is alive and in a very good health, Xerxes helps me to test it with Linux ARM (laptop + Raspberry Pi). There are some explanations in the wiki:
http://jogamp.org/wiki/index.php/Ardor3D_Overview

Where did you read some discussions about Ardor3D vs JMonkeyEngine 3? JogAmp's Ardor3D Continuation is currently developed and JMonkeyEngine 3 is an interesting game development suite too anyway.

Edit.: Maybe you would have preferred to use a rudimentary loader depending only on JOGL but personally, I don't want to maintain one OBJ loader in JOGL-Utils, another one in jogl-demos and another one in JogAmp's Ardor3D Continuation. Moreover, a loader is forced to rely on some concepts and entities that have nothing to do in a Java binding for the OpenGL/OpenGL-ES API.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Any 3d model loader for jogl?

elect
gouessej wrote
I already have a STL loader that someone else implemented but yours could be helpful if something goes wrong during the tests, in order to make some comparisons and fix it.
Here my ascii  loader and here the binary

private void readBinary() throws FileNotFoundException, IOException {

        FileInputStream fis = new FileInputStream(file);
        fis.skip(80); //-> Header skippen (80 Byte)
        int number_of_triangles = readInt(fis);

        //
        // ToDo: Check if number of triangles is OK (not negative)
        //
        if (number_of_triangles < 0) {
                  // error
        }

        if (number_of_triangles > 0) {

            float[] triangleAttributes = new float[18];
            float[] verticesAttributes = new float[number_of_triangles * 18];

            // read data
            float[] tri;
            for (int counter = 0; counter < number_of_triangles; counter++) {

                tri = new float[12];
                tri[9] = readFloat(fis);
                tri[10] = readFloat(fis);
                tri[11] = readFloat(fis);
                tri[0] = readFloat(fis);
                tri[1] = readFloat(fis);
                tri[2] = readFloat(fis);
                tri[3] = readFloat(fis);
                tri[4] = readFloat(fis);
                tri[5] = readFloat(fis);
                tri[6] = readFloat(fis);
                tri[7] = readFloat(fis);
                tri[8] = readFloat(fis);
                fis.skip(2);

                triangleAttributes[0] = tri[0];
                triangleAttributes[1] = tri[1];
                triangleAttributes[2] = tri[2];
                triangleAttributes[3] = tri[9];
                triangleAttributes[4] = tri[10];
                triangleAttributes[5] = tri[11];
                triangleAttributes[6] = tri[3];
                triangleAttributes[7] = tri[4];
                triangleAttributes[8] = tri[5];
                triangleAttributes[9] = tri[9];
                triangleAttributes[10] = tri[10];
                triangleAttributes[11] = tri[11];
                triangleAttributes[12] = tri[6];
                triangleAttributes[13] = tri[7];
                triangleAttributes[14] = tri[8];
                triangleAttributes[15] = tri[9];
                triangleAttributes[16] = tri[10];
                triangleAttributes[17] = tri[11];

                System.arraycopy(triangleAttributes, 0, verticesAttributes, counter * 18, 18);
            }

            fis.close();
        }
    }