MaterialFace.FrontAndBack does not work?

I do not get the MaterialFace.FrontAndBack to work.

See example: the front and back face of the quad should be red.

But only the front face is red!!!



import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.TriMesh;
import com.jme.math.Vector2f;
import com.jme.scene.Node;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.MaterialState;
import com.jme.system.DisplaySystem;
import com.jme.scene.Geometry;
import com.jme.renderer.ColorRGBA;

public class TestMaterial extends SimpleGame
{
   private TriMesh t;
   private Quaternion rotQuat;
   private float angle = 0;
   private Vector3f axis;

   public static void main(String[] args)
   {
      TestMaterial app = new TestMaterial();
//           app.setConfigShowMode(ConfigShowMode.AlwaysShow);
      app.start();
   }

   protected void simpleUpdate()
   {
      if (tpf < 1)
      {
         angle = angle + (tpf * 50);

         if (angle > 360)
            angle = 0;
      }

      rotQuat.fromAngleNormalAxis(angle * FastMath.DEG_TO_RAD, axis);
      t.setLocalRotation(rotQuat);
   }

   protected void simpleInitGame()
   {
      rotQuat = new Quaternion();
      axis = new Vector3f(1, 1, 0.5f).normalizeLocal();

      MaterialState materialState = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
      materialState.setDiffuse(ColorRGBA.red);
      materialState.setMaterialFace(MaterialState.MaterialFace.FrontAndBack);

      t = new Quad("quad", 10, 10);
      t.setModelBound(new BoundingBox());
      t.updateModelBound();

      t.setRenderState(materialState);
      t.updateRenderState();

      rootNode.attachChild(t);
   }
}

Actually, its you are only setting MaterialColoring for the diffuse lighting; try adding it to the ambient light also…

Yes, that gives you also a color on the back face, but there is

still a color difference between the front and back face.

Probably because the diffuse color is only on the front face

try setting up a hotkey to rotate the quad and you will see the back face changing colors as the light is 'refracted' at different angles.  Then take the material color off the back face and watch that side not changing as the quad rotates.

You may need to enable two-sided lighting. Check your LightState.

Option two-sided lighting was already set to true.

I still can't get it to work ;-(