Porting to Android app - relocation of spatial

We created an Android app following the tutorials.

When testing our game we found that some 3D effects like glow don’t work as warned. However the relocation of a Spatial using either setLocalTranslation or move, puts the spatial in the correct position but leaves behind a ‘ghost’ of itself, that is the same colour as the background, at its previous position.

We have disabled the glow and particle emitter effects for the Android app. We are using the nightly version of the SDK.

Here are two links that show the effect on the app and the working version on the desktop app.

https://dl.dropbox.com/u/18645175/App.png This shows the ‘ghost’ effect



ok…are you using RC2 or Nightly?

Did you try to remove the nifty processor and see if the problem persists?

disable all post process on android they are not supported

We have disabled the glow and particle emitter. Are there any other post processes that could cause this effect? The board floor is just an image.

all of them : meaning remove the FilterPostProcessor.

However particle emitters are not post process and work ok on android as long as there are not too much particles.

We added the particle emitter back in and it works. However moving the Spatial still leaves a ‘ghost’ even with all references (and imports) referring to FilterPostProcess removed.

ok do you do something special with the viewports (not clearing depth for example)?

Or do you do something fancy with detphWrite depthTest on some material for some reason?

it looks like a depth test issue.

The only thing done with viewports is changing the background colour and adding the nifty screens. We don’t use depthTest or depthWrite at all.

Thanks for all your help so far.

Any other ideas? Thanks!

Did you try on a real phone?

We’ve tried it on a android tablet and got the same results.

We are using the Nightly version. And we tried removing the nifty processor completely but the problem still remains.

mhhh…could you wrap up a test case so i can look into it?

I’m out of guesses, i need to look into some code :stuck_out_tongue:

When creating the test case we found that adding certain features causes the ‘ghost’ effect to appear. It happens when adding a particle emitter or when adding nfity elements.

If the tablet goes to sleep and the screen is turned back on, the game freezes for a second and then the ‘ghosts’ disappear. Then as you begin moving the ‘ghosts’ start appearing.

Additionally if you move the camera view around, the same ghosting effect occurs but now wilth all the elements in the game such as the board also going grey.

Below is the test case:


private Spatial sprite1;

private Geometry [] geoms;

private ParticleEmitter playerArrow;

public static void main(String[] args) {



public void simpleInitApp() {


setDisplayFps(false); // to hide the FPS

setDisplayStatView(false); // to hide the statistics

cam.setLocation(new Vector3f(15f, 20f, 50f));

cam.lookAt(new Vector3f(15f, -40f, -40f), Vector3f.UNIT_Y);



Material mat = new Material(assetManager,


mat.setColor(“Color”, ColorRGBA.Green);

sprite1 = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

sprite1.scale(0.02f, 0.02f, 0.02f);

sprite1.rotate(0.0f, -3.0f, 0.0f);


sprite1.setLocalTranslation(1, 0, 29);


geoms = new Geometry[14];

for(int i = 0; i < geoms.length; i++) {

Sphere sphere = new Sphere(32, 32, 1f);

Geometry sprite2 = new Geometry(“Sphere”, sphere);

sprite2.scale(1.0f, 1.0f, 1.0f);

Material mat2 = new Material(assetManager,


mat2.setColor(“Color”, ColorRGBA.Yellow);


sprite2.setLocalTranslation(2i + 3, 1, 29);


geoms = sprite2;



new ClientMonitor().start();


public void createArrow() {

playerArrow = new ParticleEmitter(“Player turn”,

ParticleMesh.Type.Triangle, 30);

Material mat = new Material(assetManager,










playerArrow.setLocalTranslation(1, 5, 29);



public void createGrid() {

Material mat = new Material(assetManager,


mat.setColor(“Color”, ColorRGBA.Blue);

Geometry grid;

for (int i = 0; i < 15; i++) {

for (int j = 0; j < 15; j++) {

Box b = new Box(1, 0, 1);

grid = new Geometry(“Grid”, b);


grid.move(new Vector3f(i * 2 + 1, 0f, j * 2 + 1));





private void updateBoard() {

enqueue(new Callable<Spatial>() {


public Spatial call() throws Exception {

sprite1.setLocalTranslation(3, 0, 29);

geoms[0].setLocalTranslation(5, 1, 29);

for(int i = 1; i < geoms.length; i++) {

i + 3, 1, 27);


return null;




public void moveArrow(final int x, final int y) {

enqueue(new Callable<Spatial>() {


public Spatial call() throws Exception {

playerArrow.setLocalTranslation(x, 5, y);

return null;




private class ClientMonitor extends Thread {

public ClientMonitor() {



public void run() {

try {


} catch (InterruptedException ex) {

Logger.getLogger(MyGame.class.getName()).log(Level.SEVERE, null, ex);



moveArrow(3, 29);




I noticed your using ninja.mesh.xml, that should be converted to a j3o and its probably a too high detailed animation for android anyways (if it even works),

We tried removing the ninja but the shadows still appear on the board for the other objects. Is there any way to force the screen to refresh as when it sleeps and then wakes up again, the existing shadows disappear.

How can you have shadows when you removed all post processors?

By shadow I meant the ‘ghost’ effect.