Game Development Reference
In-Depth Information
Reducing Texture Size Means Fewer Pixels to Be Fetched
So what else could be changed? Something that is not all that obvious. Our Bob instances are
32×32 units in size. We use a projection plane that is 320×480 units in size. On a Hero, that
will give us pixel-perfect rendering. On a Nexus One or a Droid, a single unit in our coordinate
system would take up a little under a pixel. In any event, our texture is actually 128×128 pixels
in size. We don't need that much resolution, so let's resize the texture image bobrgb888.png to
32×32 pixels. We'll call the new image bobrgb888-32x32.png . Using this smaller texture, we get
the following FPS for each device:
Hero:
12-10 04:48:03.940: DEBUG/FPSCounter(629): fps: 23
12-10 04:48:04.950: DEBUG/FPSCounter(629): fps: 23
12-10 04:48:05.860: DEBUG/dalvikvm(629): GC freed 21812 objects / 524256 bytes in 134ms
12-10 04:48:05.990: DEBUG/FPSCounter(629): fps: 21
12-10 04:48:07.030: DEBUG/FPSCounter(629): fps: 24
Droid:
12-10 04:51:11.601: DEBUG/FPSCounter(9191): fps: 56
12-10 04:51:12.609: DEBUG/FPSCounter(9191): fps: 56
12-10 04:51:13.625: DEBUG/FPSCounter(9191): fps: 55
12-10 04:51:14.641: DEBUG/FPSCounter(9191): fps: 55
Nexus One:
12-10 04:48:18.067: DEBUG/FPSCounter(2238): fps: 53
12-10 04:48:19.077: DEBUG/FPSCounter(2238): fps: 56
12-10 04:48:20.077: DEBUG/FPSCounter(2238): fps: 53
12-10 04:48:21.097: DEBUG/FPSCounter(2238): fps: 54
Wow, that makes a huge difference on the second-generation devices! It turns out that the GPUs
of those devices hate nothing more than having to scan over a large amount of pixels. This is
true for fetching texels from a texture, as well as actually rendering triangles to the screen. The
rate at which those GPUs can fetch texels and render pixels to the framebuffer is called the fill
rate . All second-generation GPUs are heavily fill-rate limited, so we should try to use textures
that are as small as possible (or map our triangles only to a small portion of them), and not
render extremely huge triangles to the screen. We should also look out for overlap: the fewer
overlapping triangles, the better.
Note Actually, overlap is not an extremely big problem with GPUs such as the PowerVR SGX 530
on the Droid. These GPUs have a special mechanism called tile-based deferred rendering that can
eliminate a lot of that overlap under certain conditions. We should still care about pixels that will
never be seen on the screen, though.
The Hero only slightly benefitted from the decrease in texture image size. So what could be the
culprit here?
 
 
Search WWH ::




Custom Search