Hi!
When making a Particle Emitter throwing shadows, sometimes the shadows don’t move when you only look at them and NOT at the Emitter.
Like this:
http://www.youtube.com/watch?v=jatJ2pCRyxg&feature=plcp
Test-case (same code used in the video):
[java]
public class Main extends SimpleApplication
{
PssmShadowRenderer shadowRenderer;
ParticleEmitter pe;
Texture image;
Material particleMat;
Geometry boxGeometry;
DirectionalLight dLight = new DirectionalLight();
public static void main(String[] args)
{
new Main().start();
}
@Override
public void simpleInitApp()
{
stateManager.attach(new VideoRecorderAppState(1));
flyCam.setMoveSpeed(100);
shadowRenderer = new PssmShadowRenderer(assetManager, 1024, 512);
shadowRenderer.setDirection(new Vector3f(.07f, -.2f, -.04f));
dLight.setDirection(new Vector3f(.07f, -.2f, -.04f));
viewPort.addProcessor(shadowRenderer);
pe = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 100);
pe.setGravity(3, -3, 3);
image = assetManager.loadTexture("Textures/fireExample.gif");
particleMat = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
particleMat.setTexture("Texture", image);
pe.setMaterial(particleMat);
pe.setShadowMode(RenderQueue.ShadowMode.Cast);
boxGeometry = new Geometry("Geo", new Box(60, 1, 60));
boxGeometry.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
boxGeometry.getMaterial().setColor("Color", ColorRGBA.LightGray);
boxGeometry.setShadowMode(RenderQueue.ShadowMode.Receive);
boxGeometry.setLocalTranslation(0, -10, 0);
pe.setLocalTranslation(0, 20, 0);
rootNode.attachChild(boxGeometry);
rootNode.attachChild(pe);
rootNode.addLight(dLight);
}
}
[/java]
EDIT: Sorry for the staggering, thx youtube video correction