New 3D API in master

Xoppa and Bach have been slaving away on the new 3D API for a few months, it’s finally in a state where we want to push it to master, meaning it will also end up in the nightlies.

The API is done in its first iteration, but we’ll clean it up and modify it a bit according to user feedback. There is one known issue at the moment: the shader files used to render stuff are currently classpath files. This means they won’t work on GWT/iOS out of the box. This also affects the gdx-invaders project. We’ll fix that and other issues we discover asap.

The new API can read OBJ files, and G3DJ/G3DB files as produced by fbx-conv, out FBX to libgdx converter. I’ll provide binaries for that command line tool shortly for all desktop platforms. You can then convert FBX files as exported by Blender, Softimage, 3DSMax and Maya to our optimized format.

We’ll follow up with more examples and documentation in the coming weeks. For now you can check out gdx-invaders new Renderer implementation, and the tests in this package. Note that gdx-invaders is currently not MVC, i’ll revamp that asap.

To summarize the todos:

  • clean up code and Javadocs
  • write excellent wiki articles
  • fix shader classpath issue for gwt/iOS
  • provide binaries for fbx-conv, add it to the build server
  • there appears to be a bug in AssetManager/TextureLoader which also needs fixing
  • you give us a bit more time to do all the above and don’t get angry if we break a few minor things

Stay tuned!

  • Vince aka Ange_blond

    Very good news !
    Thanks a lot for this huge amount of work :-)

  • Mark England

    Big thanks to you all, have been eagerly awaiting this.

    Can you please explain what it means that the Shaders are Classpath files? The reason that I ask is that I want to implement a custom Shader (replace the vertex/fragment glsl file with my own with some mods). Is there a good was to do this currently?

    Can any previously generated G3D files still be used? Or should we re-import any OBJ files to the new format? (I think I already know the answer to this, as I’m sure you guys moved away from G3D for a reason right?)

    Thanks Mario.

  • badlogic

    The 3D renderer for OpenGL ES 2.0 needs GLSL shaders to work. We provide an ubershader in form of two files, stored in the package com.badlogic.gdx.graphics.g3d.shaders (see https://github.com/libgdx/libgdx/tree/master/gdx/src/com/badlogic/gdx/graphics/g3d/shaders). That shader implements lighting, skinning, normal mapping and all kinds of other crazy things.

    The DefaultShader class (https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g3d/shaders/DefaultShader.java) uses that GLSL shader to do its work if no shaders are passed to it in the constructor. These files are stored in the gdx.jar file, and hence only accessible via Gdx.files.classpath, which doesn’t work on GWT and iOS.

    You can for now customize the shader used by DefaultShader by constructing it with an approriate GLSL shader pair. However, we are working on a way to inject shader snippets in the DefaultShader GLSL code so you don’t have to copy & past and modify the uber shader (which actually isn’t an uber shader).

    Previous G3D files can not be used i’m afraid. The new file format is a lot better, and also includes hierarchy information, something the old one didn’t. It’s basically one easy to parse/render file format to rule them all, as oposed to the different formats we had in case of G3D.

  • Mark England

    if I Copy & Paste/Modify the Uber Shader and pass it my different versions down through the DefaultShader Constructor, will they still perform in the same way as normal? To be specific, will all the Uber Shader stuff like the #ifdef lines in the shader work correctly?

    To explain for people who may not know, the Uber Shader files have a whole bunch of #ifdef lines, of which the corresponding #define ‘s are added at runtime depending on things like if your Models have certain Attributes (I think!)

  • http://www.chrismweb.com/ chrismweb

    More source code to read through and learn from! Sheesh, you guys are awesome!

    Is there a place to see the upcoming/ planned features? What’s left after 3d? Networking, AI….

  • nakasya

    Awesome improvement in new 3d api. Thank you.

  • kubeczek

    This one just make my day :D Really awesome news guys!

  • Methius

    Thanks! I’ve already been following your every move on the branch; excited to hear its finished!

  • badlogic

    Yes, they should, provided your GLSL modifications don’t break things.

  • dud3z

    Great to see this merged, nice work guys, keep up the good work!

  • Do Anh Tuan

    Awesome, i can’t wait to see it in stable. I’ll try it right now.

  • Mister Burns

    Gnihihihi… Excellent!

  • drabiter

    Thanks for the work! Gonna wait it on stable build.

  • James

    I’ve been trying to find where these new exporters are for blender. Is there any better direction/documentation you can give us about getting our models converted?

  • scape

    so what is the preferred method for getting blender animated meshes into libgdx? i’ve been following so many breadcrumbs, seems blender export script is missing now.. should i export to fbx and then run the fbx-converter?