Minie for Androids

I’ve decided to give up on shared linkage and use the c++_static STL. That’s what jme3-bullet-native-android uses, so it ought to work for Minie as well.

I’ll send you a new commit hash as soon as it’s ready.

Edit: Here you go …

cd Minie
git checkout -b test3 108be4bf
./gradlew clean build

Hi @sgold,
Okay we have lift off.
My sample project is working.
Should I continue testing a few scenarios with it?
And test it on my android devices?

5 Likes

Thank you and congratulations!

My testing priorities would be:

  1. test on emulators for each of the 4 supported ABIs (armeabi-v7a, arm64-v8a, x86, and x86_64)
  2. test on real devices (any to which you have access)
  3. port an existing application from jme3-bullet-native-android to Minie
  4. simple tests directed at the major features:
    • rigid-bodies (dynamic, static, kinematic)
    • ghost objects
    • vehicles and characters
    • physics debug visualization
    • various collision shapes
    • physics tick/collision listeners
    • raycast and sweep tests
    • physics joints
    • ragdolls
    • V-HACD
    • soft bodies
    • multibodies

Edit: The answer is “Yes, please continue testing.” Let me know when you’re satisfied, or if you find any anomalies. I hope to publish the new release on Sunday, but there’s no hard deadline.

5 Likes

@sgold, what is the best way to clear/destroy the current physics space?
I use to just call this but create() method does not exist anymore.

        bulletAppState.getPhysicsSpace().destroy();
        bulletAppState.getPhysicsSpace().create();
1 Like

If you just want to remove all the joints and collision objects, you can use:

        for (PhysicsJoint joint : physicsSpace.getJointList()) {
            physicsSpace.remove(joint);
        }
        for (PhysicsCollisionObject pco : physicsSpace.getPcoList()) {
            physicsSpace.remove(pco);
        }

Okay thank you. I know you can do that but I was actually wondering if one can create a whole new physics space?

I will use this also to remove all physics objects:

bulletAppState.getPhysicsSpace().removeAll(rootNode);
1 Like

removeAll(rootNode) only works if all your collision objects are in physics controls currently added to the scene. It won’t remove any objects you created directly (using new PhysicsRigidBody(...), for instance). Nor will it remove any physics controls that aren’t in the scene graph. And in Minie, it won’t remove any physics joints.

You can always instantiate a PhysicsSpace directly, using new PhysicsSpace(...)—though that gives up all the conveniences of BulletAppState.

Or you can simply create a new BulletAppState and attach it to the AppStateManager.

Edit: note that jme3-bullet (and all past releases of Minie) use per-thread data to keep track of physics spaces, implicitly assuming that there’s never more than one PhysicsSpace for a given thread. Minie v1.6 will remove that gotcha.

2 Likes

Let me know when you’re done testing.

1 Like

Sorry @sgold, this weekend I did not have much more time to test on Android.
I will do a few more tests and let you know the soonest possible.

I don’t think I will be able to test some of the more complex scenarios right now.

1 Like

Hi there @sgold,
I am getting strange artifacts on android when enabling physics debugging.

1 Like

This looks like z-fighting.

I’m unsure what you were doing here. If you applied custom debug materials, then perhaps wireframe materials would work better. If you’re using the default debug materials, then perhaps Heart’s wireframe shaders need fixes for Android.

1 Like

@sgold, I am just doing this.

getBulletAppState().setDebugEnabled(true);

What you see on the screen is simple Boxes with BoxCollisionShapes.

2 Likes

Thank you.

Apparently there’s some incompatibility in the wireframe material or its shaders. To help me diagnose this, please dump the main ViewPort by triggering a

new Dumper().setDumpMatParam(true).dump(viewPort);

at some point after first update (based on a timer or a touch event, perhaps). That will write the dump to standard output. I’d like to see the output.

1 Like

Okay here is my output on the emulator:

I/System.out: ViewPort "Default" enabled clColor,clDepth,clStencil bg(rgb=0) procs[]
I/System.out:  cam(no name)(x=-15 y=15 z=15; dx=0.603 dy=-0.523 dz=-0.603)
      persp F1.644:1 V1.644:1 fz[1 1000] vx[0 1] vy[0 1] 1184x720
     with 2 scenes:
I/System.out:   n[72] "Root Node"
        n[0] "Sound Node"
I/System.out:     n[72] "Root Node"
          g[12] "box" RigidBody
I/System.out:        mat(no name) def"Unshaded" dTest,dWrite,NOwireframe,blend=Off with 3 parms:
             BackfaceShadows true
             Color rgb=0.2
I/System.out:          PointSize 1
           Box mode=Triangles numV=24 bufs[Position%f Normal%f TexCoord%f Index%ushort]
I/System.out:       g[12] "box" RigidBody
           mat(no name) def"Unshaded" dTest,dWrite,NOwireframe,blend=Off with 3 parms:
             BackfaceShadows true
I/System.out:          Color r=0.098 g=0.767 b=0.866
             PointSize 1
           Box mode=Triangles numV=24 bufs[Position%f Normal%f TexCoord%f Index%ushort]
I/System.out:       g[12] "box" RigidBody
           mat(no name) def"Unshaded" dTest,dWrite,NOwireframe,blend=Off with 3 parms:
             BackfaceShadows true
             Color r=0.463 g=0.447 b=0.19
             PointSize 1
I/System.out:        Box mode=Triangles numV=24 bufs[Position%f Normal%f TexCoord%f Index%ushort]
          g[12] "box" RigidBody
           mat(no name) def"Unshaded" dTest,dWrite,NOwireframe,blend=Off with 3 parms:
             BackfaceShadows true
I/System.out:          Color r=0.159 g=0.622 b=0.015
             PointSize 1
           Box mode=Triangles numV=24 bufs[Position%f Normal%f TexCoord%f Index%ushort]
I/System.out:       g[12] "box" RigidBody
           mat(no name) def"Unshaded" dTest,dWrite,NOwireframe,blend=Off with 3 parms:
             BackfaceShadows true
             Color r=0.593 g=0.977 b=0.37
I/System.out:          PointSize 1
           Box mode=Triangles numV=24 bufs[Position%f Normal%f TexCoord%f Index%ushort]
I/System.out:       g[12] "box" RigidBody
           mat(no name) def"Unshaded" dTest,dWrite,NOwireframe,blend=Off with 3 parms:
             BackfaceShadows true
             Color r=0.053 g=0.897 b=0.664
             PointSize 1
I/System.out:        Box mode=Triangles numV=24 bufs[Position%f Normal%f TexCoord%f Index%ushort]
      n[72] "Physics Debug Root Node"
        n[12] "RigidBodyC#e3cdd510"
          n[12] "RigidBodyC#e3cdd510 transformed" BulletRigidBodyDebug
I/System.out:         g[12] "RigidBodyC#e3cdd510"
             mat"debug blue ss" def"wireframe" dTest,dWrite,NOwireframe,blend=Off with 2 parms:
               Color r=0 g=0 b=1
I/System.out:            PointSize 1
             Mesh mode=Triangles numV=8 bufs[Position%f Index%ubyte]
        n[12] "RigidBodyC#e3cdd810"
          n[12] "RigidBodyC#e3cdd810 transformed" BulletRigidBodyDebug
I/System.out:         g[12] "RigidBodyC#e3cdd810"
             mat"debug blue ss" def"wireframe" dTest,dWrite,NOwireframe,blend=Off with 2 parms:
I/System.out:            Color r=0 g=0 b=1
               PointSize 1
             Mesh mode=Triangles numV=8 bufs[Position%f Index%ubyte]
I/System.out:     n[12] "RigidBodyC#e3cddb10"
          n[12] "RigidBodyC#e3cddb10 transformed" BulletRigidBodyDebug
I/System.out:         g[12] "RigidBodyC#e3cddb10"
             mat"debug blue ss" def"wireframe" dTest,dWrite,NOwireframe,blend=Off with 2 parms:
               Color r=0 g=0 b=1
               PointSize 1
I/System.out:          Mesh mode=Triangles numV=8 bufs[Position%f Index%ubyte]
        n[12] "RigidBodyC#e3cdcc10"
I/System.out:       n[12] "RigidBodyC#e3cdcc10 transformed" BulletRigidBodyDebug
            g[12] "RigidBodyC#e3cdcc10"
             mat"debug blue ss" def"wireframe" dTest,dWrite,NOwireframe,blend=Off with 2 parms:
               Color r=0 g=0 b=1
I/System.out:            PointSize 1
             Mesh mode=Triangles numV=8 bufs[Position%f Index%ubyte]
        n[12] "RigidBodyC#e3cdde10"
I/System.out:       n[12] "RigidBodyC#e3cdde10 transformed" BulletRigidBodyDebug
            g[12] "RigidBodyC#e3cdde10"
I/System.out:          mat"debug blue ss" def"wireframe" dTest,dWrite,NOwireframe,blend=Off with 2 parms:
               Color r=0 g=0 b=1
               PointSize 1
             Mesh mode=Triangles numV=8 bufs[Position%f Index%ubyte]
        n[12] "RigidBodyC#e3cdcf10"
I/System.out:       n[12] "RigidBodyC#e3cdcf10 transformed" BulletRigidBodyDebug
            g[12] "RigidBodyC#e3cdcf10"
             mat"debug blue ss" def"wireframe" dTest,dWrite,NOwireframe,blend=Off with 2 parms:
               Color r=0 g=0 b=1
I/System.out:            PointSize 1
             Mesh mode=Triangles numV=8 bufs[Position%f Index%ubyte]

1 Like

Thank you. That gives me a clearer idea of the issue.

For debug materials, jme3-bullet uses “Unshaded.j3md” with setWireframe(true), whereas Minie uses “wireframe.j3md”, which contains

Technique {
        RenderState {
            Wireframe On
        }

I expected that to have the same visual effect, and on desktop it does, but apparently not on Android. I’ve committed a quick-and-dirty workaround for you to test. Please rebuild MInie using the latest commit:

cd Minie
git checkout -b test4 56a1ca62
./gradlew clean build

And re-run your test.

1 Like

I did this but we still have the same problem.

1 Like

I’ve committed a different workaround, using “Unshaded.j3md”. Please rebuild and retest using Minie commit f073df96.

1 Like

I am still getting this artifacts.

1 Like

Thanks for all the testing.

I’m assuming the artifacts go away if either:

  1. you build with jme3-bullet (and jme3-bullet-native-android) instead of Minie (and Heart), OR
  2. you disable physics debug visualization.

Correct?

With jME’s bullet it looks different. It kind of looks like solid unshaded surfaces.

1 Like