Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ThreeJS Android performance

I started trying out ThreeJS, using this tutorial: http://buildnewgames.com/webgl-threejs/

Now I wanted to try out my result on my Android phone (Nexus 5), and it runs EXTREMELY slowly. I have no clue why that is the case.

Because other examples of threejs games on the http://threejs.org/ page run 100% fluid on the phone. For example "Hello Run".

Why is my Pong game so slow on mobile and how can I fix it?

like image 821
Danmoreng Avatar asked Jul 03 '14 11:07

Danmoreng


2 Answers

Well I don't think it is android 's fault, because it is slow in my iPhone 6+, too

There is a few performing tips of three js as my experiences:

  1. Larger files, such as vertices & triangles, textures, will consume network resources in loading phase

  2. Try to use BufferGeometry to replace Geometry will result in an amazing performance turning

  3. Apply Geometry.merge method as many as possible

  4. Although geometry utilities such as ExtrudedGeometry can simplify your programming work, it will consume large percentage computational resources like CPU and memory. Instances of buffered geometry will always be my first choice.

  5. Try mesh tools such as mesh lab to simplify the mesh vertices without changing much of the mesh appearance . Trust me, it works.

  6. Try more hard work on shading program coding, they can maximize the GPU

like image 193
XQ.Wei Avatar answered Oct 26 '22 07:10

XQ.Wei


the performance is running bad because of webgl support in the device. In order to run threejs and access the gpu I am excited to tell you that there is a way :)

But unfortunately not from the native browser of the device.

If interested in wrapping up all in a nice mobile app, my setup is like so..

Cordova + Crosswalk + ThreeJs

Mind you that Crosswalk is a cool new technology in which I believe Google and Intel are contributing like they do for Cordova. Cordova gives you native interaction with the device and crosswalk enables the power of webgl.

A demo of an HTML5 application running with Threejs can be downloaded from the google stores > (Note that the demo is from Ludei which is a similar technology to crosswalk but I chose crosswalk since its open source.

Demo Three JS

To setup a project is quite a breeze..

You start by creating a cordova project, add platforms you want, add crosswalk cordova plugin and you are good to go.

like image 1
J.Vassallo Avatar answered Oct 26 '22 08:10

J.Vassallo