3D Hardware Texturing basics

...or Why doesn't my 4 Meg PC card match a PlayStation???
This has been a common question among many PC gamers, some of whom get pretty hot n' bothered when they're told that a $129 PlayStation can do some things their $2000 PC CAN'T. It might seem weird, but it's true. That's because there are some very basic differences in the purpose, design, and operation of the PSX vs. a PC. See, the PSX is a SPECIALIZED machine. It's designed to do ONE thing EXTREMELY well: play games. All its processors, every cycle, every bit, is used exclusively to that end.

On the other hand, a PC has to be flexible enough to do MANY kinds of things, so there are some compromises here and there. If ONE PC could do EVERYTHING well, you wouldn't see so many ads describing machines as "THE ULTIMATE MULTIMEDIA PC" or the "PERFECT BUSINESS WORKSTATION" or "DESKTOP PUBLISHING SOLUTION." Each configuration is optimized for a particular use, but still doesn't come close to the kind of specialization in the PlayStation.

Now, that doesn't really answer the question, but gives you a little idea of the environment in which bleem! has to work - I'll try to explain how the PlayStation thinks about graphics, how the PC  differs, and what bleem! has to do to make the two get along.

CLUT IS A FOUR LETTER WORD (OR SIXTEEN, ON A PC)
Why does a PlayStation get by with 2mb of RAM, and your PC is dropping textures with 4mb? Or even 8? Or, at high resolutions, even 16mb? Doesn't make sense?

Here's a simple simple analogy that might help (I hope):
Say a motorcycle has a 3-gallon tank and can go 300 miles on that tank of gas. Now, if another guy has a pickup truck and hears that information, he could ask, "My truck has a 15-gallon tank - why can't I go 1500 miles on a single fill-up?"

The explanation for that is pretty simple, right? It's a DIFFERENT ENGINE, and the vehicle does DIFFERENT THINGS. A motorcycle uses gas to move a SMALL mass, with (usually) a SINGLE rider, and without much cargo or protection. On the other hand, a truck uses the SAME kind of fuel, but needs to move a much BIGGER mass, which holds multiple passengers, carries stuff, etc.

So a truck needs MORE gas to go the SAME distance, because as a machine, it is designed for a DIFFERENT use. Even if you only have one person in the truck, you still won't get the same mileage as a motorcycle.

It's the same for the PlayStation and the PC. Only in their case, the "vehicle" is the hardware, the "gas" is VRAM, and the "mileage" is measured in the amount of textures you can render.

The PSX uses a very specialized way of describing textures in a VERY compact space, referred to as a Color Look-Up Table, or CLUT. The PSX can handle 3 "flavors" of textures:

  • CLUT4 (4 as in 4 bits)... Which includes 16 colors -- this takes the LEAST memory.
  • CLUT8 (8 bits)... Which gives you different colors... Like ModeX on the PC.
  • DIRECT16.... In this mode, EACH separate pixel uses a FULL 16 bits per pixel, for over 32,000  colors!  This takes the MOST memory.

Now this part is kind of tricky - For the CLUT4 and CLUT8 modes, each texture is rendered using a "palette" of pre-selected colours, instead of describing each color separately. For example, using CLUT4 to describe a texture uses very little memory - the "palette" of 16 colors is loaded into memory and all you have to do is call on the colors using 1 ,2, 3, 4... etc - instead of individually describing each pixel's color IN THE TEXTURE with values for Red, Green and Blue.

Think of it like paint-by-numbers: to paint a specific area a specific color, you can either give them a couple hundred tubes of oil paint and tell them to mix .5 grams of Burnt Sienna with 1.5 grams of Azilarin Crimson, plus another .25 grams of Bright White and a little thinner, or you can give them the 20 colors they really need, pre mixed, and tell them to use color #13. Much easier.

So the "palette" method of describing textures takes up very little space in the first place. But there's more to it than that - with the PALETTE style of texturing, you can change the palette without changing the texture - the two are SEPARATE.

What does that mean? It means you can do a lot MORE with a lot LESS memory. Here's an example: a sports game has two teams on the field, and the teams have different colored jerseys, say BLUE and RED. The jerseys have a TEXTURE that is applied to them, and that texture is built up, pixel by pixel, using information from the CLUT (following so far?).

The PlayStation can render ALL these players with ONE TEXTURE, and ONE CLUT. How?

First, say BLUE is in space ONE in your 4-bit CLUT. The game draws one team's players using the TEXTURE for the jerseys, mapped to the ONE-value in the CLUT to make all the jerseys blue.

Then, to draw the RED team, instead of making a whole new CLUT, or a whole new texture to call an a whole new CLUT, it just changes the ONE value in the EXISTING CLUT to RED, and uses the SAME CLUT and the SAME TEXTURE to render the RED team. It can switch back and forth very quickly, changing only a single value in the table to render every player on the field.

THE PC - MORE IS BETTER??
Now, if that's at all clear (yeah, right), let's move on to the PC world, where things aren't quite so simple...

Now that you know how a PlayStation thinks about graphics, we can explain what makes the PC so different:

First, most PC 3D hardware doesn't support ANY paletted textures at all! That means that each color for each pixel in each texture has to be described in terms of its RGB values. And since many cards only support 16-bit textures, that means every texture takes up FOUR TIMES AS MUCH MEMORY on a PC!

Second, the PC doesn't think of palettes and textures as separate linked sets of information - it only sees textures. So if you took our previous example of a sports game, you'd have to create a whole new texture for the other team's jerseys, instead of using the one already in memory.

That wouldn't be so bad if that were the ONLY texture to deal with. But you might have 30 different teams, or race cars, or whatever to deal with in a single game. Instead of one texture and palette, you now have 30 - one for each different use, and each can take up to 128k of your video memory, just to render the players, much less all the background elements and other graphics!

On top of all that, the PlayStation can use part of that 4-bit CLUT to describe the relative TRANSPARENCY or LUMINOSITY of a texture - to give you effects like fog, smoke, glow, shadows, etc. without taking up ANY MORE MEMORY. But on the PC, each time you apply that sort of effect, it's a WHOLE NEW PALETTE, and a WHOLE NEW TEXTURE. (Yikes)

And FINALLY, each texture used to render graphics has a pre-set width and height, like 64x128 pixels. When you "map" this texture to an object, like a floor or a large patch of grass, it repeats it over and over, "tiling" it to fit the space. And if you want to use just a part of a texture in another area, the PlayStation lets you reference the same base texture for that purpose, and doesn't take any more memory. But on the PC, each time you change the dimensions of a texture or use a piece of a texture, it means you have to create a NEW texture based on the old one.

So do the math - now, we're WAY oversimplifying this to prove a point, but let's say a PlayStation needs 1mb of VRAM to render everything in a game with a 4-bit CLUT. To start off, your 16-bit graphics card in your PC means you need 4X that amount, just for the same number of textures.

1MB VRAM/4-bit CLUT  X  16-bit CLUT  =  4MB VRAM

Next, you need a whole new texture for every time the PlayStation would normally just change a single value in the CLUT - what's fair? 30? 50? 100? 1000? Let's be conservative and just say 20.

4MB VRAM/1 TEXTURE  X  20 TEXTURES  =  80MB VRAM

And let's not forget transparency - every time you see a cloud, a lightning bolt, water, etc, you've got a whole new texture. What do we say? Another 5 textures? More?

80MB VRAM    X  5   =  400MB VRAM

Starting to get the picture? Now, of course ALL those textures aren't in memory at the same time - but it's still a pretty hefty load for any PC graphics card.

In fact, you're probably wondering - so how does bleem! draw ANYTHING then?

BLEEM!  - THE SINGING HORSE.
There's an old saw about a singing horse - and how some people can only comment on how WELL the HORSE can sing, instead of being impressed that it can sing at all. That's kind of how we feel about bleem! and what it ALREADY does - and how much better it can be. Now that you know just what a big job it is to render PSX graphics on a PC, here's how it works:

The secret is, bleem! converts ALL the textures it encounters "on-the-fly" into the format the PC needs. Then it determines the MINIMUM number of textures required for the section of the game you're in and keeps them around so it can avoid reconverting things all the time. But on cards with less memory (4MB), the minimum amount it needs and the amount you have might not be the same. There just isn't enough space.

In fact, even on cards with 8 or 16mb of memory, if you're running at higher bit-depths and resolutions, you'll still run out of texture memory on more complex games! AGP card users will get some relief (with a certain speed hit) by using system memory to supplement their card's memory, but your best bet is to decrease your screen resolution and try different choices in the 3D options to find what works best for you.

bleem! does what it can to maintain the ABSOLUTE smallest memory footprint it can, but can still run out of space for all the textures on some games. So to keep the game running, it has to get rid of textures to make room for new ones (a.k.a. "flushing the cache"). Some games constantly change palettes (which means more textures on the PC), or upload new textures for animated effects -- those games will run  slower because bleem! has to reconvert stuff constantly, and it takes time to do it.

But most games and most cards will give you great 3D performance. When you do notice that a game plays faster in software mode than in hardware mode, it's because cards that don't support palette modes usually don't have FAST texture uploading, either.

So bottom line... If you have a good card, you should really enjoy bleem!.

And if you have a crappy card, bleem! will still give you awesome results on many games. But for the others, just use the software mode. That's why we made the software support as fast and complete as it is ... It's a fallback position that works great, and the best place to start when trying out new games.

Basically, Direct3D gives you much higher resolutions and higher framerates, better visuals and better gameplay - but it can be a compromise. In software mode, we have a lot of control over what the PC does with the games' instructions. But in D3D, we have to do yet ANOTHER set of "translations" to make the 3D card do what we want it to. And sometimes, it's just not possible within the constraints of the hardware.

Which doesn't mean that we won't keep trying - if there's a way to make bleem! faster, better, or more compatible, we'll keep working on it. And we appreciate all your feedback and support to help us know where to spend our efforts and to prioritize your "wish list". Thanks, and keep those suggestions and compatibility reports coming in.

Hosted by www.Geocities.ws

1