[SOLVED] Maya material export

Hi monkeys,

I’m here to ask you something probably very basic but I’m just a programmer so I know really a little regarding the graphical part. Here’s the problem: I’m trying to import into a JMonkey program a model I built using Maya following this tutorial http://www.youtube.com/watch?v=F4atiGNVP0c.

I exported the model using the Ogre exporter and then convert the mesh in xml. Everything works perfectly but there must be something I don’t understand regarding the export of materials. This a render of the model in Maya, it looks ok

http://i.imgur.com/fIF80.png

But this is the result in jMP

http://i.imgur.com/wrkG1.png

The model is composed by three spheres. The outer one represent the atmosphere and should be transparent, but in jMP is completely opaque. Moreover the middle sphere is the cloud texture and in the material file there’s no reference to that texture file. While for the land (the inner shpere) the texture file is correctly present also in the material. As you can see in jMP the only visible things is the outer blue shpere that should represent the atmosphere.

Here’s the material file generated.

[xml]material AtmosphereMaterial

{

technique

{

pass

{

ambient 0 0 0 1

diffuse 0 0.433333 1 1

specular 0 0 0 1

emissive 0 0 0



scene_blend alpha_blend

depth_write off

}

}

}

material CloudMaterial

{

technique

{

pass

{

ambient 0 0 0 1

diffuse 1 1 1 1

specular 0 0 0 1

emissive 0 0 0



scene_blend alpha_blend

depth_write off

}

}

}

material LandMaterial

{

technique

{

pass

{

ambient 0 0 0 1

diffuse 1 1 1 1

specular 0 0 0 1

emissive 0 0 0



texture_unit

{

texture earth_land.tga

tex_coord_set 0

colour_op modulate

scale 1 1

scroll 0 0

rotate 0

}

}

}

}

[/xml]

I know little about the material export process so I don’t know if I’m simply missing something or there’s something wrong going on during the export process. What should I do to obtain a rendering result inside jMP similar to the one in Maya?

Thanks in advance for any help! :slight_smile:

Maya is a 3d editor thats also intended for offline rendering so you can never expect live rendered materials to look like the effects in Maya do. Because some effects require massive computations stuff like this is done in shaders that are computed on the GPU. So for effects or anything like that you need a shader that does the same in jme. Mapping some 3d editors effects to shaders in an engine would be a very specific process hence no exporter really does this and its also not the way to go generally.



What you need to do is make game-compatible models. This basically means that you should make UV-mapped models that have diffuse, normal and specular maps (maybe light maps as well) and use only one texture or even better part of a bigger texture atlas that you create for the game and that is shared between models. These models will load splendidly in the engine and then you can apply engine-specific effects to the models using the existing or new shaders (if thats at all needed cause models done properly this way usually look plain awesome).



The wiki has a lot of information about OpenGL (rendering) and about how to make proper game compatible models.

Thanks for the clarification. In my ingnorance I thought that the export process of the material would have kept a much more similar results. I’m aware that Maya and JM3 have different way to render a scene, but I thought that the material file was a container for all what is needed for a rendering engine to display an object, even if they do it in different ways.

I’m also looking at this great example (I found it just after having posted) http://hub.jmonkeyengine.org/groups/user-code-projects/forum/topic/planet-shader-and-atmosphere-scattering/. It is extreamily close to what I would like to obtain, so I think I have something to study for a while. :smiley:

Thanks a lot.

Nearly everything in that material file is incorrect vs. the result you’re trying to achieve. The atmosphere material is completely opaque (alpha = 1) and is influenced by lighting. The cloud material is missing the texture, probably because its procedural.

You can fix the issues by creating your own materials in jMP and applying them to the model parts

Thanks Momoko_Fan,

yeah I will go for manual material creation. I’m also looking into shaders as I really a newbie in shader programming. Do you have any suggestion like books, tutorial or article that explain shader and material from the beginning? I already check the wiki but I like to start things from the very beginning in order to understand the basics. Anyway thanks a lot for helping. :slight_smile:

The good thing is that you don’t have to fix the material (not in this case). Just go into jMP material editor and set the proper parameters.

If you want to learn shaders, you probably want to look into GLSL. There are many tutorials online about it

Thanks Momoko_Fan, I’ll do it.

Hi monkeys,

after playing around with the material editor I ended with this result. It is not as good as the atmosphere scattering shader but for me it’s enough, I can consider myself happy. Thanks again for the support.



http://i.imgur.com/MAyLb.jpg

2 Likes

Great work! Can’t wait to see what you do with this :slight_smile: