-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for imported models rendering solid black #89
Comments
I have to check that it really sets MaterialColors to false. Maybe they are disabled in Blender as well? |
Adding a light via the scene editor only affects certain objects in my scene. Many of the meshes render solid black while the ones affected by the light only absorb low levels of the light. I found you can over come this by creating a new custom material which is a hassle to do this for every object when you have scenes like that contains hundred to thousands of meshes. I found running the above code block fixes it then I save the node after correcting the material settings. I think it has something to do with the way blender exports materials it leaves certain settings blank. I also had this problem with a few wave front files but only a very few. Blender files have this problem often. |
I have to see what a core member is saying to this. Whether it's okay to "simply" overwrite what were blender settings (Maybe you can also figure those out?). |
Sorry for the Delay, but: That's the keypoint here, it seems to me that this requires the correct setup on the blender side.
So that to the VertexColor.
You use a DiffuseMap (aka Texture) I guess?
This might be a good hint. I've always had problems since my Ambient Color was set to Black. That way it wasn't effected by Ambient-Lighting.
It could be that you've set the DiffuseColor to black in Blender or something? |
I was doing some fiddling around with this and I found if you create a custom texture with the SDK that the only parameter checked is "UseVertexColor". Unchecking the vertex color fixes it. This represents a problem because it means I would have to add the custom material to every object manually. I also imported an individual wave front file directly using the SDK and the materials rendered correctly. Blender is zeroing out certain parameters such as ambient and specular plus doing some other unknown functions to the file. I also noted the wave front files will import with out being triangulated but the same file saved in blender format must be triangulated to import properly. I'm currently using Blender 2.77a. It could be a backwards compatibility issue. The method I mentioned while not perfect makes a quick fix for the issue. Maybe one day we can find a Blender wizard who can make a .j3o exporter and all of our problems will solved :> |
I'm not sure if this was fixed yet but I found a solution to the problem with the models showing all black after importing. It seems to be coming from the material option. I found running the code block below on my scene fixes the issue 100% of the time.
public void clearMaterialOptions(){
gameManager.node.depthFirstTraversal(new SceneGraphVisitor() {
public void visit(Spatial spatial) {
if (spatial instanceof Geometry){
Geometry geo = (Geometry)(spatial);
geo.getMaterial().setBoolean("UseVertexColor", false);
geo.getMaterial().setBoolean("UseMaterialColors", true);
geo.getMaterial().setBoolean("VertexLighting", true);
}
}
});
}
It looks like importing blender models and certain wave front files leaves only the vertex color option on and disables everything else.
The text was updated successfully, but these errors were encountered: