In my libGDX project i'd like to create a 3D background image as it can be found in ChessGDX (see. e.g. https://www.youtube.com/watch?feature=player_embedded&v=u0ezavUIsTU starting from second 31)
My example
public class Test implements ApplicationListener {
...
@Override
public void create() {
...
Model cubeModel = modelBuilder.createBox(5f, 5f, 5f,
new Material(ColorAttribute.createDiffuse(Color.GREEN)),
Usage.Position | Usage.Normal);
cube = new ModelInstance(cubeModel);
...
assetManager.load("background.g3db", Model.class);
assetManager.finishLoading();
Model backgroundModel = assetManager.get("background.g3db", Model.class);
for (Material material : model.materials){
material.remove(ColorAttribute.Emissive);
}
background = new ModelInstance(backgroundModel);
}
@Override
public void render() {
Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
modelBatch.begin(cam);
if (background != null) {
modelBatch.render(background);
}
modelBatch.render(cube);
modelBatch.end();
}
works fine if i use "background.g3db" from the ChessGDX project (from https://github.com/nkarasch/ChessGDX/tree/master/core/assets/3D/models).
Now i want to create a own background based on some image. I tried:
- Downloading precompiled binaries from https://github.com/libgdx/fbx-conv
- Create a g3db from a blender model
export LD_LIBRARY_PATH=.
./fbx-conv -o G3DB test1.fbx test1.g3db
But using my "test1.g3db" shows only a black background. I'm pretty sure my blender model is wrong since i never used blender before...
My questions:
- Is there a tutorial to do exactly what i want? I know there are many good blender tutorials but i don't want to learn blender right now (sorry, maybe in the future)... (i have seen some tutorials creating a model, not a background as needed)
- Is it possible to create a own 3D background based on some image without using blender and fbx-conv?
- Is there some "predefined" blender-File which i could edit/change in a text-editor (e.g. replace some jpg/png) which i could use with fbx-conv?