I have created a character model in Blender which I have successfully exported to jMonkeyPlatform. My problem is that my character’s hair is (more or less) a plane curved around the character’s head. This causes the inside face of the hair to be culled. I would like both the front and back faces of the hair to be visible.
I researched online and I found that this problem was solved in jme2 by adding a CullState set to CS_NONE to the scene graph.
https://wiki.jmonkeyengine.org/legacy/doku.php/jme2:cullstate
However, I cannot find such a CullState in jme3.
Is there something like CullState in jme3 that I should use? Or would it be easier or faster to add an extra face to the interior of my character’s hair.
I am quite new to jme. If my question is not clear, please ask me how I can elaborate. Thank you for your help.
This can be set on the material as part of the additional render states.
http://hub.jmonkeyengine.org/javadoc/com/jme3/material/Material.html#getAdditionalRenderState()
…and…
http://hub.jmonkeyengine.org/javadoc/com/jme3/material/RenderState.html
…see FaceCullMode specifically.
Thanks for your quick reply @pspeed.
I have one quick follow up question: how do I access my model’s material?
Like I said in my previous post, I created my character model in Blender and exported it with Ogre. In my Project Assets my model is split up into five meshes (Hair, Body, Eyes, Shirt, Pants). I also have a scene file and a .material file, which contains the material information for my meshes.
Is it possible to access just the Hair material and apply the render/cull states that?
I guess there might be a way to convert the .material file from the Ogre export to a jm3d material file. Is there a way to do this?
Thanks
When you load it in JME, do you load it as separate meshes or as one put-together model?
If the hair is loaded as its own object, then could maybe just check its material and/or traverse its children and check their materials. Once you have a reference to the right Material object, the rest should be easy.
I don’t know if there is a way to do it to the files themselves but yeah, having the j3md would be the first step. I’m not familiar enough with JMP and its import processes to know how one would go about that. I had to nuke transparency in one of my model’s materials and used the process the previous paragraph describes.
I followed this workflow to export my character model from blender:
https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&hl=en&pli=1
In JMP have them as 5 separate meshes (one of which is the hair), a scene file and a material file. The material file has the same name as the scene file, which allows the correct materials to correspond to the correct meshes (which I think is described by the scene file).
Yeah, I’ve never tried that I guess. Hopefully someone else can offer more advice… as I said, I ended up just fixing mine in code.
OK, i fixed it by editing my character model in blender. I ended up just adding another face to the inside of the hair. Now the hair shows up. This is probably simpler than messing around with material files and such.
It seems the OgreXML exporter ignores the “double-sided” property in Blender, while the OBJ format does not support it at all.
There’s nothing we can do about this …
Thanks ok, I’m happy with my solution