2014-03-02 294 views
0

剛擡起頭,我真的很新的這個很抱歉,如果我的問題是不清楚:LibGDX 3D模型紋理不正確的渲染

我做了使用攪拌機的3D模型,並作爲我的模型材料我只是使用了具有光澤和漫反射紋理的混合着色器。我試圖讓它在LibGDX中正確顯示。當我呈現在攪拌機的模型,這裏是什麼樣子: enter image description here

我然後導出到FBX,然後使用FBX-CONV將其轉換爲一個.g3db文件的文件,但是當我嘗試加載模型在我的代碼(取自http://blog.xoppa.com/loading-models-using-libgdx/):

public class Basic3DTest implements ApplicationListener { 
PerspectiveCamera cam; 
public CameraInputController camController; 
public Environment environment; 
public ModelInstance instance; 
public ModelBatch modelBatch; 
public AssetManager assets; 
public Array<ModelInstance> instances = new Array<ModelInstance>(); 
public boolean loading; 

@Override 
public void create() { 
    modelBatch = new ModelBatch(); 
    environment = new Environment(); 
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 
      0.4f, 0.4f, 1f)); 
    environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -.5f, 
      -0.6f, -1f)); 
    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), 
      Gdx.graphics.getHeight()); 
    cam.position.set(10f, 10f, 10f); 
    cam.lookAt(0, 0, 0); 
    cam.near = 0.1f; 
    cam.far = 300f; 
    cam.update(); 
    camController = new CameraInputController(cam); 
    Gdx.input.setInputProcessor(camController); 
    assets = new AssetManager(); 
    assets.load("data/Space Game/ModelData/blinky.g3db", Model.class); 
    loading = true; 
} 

    private void doneLoading() { 
     Model ship = assets.get("data/Space Game/ModelData/blinky.g3db", Model.class); 
     ModelInstance shipInstance = new ModelInstance(ship); 
     instances.add(shipInstance); 
     loading = false; 
    } 

@Override 
public void dispose() { 
    modelBatch.dispose(); 
    instances.clear(); 
    assets.dispose(); 
} 

@Override 
public void pause() { 
    // TODO Auto-generated method stub 

} 

@Override 
    public void render() { 
    if (loading && assets.update()) 
     doneLoading(); 
    camController.update(); 

    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); 
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); 

    modelBatch.begin(cam); 
    modelBatch.render(instances, environment); 
    modelBatch.end(); 
} 

@Override 
public void resize(int arg0, int arg1) { 
    // TODO Auto-generated method stub 

} 

@Override 
public void resume() { 
    // TODO Auto-generated method stub 

} 

}

這裏顯示的內容: enter image description here

任何想法可能是錯誤的?預先感謝一堆。

回答