I've spent a few hours looking at the problem I'm going to describe and I've looked through the forums and have found posts that appear like they would help, but didn't.
Essentially, I'm building a test world to experiment with in regard to learning about elements needed to build a game. I was making progress until I got hung up on not being able to see a material properly on a very basic 3ds model (a cone with a green material – exported from blender) that I'm using to represent the player. For the test world I have used a the Flag Rush Tutorial as a template. The model that does not look right is mostly white with only a strip of green on the side that is facing away from the light. I was expecting it to be solid green and light-shaded correctly. I have looked at a test case using SimpleGame and get the same results (except using a sphere model and a sphere shape). Here are two images of the test world and the test case:
http://picasaweb.google.com/ashtonv/UntitledAlbum/photo?authkey=BFMBNDKAVo4#5136204067129409538
http://picasaweb.google.com/ashtonv/UntitledAlbum/photo?authkey=BFMBNDKAVo4#5136205411454173202
The test case code barely needs to be shown, but here it is anyway:
protected void simpleInitGame() {
URL modelURL=TestModelMaterial.class.getClassLoader().getResource("testmodelmaterial/psphere-1a.3ds");
FormatConverter converter = new MaxToJme();
ByteArrayOutputStream BO=new ByteArrayOutputStream();
try {
converter.convert(modelURL.openStream(), BO);
model=(Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
model.setModelBound(new BoundingBox());
model.updateModelBound();
} catch (IOException e) { // Just in case anything happens
logger.logp(Level.SEVERE, this.getClass().toString(),
"simpleInitGame()", "Exception", e);
System.exit(0);
}
s = new Sphere("sphere", 20,20,1f);
s.setLocalTranslation(new Vector3f(5,0,0));
s.setModelBound(new BoundingSphere());
s.updateModelBound();
rootNode.attachChild(s);
rootNode.attachChild(model);
}
}
I'm sure the answer to this is a no-brainer, but I'm new around here and don't have a monkey's brain yet. Any help would be appreciated.
Ashton
You probably set some settings on the 3ds exporter which makes it use flat shading or similar on the model.
Check your settings, or alternatively you can try using a different export plugin:
http://www.jmonkeyengine.com/wiki/doku.php?id=exporting_.obj_models_from_blender
http://www.jmonkeyengine.com/wiki/doku.php?id=exporting_animated_.md3_models_from_blender
http://www.jmonkeyengine.com/wiki/doku.php?id=exporting_animated_.md5_models_from_blender
I was able to get the expected results using the .obj format (it did not work before because I had the convert openstream call before the set properties call – which I suppose makes perfect sense). There do not appear to be 3ds export settings in Blender (that I have found as yet). I will look into the other file types you mentioned. Thanks.
Although I am curious if anyone has any success with 3ds models with materials, or any other suggestions… the Flag Rush model was 3ds if I'm not mistaken and the one packed in with the tutorials looks just fine…