I’ve poked around in the tutorials and in the API, and I can’t figure out how to fix this.
See the attached image. This is a model that I imported from Blender being rendered in jME3. The lights tend to turn the surfaces of the model white. I’m trying to avoid this, or at least mitigate it.
Do I have to do this in Blender, or is there some way to grab the material from the imported model, and adjust the specularity?
Thanks!
What’s that model’s extension? Wavefront(.obj) or OgreXMl(.mesh.xml)?
It’s an OgreXML import.
What material are you using, the default, exported by OgreXml?
Change the specular color in the blender material to black
I did that, actually (change the specular color of the Blender material); the picture above was exported with specular color set to black. Is there some trick with saving before exporting or something to make that work?
I am using whatever material the OgreXML plugin for Blender exports.
Dude, post the material code.
Also curious what your lighting setup is.
Material code? I’m not dealing with any Material objects at all on the Java side:
[java]
guiNode.detachAllChildren();
Spatial normalHuman = assetManager.loadModel(“Models/NormalHumanModel/Cylinder.mesh.xml”);
normalHuman.scale(0.1f, 0.1f, 0.1f);
normalHuman.rotate((float)(-Math.PI/2.0), 0.0f, 0.0f);
rootNode.attachChild(normalHuman);
viewPort.setBackgroundColor(ColorRGBA.DarkGray);
// You must add a light to make the model visible
for (float x = -1.0f; x <= 2.0f; x += 2.0f) {
for (float y = -1.0f; y <= 2.0f; y += 2.0f) {
for (float z = -1.0f; z <= 2.0f; z += 2.0f) {
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(x,y,z));
rootNode.addLight(sun);
}
}
}
[/java]
From that you can also see the lighting setup. Eight lights surrounding the model.
Here is the material file that the Blender plugin exported:
[xml]
material Material/SOLID/TEX/HighContrast.png
{
technique
{
pass
{
diffuse 1.000000 1.000000 1.000000
specular 0.000000 0.000000 0.000000 12.500000
texture_unit
{
texture HighContrast.png
}
}
}
}
[/xml]
What’s up with the 12.5 on the specular value?
DERP.
Human error: The XML I posted is indeed what the Blender plugin produced, but for some reason I didn’t copy that file over.
Thanks for your help!
You can create a j3m file from the material using the latest svn version of the SDK, then tweak that to get the desired effect.
eubarch said:
What's up with the 12.5 on the specular value?
Did you try set the specular value to 0 by hand in NormalHumanModel.Material?
You can create a j3m material as normen said.
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:materials_overview
Also… just for fun, try normalizing your light directions:
sun.setDirection(new Vector3f(x,y,z).normalize());
I don’t think that’s the problem but there is some paranoia that makes me always normalize those and I can’t remember exactly why.
…and that’s a lot of light. I’d expect anything to be pretty washed out at that point.