Close Show/hide page

Announcing “min3D”, a 3D framework for Android

Why yes, that is the Earth revolving around the planet Jupiter

View the code for this example.
Note how the “onEnterFrame” function is only 8 lines long.

Update:
Download min3D sample app
(Android v1.5 or higher)

This post announces a 3D framework/library-in-progress I’ve been writing for Android, written in Java with OpenGL ES. Between the names min3d, modest3d, and llama3d, I’ve gone with “min3d” for being the least self-deprecating while still conveying an appropriate level of expectation that I’m comfortable with. :)

I’ve gone legit by putting it up on Google Code (first time for everything, etc.). While just an early build, it should at the very least be useful for educational purposes if like me you’re just starting down the Android path.

My aim while building this was to make a library that required no extra massaging of model data on its way to being used by OpenGL. To that end, data can be created and manipulated directly on the ByteBuffers that are used by OpenGL, without the need for any intermediating (ie, redundant) data structures. And hopefully wrapped in such a way that’s still relatively easy to use.

But this approach also imposes some important restrictions. The maximum number of vertices and faces of an Object3d is fixed after instantiation, and the dynamic addition/removal of vertex or face elements is currently not supported. If/when implemented, these operations will have to be much more costly than, say, with a linked list. But unavoidable, as far as I can tell.

Here’s what’s currently implemented through the API (all conventional stuff…)

  • Vertex index lists
  • Per-vertex colors
  • Vertex normals
  • Texture mapping
  • Light source (just the one, for now)
  • Camera class, with view frustrum settings
  • Object scale, euler rotation, and translation properties as expected
  • Object children that inherit parent’s transform properties
  • Ability to render a subset of an object’s list of faces
  • Triangle or point rendermodes (just the two, for now)
  • A few canned object primitives

Code examples showing how to actually use “min3d” in its current form can be found through the project home page on Google Code by checking out the source with SVN, and going through the sampleProjects/ directory.

In the immediate future, I’d like to be able to at least add a light manager and a 3d-file format importer, and definitely test and debug more thoroughly. If anyone is interested in collaborating on or even picking up this project, please let me know.

46 Responses to “Announcing “min3D”, a 3D framework for Android”

  1. Lawrie says:

    Man you should totally have gone with llama3d!
    Really good work here and it’s awesome you’ve released the source.
    Out of interest, I see video is sped up a fair bit, how’s the performance in real time?

  2. guojian says:

    sweet, can’t wait till start playing with this. go android! go min3D! :)

  3. admin says:

    Thanks guojian, Lawrie.

    Lawrie, good catch on the video trickery, LOL. To do the capture, I forced a framerate of about 1.5 frames per second (!) and did a video capture of the Android emulator window. But I couldn’t figure out how to speed it up enough with my video editor. So it actually runs better in real life – on a Nexus One – than what’s demoed above. About 50 fps…

  4. benny! says:

    Sounds like a great project. Installed current version and tried it on my HTC Magic (running 1.6). All examples do not work unfortunately. I will try to investigate it when I have more time…
    Anyway, glad to see such a project for Android!

  5. knagai says:

    I tried min3d on Windows and Mac.
    On Window 7 + eclipse, it is ok. I could see your 3d examples.
    But on Mac(10.5.8 + eclipse), it happend error.
    For example eclipse says there are errors in AParser.java file.
    Some .java files show [x] marks in eclipse.
    I don’t know why….
    Do you know what to do?

  6. admin says:

    @benny,
    Thanks for the feedback. Would you mind trying the latest compiled sample project? I’m hoping a recent update will have fixed compatibility issues with your device.

    @knagai,
    Can you successfully import or create any other Android projects on your Mac? If so, could you mind sending me what errors you get? Thanks. felarca_at_yahoo.com

  7. benny! says:

    @Lee:
    Guess I tracked down the source of the error. Seems to be in RenderCaps.setRenderCaps(). More details via PM.

  8. knagai says:

    Android SDK examples are OK on my Mac.
    For importing, I did it to Mac eclipse as on Windows.
    On eclipse Mac, when I enter import min3d…., eclipse shows code hint.
    So Importing seems successful to me.

    When I run, eclipse says” Your project contains errors, please fix them before running your application.”

    In eclipse package explorer , min3d src folder in the project folder min3d src folder shows [x] sign.
    I open it,
    for exampe min3d.core shows [x] sign.
    I open it,
    Object3dContainer.java showe [x] sign
    and in that file, public void addChild(Object $0) code line shows [x] sign
    I mouse over it,
    eclipse says “addChild(Object3d) needs to override super classe’s method
    implements min3d.inerface.iObject3dContainer.addChild”

    Thease two lines are actually in Japanese.

    I don’t know why it is successful on Windows and not successful on Mac in spite of same files.

  9. benny! says:

    New version 009 works without any problems on my device (1.6). Just wondering if it is possible with min3d to start the show in fullscreen mode. Currently I achieve this only by adding the following lines right after super.onCreate(savedInstanceState); in RendererActivity::onCreate().

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);

    I wonder what would be the best way to do it – without adding code directly in the lib.

  10. knagai says:

    I fixed my problem on my Mac.
    [min3dproject]->[property]->[Java compiler]->JDK lebel 1.5-> 1.6
    Your examples starts to move!
    Thank you!

  11. admin says:

    @benny,
    I made an update a couple days ago with a protected function called “onCreateSetContentView()” which you can override to make changes to the Activity. I wouldn’t worry too much about making changes directly to the library at this point, since the API will continue to change… Thanks for all your feedback on this.

    @knagai,
    That’s great. Let me know how it goes.

  12. Gowtham says:

    Hi I am using min3d to one of my experimental project. When I add a child, the child is behind the parent, how to I bring the child before the parent. Any equivalent to bringToFront() ?

  13. admin says:

    Gowtham, min3D works in 3D space, so the order in which objects are displayed visually is determined by how close they are to the camera. OpenGL manages “z-order” automatically. I’m guessing what you want to do is put both objects on the same ‘level’, rather than making one object the child of another. Instead, try changing the position x/y/z properties of the objects.

  14. Gowtham says:

    @admin
    Thanks for the prompt reply, changing the z order worked.

  15. Binxalot says:

    Is there any chance you can upload instructions on how to use the SVN and link everything to eclispe? I tried to import the project to my project folder in eclispe but it fails to build and shows me a list of errors in the ApplicationManifest.XML file showing that all of the ‘s are all red X’d out and the project wont build. I know this is because I’m a complete moron when it comes to using Eclispe, but other like me would benefit from being shown the ropes on how to install and use your framework.
    Thanks! – Binx

  16. Xabaras says:

    Great Work!
    It works fine on Hero with android 2.1.1
    Have you ever thought to try writing a page curl animation with your library?

  17. Sanjay says:

    Fantastic! I am learning more about OpenGL from your framework.
    I’ve put together your samples and some other demos too – but can you tell me how I can open a second dialog from your activity. It does not seem to like the context I pass and force closes before it can ‘show’ the dialog
    Any help would be greatly appreciated
    Sanjay

  18. kexar says:

    Thanks for this excellent framework! Is it possible to create live wallpaper with Min3D? If yes, how?

  19. biniu says:

    First thanks for awsome work around min3d. Got a question though, how to force texturing tu use depth projection? Currently when I spin a cube texture will “move”. Thanks in advance!

    Keep up the good work!

  20. matrixlnmi169 says:

    Hi ,

    There is one issue on the source code .

    ExampleLoad3DSFile ,ExampleLoadMD2File,ExampleLoadObjFile,ExampleLoadObjFileMultiple

    is not working , got the lert box notifying force to close.

    While debuging , realized some link error . Please help me

  21. Scheichi says:

    @matrixlnmi169: I got it working with exactly these classes.
    Are you sure you used the correct package name? Notice that the file type should not be included in the path –> you also have to reduce the name of the file in the res folder.

    IParser parser = Parser.createParser(Parser.Type.MAX_3DS,
    getResources(), “YOUR-PACKAGE-NAME:raw/monster_high”, false);

    You see there is no “.3ds” at the end of the filename (“monster_high”).

  22. amici says:

    I’m new and i dont understand how to make project on Eclipse with min3d, i want to made project with it to load .obj like camaro example.
    Where i download project files ?
    Or how to link min3d to project?

  23. Mike A says:

    Wonderful way to get going on android 3d – runs great on the 7 inch galaxy tab.
    jupiter shows on the galaxy tab emulator but not native in the device.

    But that’s fun to figure out.

  24. Mike A says:

    Fixed Jupiter on the galaxy tab…

    For some reason the Glaxaxy Tab was not showing the planets spinning or the Camero2 demo.

    Hacked around and found it has something to do with light positioning on both apps.

    light.position.setAll(0, 0, 0); – from 3,3,3 gets the planets to shine.

    Moving the light source for the camero2 demo back a few clicks does the same.

    Great framework – working on a collidable interface for the object3d class – when I get the time.

  25. amici says:

    I’m new and i dont understand how to make project on Eclipse with min3d, i want to made project with it to load my 3d .obj.

    Where i download project files ?
    Or how to link min3d to project?

    Help me please, thanks.

  26. Luis says:

    Dear Lee Felarca,

    I have the exact same problem mentioned above and in various places: the imports dont work and I found an aswer you gave that there was no .jar available and that we should link the source code to your Eclipse project”…

    Can you give us a step-by-step description?

    Thanks \o_

  27. Leo says:

    The engine looks great and I can’t wait to start using it. Could you please give some instructions on how to import the project. It complains about a source directory that appears hard coded somewhere, but i can’t find it to change it. That being said I am also a beginner so it’s probably my fault.

    Thank you for offering us all source code and the MIT license.

  28. Kevin Baker says:

    I had the same issue as Leo.

    Solved by creating the folder ‘source’ in Eclipse (at the same level as ‘src’ folder), this removes the ‘error’ situation. Then you can right-click on the newly created ‘source’ folder and remove it.

    By the way, this library is great! Been looking for something like this for a few days now.

  29. Kevin Baker says:

    I would also add that all the demos worked perfectly on my HTC Desire running Froyo 2.2.

  30. catarina says:

    Hi,
    It work just fine, but when I try to use my own models, I can’t find a way to tell it which texture to use.
    Thanks

  31. Nate says:

    I want to extend your library to create a class that draws lines dynamically at runtime and am wondering what the best way to do that might be. The way I see it I have two options since the byte buffer can not have vertices added dynamically:

    1) Create a mutable Object3DContainer class using an array list to hold the vertices.
    2) Create a class that holds a bunch of line segments, each segment being it’s own container that shares a point with the previous line.

    Option 1 would probably be the fastest but option 2 would remain within the confines of the framework. Any suggestions in this matter would be appreciated.

    -Nate

  32. Pleyas says:

    Hi and thanks!
    Great framework…

    Are you planing to update it to OpenGL ES 2.0?

  33. pradeep says:

    Thanks,
    My first attempt using Min3D ,
    Checkout,

    http://iamdigger.tumblr.com/

    somehow i got 3d models from net, i scaled them for android, and tried , first time it was rocket science for me, as i started step wise, i was able to figure out this .

    Still i am not able to make it optimized (like using UV cords – frankly i don’t know these things in detail) , if you have any comments, please email me,
    Thanks agains,

    it’s great tool ,

  34. Deepa says:

    Thanks for such a nice framework for 3d. Its really helpful to newbie like me. I have successfully loaded 3d model but i am struck with the touch event. i need to touch the model alone. When i use touch event it sensing the screen alone not the model.

    How to implement touch event ? please any one give some suggestion.

  35. lacroix says:

    It is possible to use this as a live wallpaper?

    Thanks for the answer

  36. Hi Guys,

    Nice post, I have picked up a few tips from this :)

    Cheers for the share.

    I will pop back soon for updates soon to see if it can help me out.

    Thanks

    xx

  37. Kanishk says:

    Thanks a ton for this cool framework! Using it in one of my school projects and the results are amazing :) Cool job on the extensive framework and functionality. Would be really great if some kind of documentation would be available though

  38. skyblue says:

    3d object loaded using min3d framwork but while i start rendering on it, just black and whit object appears. not succes in maaping the object in emulator.

  39. saranya says:

    how to make project on Eclipse with min3d????Please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  40. saranya says:

    haii,
    I am interested to import a 3d object in android.I am not all expert in open GL.I go through this link http://code.google.com/p/min3d/downloads/list and download the apk.I don’t know how to install it.Please let me know.Step by step process.please!!!

  41. Arun Goyal says:

    Hi saranya

    put it in to device and click on it and press button for installation it’ll be successfully installed.

  42. Arun Goyal says:

    HI all

    I just wana to know how can i change the texture at run time of obj file in android

  43. Aditya Rajawat says:

    Hi,
    I am parsing 3D model using Mind 3D library..in logcat their is no error but my object is not display on emulator.provide some valuable suggestion.

  44. bhau says:

    is it possible to rotates objects on touch Event .please tell how………….

    i am tries to rotates using following code …but it not works properly…….
    please tell what correction required……….

    my code is……………………..

    package ezeelearning.tablet.min3d.sampleProject1;
    import android.opengl.GLSurfaceView;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.Gravity;
    import android.view.MotionEvent;
    import android.view.View;
    import android.view.ViewGroup.LayoutParams;
    import android.widget.Button;
    import android.widget.LinearLayout;
    import ezeelearning.tablet.R;
    import ezeelearning.tablet.min3d.core.Object3dContainer;
    import ezeelearning.tablet.min3d.core.RendererActivity;
    import ezeelearning.tablet.min3d.parser.IParser;
    import ezeelearning.tablet.min3d.parser.Parser;
    import ezeelearning.tablet.min3d.vos.Light;
    public class ExampleLoadObjFlower extends RendererActivity{
    private Object3dContainer objModel;
    Button b;
    protected GLSurfaceView _glSurfaceView;
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _glSurfaceView = new GLSurfaceView(this);
    }

    public boolean onTouchEvent(MotionEvent event) {

    int action = event.getAction() & MotionEvent.ACTION_MASK;
    switch(action) {
    case MotionEvent.ACTION_DOWN : {

    objModel.rotation().x=objModel.rotation().x+10;
    Log.d(“CV”,”ACTION_DOWN”);

    break;
    }
    case MotionEvent.ACTION_UP : {

    objModel.rotation().x=objModel.rotation().x-10;
    Log.d(“CV”,”ACTION_DOWN”);

    break;
    }

    }

    return true;
    }
    public void initScene() {

    scene.lights().add(new Light());
    IParser parser = Parser.createParser(Parser.Type.MAX_3DS, getResources(),
    “ezeelearning.tablet:drawable/monster_high”, true);

    parser.parse();
    objModel = parser.getParsedObject();
    objModel.scale().x = objModel.scale().y = objModel.scale().z = .7f;
    scene.addChild(objModel);

    }

    public void updateScene() {
    //objModel.rotation().x++;
    //objModel.rotation().z++;
    }

    }

  45. Adrian says:

    I make same u say in tutorial Loading 3D models with the min3D framework for Android , now i need 4 buttons , for move the object in left , right , up and down , i push in acitivity_main :

    and this button , is hidden or i dont know what heppend becouse i run app on my phone and not seen …

    can u help me for that ?

    pls help me !
    i wait your awser

  46. I adore this weblog, excellent content material and I am going to bookmark this web site for future updates.

Leave a Reply