Model lost color on Blender import

Hi all,



When I import from blender some parts of my model loose their color.

This might be a newbie mistake but I have read through hello assets and external:blender and only found reference to much more complicated things. All I need is a gray sub.



Here is an example:



Blender:



JME:





If I use:

[java]Material mat = new Material(assetManager, “Common/MatDefs/Misc/ShowNormals.j3md”); // default material[/java]

I get a pinkish model.

Try to join the objects in blender or make sure you use a .scene file and export all single objects if you want to move them separately or something. It would be better to make it one mesh/texture and animate the mesh instead though.

hehe, or just make j3m file and apply it to j3o model :slight_smile:



much better IMO.



about your issue, i think you just dont have your images in model directory. all textures need to be in same directory where model is.(as i good know)


"Common/MatDefs/Misc/ShowNormals.j3md"

j3md is a material definition file.
showNormals show the normal vectors(you need to read about for example "normal Maps" to understand)

that is why you get that colors.

rather you should use
"Common/MatDefs/Light/Lighting.j3md"
and set the colors in code
for example:
[java]mat_lit.setBoolean("UseMaterialColors",true);
mat_lit.setColor("Specular",ColorRGBA.Green);
mat_lit.setColor("Diffuse",ColorRGBA.Green);[/java]

but it's not a way you should go. better to make j3m file and edit it via SDK. Then apply it to model via scenecomposer in SDK.

j3m != j3md

here are some help:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:materials
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:material_definitions
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_material
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:material_specification
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:how_to_use_materials

normen: I did not understand your tip. There is only on object, I imported it with the SDK’s importer. If I open the model in the scene composer I get the same thing. They are separate vehicle one of which moves forward, an animated mesh is necessary for this?



This is for simple animation and that’s the whole of the animation. My idea is to:

  1. Make model with flat color only. (just set the diffuse color to gray or yellow)
  2. Import the .blend
  3. Add two to the scene with

    [java]Spatial model = assetManager.loadModel("modelPath");[/java]
  4. Scale one of them to be smaller with

    [java]model.scale(0.1f);[/java]
  5. Move the small guy forward



    @oxplay2: There are no separate images, it’s a simple gray color. Isn’t it possible to import color from blender? just shape?

    I agree that using Lighting.j3md and setting the color is not the way to go.

@kotoko

normen want you to join “parts” to one mesh/object, propably because you said:

When I import from blender some parts of my model loose their color.


1. Make model with flat color only. (just set the diffuse color to gray or yellow)

then just not Lighting, but Unshaded...

what can i say when you even do not read documentation/links that i gived you.

Blender have materials
JME have materials

my idea for you was to make JME material instead of blender material.

but if it's too hard for you, then i can't help that way, sorry.

i imported blender material several times, but it was 1 year ago. So maybe something changed.
But why i do not import actually? Because it's better to make j3m file.

look at your screenshot
Blender use something to Lighting material, so it is
diffuse color: 0.775
specular color: 0.437

it is not one color! in Blender you also use 2 colors.

remember, there can be always other issue, that you can get white model because of "too much light"

Are you using OgreXML, OBJ, or Blend importing?

It’s a Blend model.



Sorry, for the delay.

I ended up doing the whole thing in Blender.

The recommended way of exporting is by using the Ogre exporter script from blender. You can import .blend files, but they don’t always work. Also, you can give it a material yourself. In JMP, just create a new material, use Unshaded.j3md as definition if you want a solid color and Lightning.j3md if you want to use lights (lighting looks the most realistic, but don’t forget too add a light when you use it). Then just set the color too the color you want. Just leave everything else in the material editor empty.