Hi all, i'm newbe with jmonkey and i have one problem with the shadows.
i have this code:
DirectionalLight dr = new DirectionalLight();
dr.setEnabled(true);
dr.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
dr.setAmbient(new ColorRGBA(.2f, .2f, .2f, .3f));
dr.setDirection(new Vector3f(0.5f, -0.4f, 0).normalizeLocal());
dr.setShadowCaster(true);
PointLight pl = new PointLight();
pl.setEnabled(true);
pl.setDiffuse(new ColorRGBA(.7f, .7f, .7f, 1.0f));
pl.setAmbient(new ColorRGBA(.25f, .25f, .25f, .25f));
pl.setLocation(new Vector3f(100,-400,200));
pl.setShadowCaster(true);
DirectionalLight dr2 = new DirectionalLight();
dr2.setEnabled(true);
dr2.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
dr2.setAmbient(new ColorRGBA(.2f, .2f, .2f, .4f));
dr2.setDirection(new Vector3f(-0.2f, -0.3f, .2f).normalizeLocal());
dr2.setShadowCaster(true);
CullState cs = display.getRenderer().createCullState();
cs.setCullMode(CullState.CS_FRONT);
cs.setEnabled(true);
rootNode.setRenderState(cs);
// lightState = display.getDisplaySystem().getRenderer().createLightState();
lightState.detachAll();
lightState.attach(dr);
lightState.attach(dr2);
lightState.attach(pl);
//lightState.attach(dr1);
lightState.setEnabled(true);
lightState.setGlobalAmbient(new ColorRGBA(0.6f, 0.6f, 0.6f, 1.0f));
rootNode.setRenderState(lightState);
//lightState.setGlobalAmbient(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.0f));
//sPass = new ShadowedRenderPass();
// new ShadowTweaker(sPass).setVisible(true);
rootNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
sPass.add(rootNode);
sPass.addOccluder(scene);
sPass.setLightingMethod(ShadowedRenderPass.MODULATIVE);
sPass.setRenderShadows(true);
pManager.add(sPass);
RenderPass rPass = new RenderPass();
rPass.add(fpsNode);
pManager.add(rPass);
but i can see the shadows. I have one node "scene" and many trimesh in scene node. Any idea?
Thanks