Shadows not rendering

Hello all,

I've been working with jME for quite a bit now, and everything works great. Like a charm… except the shadows. I have two systems, a laptop and a desktop. On both, I can see the shadow volume, but I can only see the actual shadow on my laptop. I'm using a ShadowedRenderPass. My desktop has dual core and greatly surpasses my laptop in speed, memory, RAM, video memory, etc. Is dual core possibly causing the shadows to not show up properly? On the other hand, the Z-Pass Shadow Volumes demo works like a charm - so I'm assuming it's just my code, but why would it not work on my desktop and work on my laptop?

The specs for my laptop:

Pentium M 1.4GHz


64MB ATI Video Memory

Windows XP Pro, Java 1.5, jME 0.11, LWJGL 0.99

The specs for my desktop:

AMD ATHLON 64 X2 6000+ Dual Core SKT AM2 CPU 3GHz


256MB nVidia GeForce 7600 GT Video Memory

Windows XP Home, Java 1.5, jME 0.11, LWJGL 0.99

I don't receive any errors or warnings in the console either. Here's the source:

import com.jme.util.*;
import com.jme.math.*;
import com.jme.scene.*;
import com.jme.input.*;
import com.jme.image.*;
import com.jme.light.*;
import com.jme.renderer.*;
import com.jme.bounding.*;
import com.jme.scene.shape.*;
import com.jme.scene.state.*;
import com.jme.renderer.pass.*;

public class Test extends StandardGame {
   private int fps = 60;
   private int gameW = 800;
   private int gameH = 600;

   private Node scene;
   private KeyBindingManager keyman;

   private ShadowedRenderPass pass;

   public Test() {



   public void initGame() {
      scene = new Node("scene");

      TextureState bricks = getDisplay().getRenderer().createTextureState();
      bricks.setTexture(TextureManager.loadTexture(getClass().getResource("Bricks.png"), Texture.MM_LINEAR, Texture.FM_LINEAR));

      Box plane = new Box("plane", new Vector3f(-10, -0.05f, -10), new Vector3f(10, 0.05f, 10));
      plane.setModelBound(new BoundingBox());
      plane.setLocalTranslation(new Vector3f(0, -7, 0));

      Sphere ball = new Sphere("ball", 10, 10, 0.5f);
      ball.setModelBound(new BoundingSphere());
      ball.setLocalTranslation(new Vector3f(0, -5, 0));

      LightState lState = getDisplay().getRenderer().createLightState();

      PointLight light = new PointLight();
      light.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.1f));
      light.setLocation(new Vector3f(3, 0, 7));

      ZBufferState buf = getDisplay().getRenderer().createZBufferState();

      CullState cull = getDisplay().getRenderer().createCullState();


      pass = new ShadowedRenderPass();

      keyman = KeyBindingManager.getKeyBindingManager();
      keyman.set("exit", KeyInput.KEY_ESCAPE);

   public void update(float tpf) {

      if (keyman.isValidCommand("exit")) System.exit(-1);

   public void render(float tpf) {
      Renderer r = getDisplay().getRenderer();

   public static void main(String args[]) {
      new Test();

Thanks in advanced for your support,

Looks like you do not manually set up a stencil buffer for your app.  Your laptop is probably creating one by default and the desktop probably doesn't, thus the difference.    If you are using a derivative of BaseSimpleGame you can add something like this to the app constructor:

stencilBits = 4;

If you are creating the window yourself, add display.setMinStencilBits( stencilBits ); before you call createWindow.

Thank you so much! Since I was using a StandardGame (multi-threaded), it didn't seem to work no matter where I put display.setMinStencilBits(4) but I changed my code to use a FixedFramerateGame (much better anyway…).

I was having the same problem with StandardGame. The solution was to set the stencilBits BEFORE calling the start() method.  :slight_smile: