Hi,
Please can someone offer some guidance on the blender importer?
I am trying to import a blender model programatically using the default asset manager registered loader.
The imported spatial has 2 materials {blue and white in the example} but the third material is a shade of grey
Also none of the materials support ambient lighting
Is this a restriction of the blender loader?
Are then any workarounds I can use to set the ambient colour on the model material?
My simple application
import com.jme3.app.SimpleApplication;
import com.jme3.asset.BlenderKey;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
public class BlenderImport extends SimpleApplication
{
private Spatial m_cube = null;
@Override
public void simpleInitApp()
{
BlenderKey keyAsset = new BlenderKey("Cube3colours.blend");
m_cube = assetManager.loadModel(keyAsset);
rootNode.attachChild(m_cube);
AmbientLight lightAmbient = new AmbientLight();
lightAmbient.setColor(new ColorRGBA(0.8f, 0.8f, 1.0f, 1.0f).mult(2.0f));
rootNode.addLight(lightAmbient);
DirectionalLight lightDirection = new DirectionalLight();
lightDirection.setDirection(new Vector3f(0.0f, -1.0f, -1.0f).normalizeLocal());
lightDirection.setColor(ColorRGBA.White.mult(2.0f));
rootNode.addLight(lightDirection);
flyCam.setDragToRotate(true);
flyCam.setMoveSpeed(27);
viewPort.setBackgroundColor(new ColorRGBA(1.0f, 0.9f, 0.8f, 1.0f));
}
@Override
public void simpleUpdate(float tpf)
{
float fAngle = (float)(Math.PI / 17) * tpf;
m_cube.rotate(fAngle, 0.0f, fAngle);
}
public static void main(String[] ascArgs)
{
BlenderImport mainApp = new BlenderImport();
mainApp.start();
}
}
What the blender model looks like …
What the app looks like …
Thank you for any help
Martin