About Store Forum Documentation Contact



Post Reply 
Trying to increase mobile performance
Author Message
MrPi Offline
Member

Post: #1
Trying to increase mobile performance
Hey everyone,

In our game I'm rendering fullscreen billboards (multiple of them to have some parralax effect), but on iPhone 4 this part is bringing FPS down to below 20.

This part of the code:

PHP Code:
case RM_BLEND:
      {
         
SetMatrix();
         
Vtx3DTex v[4];

         
// far background
         
if (p3DLayers[LAYER_1])
         {
            
v[0].pos.set(4.25, -2.395, -1.5); v[0].tex.set(01);
            
v[1].pos.set(4.252.395, -1.5); v[1].tex.set(00);
            
v[2].pos.set(-4.252.395, -1.5); v[2].tex.set(10);
            
v[3].pos.set(-4.25, -2.395, -1.5); v[3].tex.set(11);
            
VI.image(p3DLayers[LAYER_1]());
            
VI.face(v[0], v[1], v[2], v[3]);
            
VI.end(); 
         }
         
         
// clouds layer
         
if (p3DLayers[LAYER_2_CLOUDS])
         {
            
CloudProgress -= Time.ad() * CloudSpeed;
            if (
CloudProgress 0.0f)
               
CloudProgress += 1.0f;
            
            
v[0].pos.set(3.7, -2.084, -1); v[0].tex.set(CloudProgress 1.0f1);    // top right
            
v[1].pos.set(3.72.084, -1); v[1].tex.set(CloudProgress 1.0f0);     // bottom right
            
v[2].pos.set(-3.72.084, -1); v[2].tex.set(CloudProgress0);    // bottom left
            
v[3].pos.set(-3.7, -2.084, -1); v[3].tex.set(CloudProgress1);   // top left
            
VI.image(p3DLayers[LAYER_2_CLOUDS]());
            
VI.face(v[0], v[1], v[2], v[3]);
            
VI.end(); 
         }
         
         
// background
         
if (p3DLayers[LAYER_3])
         {
            
v[0].pos.set(3.7, -2.084, -1); v[0].tex.set(01);
            
v[1].pos.set(3.72.084, -1); v[1].tex.set(00);
            
v[2].pos.set(-3.72.084, -1); v[2].tex.set(10);
            
v[3].pos.set(-3.7, -2.084, -1); v[3].tex.set(11);
            
VI.image(p3DLayers[LAYER_3]());
            
VI.face(v[0], v[1], v[2], v[3]);
            
VI.end(); 
         }

         
// fence
         
if (p3DLayers[LAYER_4_MID])
         {
            
v[0].pos.set(2.95, -1.670); v[0].tex.set(01);
            
v[1].pos.set(2.951.670); v[1].tex.set(00);
            
v[2].pos.set(-2.951.670); v[2].tex.set(10);
            
v[3].pos.set(-2.95, -1.670); v[3].tex.set(11);
            
VI.image(p3DLayers[LAYER_4_MID]());
            
VI.face(v[0], v[1], v[2], v[3]);
            
VI.end(); 
         }

         
// foreground
         
if (p3DLayers[LAYER_5])
         {
            
v[0].pos.set(2.21, -1.251); v[0].tex.set(01);
            
v[1].pos.set(2.211.251); v[1].tex.set(00);
            
v[2].pos.set(-2.211.251); v[2].tex.set(10);
            
v[3].pos.set(-2.21, -1.251); v[3].tex.set(11);
            
VI.image(p3DLayers[LAYER_5]());
            
VI.face(v[0], v[1], v[2], v[3]);
            
VI.end(); 
         }
         break;
      } 

I did a few tests with just one large texture or reducing the texture size. The performance drop seems to be only related to the amount of screen space covered (there was practically no difference whether the image was 512x512 or 2048x2048).

Removing only these 5 rendering calls brought the FPS up from 20 to 50.

Does anybody have a tip how can I improve this performance?

Thanks!
(This post was last modified: 11-05-2014 01:12 AM by MrPi.)
11-05-2014 01:00 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Trying to increase mobile performance
I think this just shows that old device GPU's can be very slow.

You could try doing this differently:
-write a custom shader that processes all layers at the same time
I think this could help.
11-05-2014 01:42 PM
Find all posts by this user Quote this message in a reply
Post Reply