Maya 2011 - 3D Model is white

So, if I load an 3d model (.obj), it’s always white. I created it in maya 2011 and colored it in blue, loaded it in JME and the model appears white:



ObjToJme converter = new ObjToJme();

try {

URL objFile = new File(“Model/Target.obj”).toURI().toURL();

converter.setProperty(“mtllib”, objFile);

converter.setProperty(“texdir”, objFile);

ByteArrayOutputStream BO = new ByteArrayOutputStream();

converter.convert(objFile.openStream(), BO);

target = (TriMesh) BinaryImporter.getInstance().load(

new ByteArrayInputStream(BO.toByteArray()));

} catch (IOException e) {

e.printStackTrace();

}



rootNode.attachChild(target);




But if i create an model with a texture (for example: a wall) the wall-texture appears on the model…So, what am I doing wrong…? :S

How are your normals set for the model? You might have to find the MaterialState once the model is loaded and set the faces to appear differently (front face or back face or both). I’ll post a snippet for you on how to do this…

Here’s that snippet :slight_smile: http://hub.jmonkeyengine.org/groups/general-2/snippets/single/9/

Hmm…this doesn’t work for me… Is it possible that there is a property for the converter for colors or something :)? (converter.setProperty(“mtllib”, objFile); converter.setProperty(“texdir”, objFile):wink:

No properties should be needed… Can you provide any other information about the model, or perhaps a Maya ASCII?

hmm…i don’t know…but if I use a texture from a picture, it works. But if I use a texture from Maya (stones, wood…etc) it doesn’t work…

I don’t think Maya exports those built in textures by default, but then again I’ve never really found any use for them so I could be wrong.



Have you tried using COLLADA (the built in dae_fbx exporter should work) or Ogre?

I use Maya and to be honest Maya OBJ export is a bit buggy xD. I have a similar problem.

I solve that with Milkshape (Import OBJ and Export it again with Milkshape). Maybe you can use any other program, Blender for example.

Give it a shot, if it’s still not working, send me your maya file and i will look into it :wink:



EDIT:

Build-In textures are not exported

ok…I tried it with different Programs, but it won’t work…:frowning: How I can send you the file?

We don’t have an attachment system set up in the new forums unfortunately (looking into it!), so your best bet for now is to stick it on a free file hosting site (just google that term, there are likely thousands around!)

ok.It’s just a simple cone…here is the Model.obj



ultrashare.de - ultrashare Resources and Information.



and the Model.mtl



ultrashare.de - ultrashare Resources and Information.



so…I’ll be happy if you could do something…:slight_smile:

ok…I forgot to go make a light for the object…So now if I use for example a DirectionalLight, I can see the color of the model…But there’s a problem: Not all the faces of the model are in color, some are black; the faces are transparent; and if I walk into it, the model is black…How I could solve these problems…?

Glad to hear you’ve got part of the problem solved :slight_smile:



The reason you’re only seeing parts of the object in light is because the DirectionalLight is only hitting certain faces of the object. Try setting up an opposing light facing the opposite direction and see where that gets you…

hmm…I don’t like lights…:expressionless: Is there a way to make a light, that shines over all objects in the scene…? Because if I try it with severals DirectionalLights, there is always a bit wich is black or gray.

A PointLight would be the closest thing to this, shining in all directions from its position. Scattering a few of those around should give you pretty good coverage

sry…but I don’t get it…I use several pointLights, but it looks always something like this:



http://i56.tinypic.com/2z882g2.png



Is there somewhere a piece of code or a tutorial how I can do it?