Colored 3D models are faster on mobiles. My findings..

Previous topic - Next topic

BdR

I've been working on a 3D game and Kitty mentioned (here and here) that it is recommended to use textured models instead of just colored models because they are faster on mobiles. I thought this was strange, so I've created a GLBasic project to see this for myself. The program displays an increasing number of objects and displays the frames per second (fps). The models are created and textured with AC3D and exported using the glbasic plug-in. See attachement to this post for the project and models and textures.



The colored models look different than the textured models, but that's not the point here. I've tested it on my available devices and here are the findings (colors=colored non-textured, txt64=textured with 64x64 bitmap, txt256=textured with 256x256 bitmap):

Code (glbasic) Select
iOS, iPod4 retina:
            colors txt64  txt256
  1 objects ~60fps ~60fps ~60fps
  8 objects ~60fps ~60fps ~60fps
27 objects ~60fps ~60fps ~60fps
64 objects ~60fps ~60fps ~60fps
125 objects ~60fps ~60fps ~45fps
216 objects ~56fps ~45fps ~33fps
343 objects ~39fps ~32fps ~26fps
512 objects ~27fps ~22fps ~21fps

Android, HTC Desire X:
            colors txt64  txt256
  1 objects ~60fps ~60fps ~60fps
  8 objects ~60fps ~60fps ~60fps
27 objects ~60fps ~60fps ~60fps
64 objects ~60fps ~60fps ~43fps
125 objects ~53fps ~39fps ~28fps
216 objects ~35fps ~25fps ~19fps
343 objects ~24fps ~17fps ~13fps
512 objects ~17fps ~12fps ~10fps

WebOS, Palm Pre (320x480 device):
            colors txt64  txt256
  1 objects ~60fps ~60fps ~60fps
  8 objects ~60fps ~60fps ~60fps
27 objects ~60fps ~60fps ~50fps
64 objects ~60fps ~60fps ~32fps
125 objects ~51fps ~43fps ~23fps
216 objects ~30fps ~27fps ~18fps
343 objects ~20fps ~19fps ~14fps
512 objects ~13fps ~14fps ~11fps


Maybe these devices are the exception to the rule. Or maybe my 3d models and textures are non-standard, or my fps function is wrong or something. But it seems that colored non-textured models run a bit faster than the same model textured (although it's not that much).

So, does this mean I can just use colored non-textured 3D models? Maybe this was an issues on 1st generation iPhone and Android, and the newer graphics chips can handle this better? O_O

MrTAToad

How many vertices do these objects have ?  Try to go for as low as possible on mobiles

kanonet

It may also be important to check with and without lighting.
BTW. if you just call X_SETTEXTURE one time and then draw all objects, this is way faster than calling X_SETTEXTURE for every objects again (at least on most devices that i tested).
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

BdR

Quote from: MrTAToad on 2013-Mar-04
How many vertices do these objects have ?  Try to go for as low as possible on mobiles

AC3D Tools -> Model info -> Total objects: 2   surfaces: 26   vertices: 24
I understand that I should use lowpoly models for mobile. But for this speed test I use the same model in both tests, so the nr of vertices doesn't really matter here.

Quote from: kanonet on 2013-Mar-04
It may also be important to check with and without lighting.
BTW. if you just call X_SETTEXTURE one time and then draw all objects, this is way faster than calling X_SETTEXTURE for every objects again (at least on most devices that i tested).

That is what I already do here in this test, I call X_SETTEXTURE only once before drawing all objects. So in that aspect the routine seems optimized. But with textures it is slower than just colors.

mentalthink

Hi Bdr I don't read all the post, but follow this counsils about objects in 3D...

Very very important... use X_Cullface for only draw a only a only side of polygons, this make at leats a 40% faster your scene
Use always JPG if you don't need some part transparents in your models...
Very imposrtant too, use textures power of 2... this only want say use textutes whit cube shape, in example 256x256 512x512 ... etc, if you use 256x512 the OpenGL cost more calculate the matrix of pixels.
If you use lights, try to use a only one, and descart the shadows proyection...
In the x_make3d command try the far_Clipping not too much far... in example if you can use X_Make3d 1,100,45 better than if you use X_make3d 1,1000,45

In jpg, try always the weight of the texture it's lower... if you save a .jpg at 70% of quality it's practicaly the same like 100%...

And of course you can do some routine, like change the size of the texture if this objects are very far, and put a reduced texture.

Ahh, remenber when you make clones of objects, in example you want do 10 objects, and want texture, rotate or move...
put in example the texture out the for:

settexture Here!!! not into the bucle... works exactly, but you don't repeat 10 times put the texture
for n_Object=0 to 20
x_move  10*n_Object,1,1   //for move in 10 units each n_Object 
x_drawobj 1,0
next

I comment I think all I use, If I rebember some more I comment again... and if you need some help whit 3D modelling, comment me, I don't use your soft, but I try a couple of times...

Regards, Bdr

BdR

Okay, this is all nice, but like I said, I already call X_SETTEXTURE once. Also, I use texture with powers-of-2 dimension (64x64 and 256x256), and I use "X_CULLMODE 1" for backface culling. I haven't tried lowering the far clipping value of X_MAKE3D. But my main question is:

Why recommend using textures, while my test here indicates that just using colors is in fact faster? :doubt: (I just changed the topic title for clarity)

BdR

Quote from: Ocean on 2013-Mar-04
This is a recommendation I don't really understand (yet), as applying a texture to an object is an extra step in the GL-pipeline.  I would expect the coloured objects without applying a texture to be a bit faster.
Perhaps KungPhoo can shed some light on this issue.
My thoughts exactly, I'd really like to hear from Kitty or KungPhoo about this.

Btw apart from being faster I personally think they also look better. Compare the 2 screenshots in the opening post, for example the yellow surfaces in the color and texture example are both using the exact same color (#FFFF00). But the colored surfaces look much brighter (imho better) while the yellow textured sufaces looks pale and dull. EDIT: I take this back, this was due to the texture I was using. :-[ When using the same texure colors it looks the same as just colors.

mentalthink


spacefractal

Im guess color object is faster because you uses 64x64 and 256x256 pixels. Have you tried with 2x2px and/or 8x8px textures to test with the same object and see what its happens? Im do heard really small textures might fails on some devices, but 8x8px should been no problems.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

mentalthink

    who is KungPhoo?¿ it's a new User?¿
For someone with way over 2000 posts, you ask remarkable questions...  ;/

any Problem Ocean?¿...

You give a couple of cuts, and I never fault you... what's happends your are moderator?¿... if you have any problem whit me... explain me or write me a PM... I shut up my mouth o lot of time for not disturb... a ver si me voy cagar en Dios... cojones...!!!


kanonet

Kitty uses the name KungPhoo mainly in IRC chat, but not on the forum. So if mental did not meet him in chat that often, its not strange that he does not know the name. (But i was not sure if the question was a joke or serious, lol.)

Yes it is true that sending the texture to the gpu means a bit more work for it then just sending the colour - but many opengl guides recommend texture over colour, cause texture is more flexible to use and colour channel can be useful to send other data to the gpu. It is that much common to ignore colours, that there are even opengl commands to use the texture channel to send light/material information to the gpu. Of cause in your own game you can decide to use the colour over the texture - but you should not expect coloured meshs to work in all opengl programs.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

BdR

Actually, I didn't know KungPhoo was an alias of Kitty, I just quoted from Ocean's post :D LOL

Anyway thanks kanonet for answering my question. :) I know it's more flexible because with textures you can give one single face more than one color etc. But I don't understand what you mean by "send data on the color channel", other than color data I presume..?

If I understand correctly the main reason is that just colors are unreliable; you can't know for sure that the 3D models will display the same on all mobile devices. Is that what you mean?

erico

If you don´t have many colors on one object, you can split it into 2 or 3 and get them together in code, maybe it could be a turn around/quick fix?

kanonet

With sending lighting data over colour channel I mean the commands glEnable(GL_COLOR_MATERIAL) and glColorMaterial().
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

MCP

What texture modes are you using? The textured objects may also be rendering with colours enabled which will obviously be slower than untextured coloured objects.