Wherever you go, there you are.

Introductory guide to cryptocurrency (BitCoin, LiteCoin, etc.)

1

This is a primer on cryptocurrency (BitCoin, LiteCoin, etc.): what it is, how it works, and some specific (though probably ill-informed) recommendations from me if you are interested in mining it.

Crypto-what now?

Cryptocurrency is the name given to any currency based on a couple of key concepts and a common theoretical architecture. The first cryptocurrency was BitCoin, which "set the mould" for what it means to be a cryptocurrency. Another important cryptocurrency is LiteCoin, which has a couple of key differences from BitCoin that will be covered later. In addition, there are now dozens (if not hundreds) of "AltCoins"; that is, other cryptocurrencies in addition to BitCoin and LiteCoin. They have many of the same features and underlying concepts, but have small yet important tweaks or differences that make them suitable for specific niche purposes.

Cryptocurrencies have two central features that make them unique from normal "fiat" currencies:

  • anonymous transactions
  • no central processing or legal authority

Why do I care?

Let's say I have $50 and I want to give you $5. How do I do this? Well, if we can meet in person I can just give you a $5 bill. That's an anonymous transaction to the rest of the world, but it's not anonymous between us. Further, in an online and interconnected world, it's really inconvenient to have to meet in person any time we want to exchange money.

Another option is that I can keep my $50 in a bank account and then tell my bank to send you $5. This means my bank will subtract $5 from my account, then my bank will tell your bank to add $5 to your account. This works because we both trust our banks to perform this transaction (typically backed by government regulations), and likewise the banks trust each other.

This process works really well and is the basis for the modern financial system. However, this process is never anonymous because our banks know a lot of information about each of us. And you will never find a bank that doesn't, because in order to comply with banking regulations imposed by the government in most countries, a bank MUST collect this information about you or else the government won't allow them to be a bank. And if they aren't a bank in the eyes of the government, not only can they go to jail for trying to do "banking" things, but more importantly no other bank will trust them and they won't be allowed to participate in these kinds of transactions, which makes them kind of useless as banks.

On top of this, the transaction itself is logged by the banks and, again due to those government regulations, the processing authorities involved (typically quasi-governmental central bank agencies) can intervene at any point. They could tell our banks to stop the transaction, or reverse it, or even confiscate the transaction (or my entire account) for any number of legal reasons. This legal and regulatory framework and government involvement is, in fact, the very basis of a fiat currency, and is the reason familiar currencies (such as the Canadian dollar or the UK pound) are associated with a specific country. Those currencies are effectively defined by the laws of their relevant governments.

Now, it might sound quite paranoid to worry about a government confiscating my transaction or banks knowing who I am, and I personally believe that, yes, in reality those aren't things most people need to worry about most of the time. Not only that, but some of these things are actually positive attributes that most people WANT in a bank. I LIKE the ability to call my bank and cancel or reverse a transaction in the case of fraud, and I appreciate the fact that if my bank screws it up my government can fine or jail them or order my funds returned to me. These are useful and powerful features of fiat currencies!

But choice is king, and in the modern world there are enough people who ARE worried about the limitations of fiat currencies that there is a demand for a currency that can be used anonymously and without any potential for intervention from any central authority or government. Whether you personally worry about that or not, enough OTHER people were worried about it to figure out a way to do it. Thus, cryptocurrencies and BitCoin were born.

The Secret Sauce of Cryptocurrencies

Cryptocurrencies are based on asymmetric cryptography, hence the name. Asymmetric cryptography is based on decades of research into advanced mathematical ideas that are crazy genius. However, all you need to know are three basic facts:

  • modern crypto is based on having a "key" that is split into two parts: a "private key" and its corresponding "public key"
  • encryption: anyone with your public key can create a message that can only be read using your private key; everyone else just sees it as undecipherable gibberish
  • signing: you can use your private key to "sign" a message (that anyone can read) and anyone with your public key can can verify that only you could have written the message

In this kind of system, "you" are anonymous because no one knows who you are. Instead, "you" are defined by the fact that you have the private key. Assuming you don't share your private key with anyone else, then no one else can pretend to be "you". You don't need to reveal your identity or register with a central authority to prove that a message came from you or to read encrypted messages sent to you. All you have to do is share your public key and then do a good job of keeping your private key secret.

Another key technology underlying cryptocurrencies is peer-to-peer networking (P2P). This is the technology underlying things like BitTorrent. Again it's not necessary to understand the technical details of P2P; all you really need to know is that it enables software on many computers to talk to each other (create a shared network) in a de-centralized fashion. There is no central authority managing the network or controlling who can connect to it, and yet everyone still manages to "get along". As long as your computer can find another P2P client to talk to, you can participate in the P2P network.

Transaction Redux

Given these key bits of technology, let's now examine the case where I have 50 "coins" and I want to give you 5 of these coins. We'll ignore for the moment how I got a balance of 50 coins (or how anyone knows I have this balance, though that will become clear shortly). How can I do this without bank accounts, or even banks, or any central authority enforcing transactions?

In cryptocurrency lingo, I have a "wallet" that contains the 50 coins, and you have a wallet where I want to transfer 5 of those coins. A wallet has an address (a string of letters and digits) and each wallet is associated with a public key. I can prove to other people that I "own" a wallet because I'm the only one who has the matching private key for the wallet. Only I can sign public messages sent from the wallet. Note that in real usage, you'll actually have many wallets. At least one for each cryptocurrency you use, and often several for a single currency that you use for different purposes. This is kind of like having multiple bank accounts.

Now, I can create a message from my wallet and sign it with my wallet's private key that says "Hey, I'm taking 5 coins from this wallet and putting them in your wallet". Now, assuming I can find you to give you this message, you can verify that I am, in fact, the owner of the "from" wallet because I signed it with the private key. Great! I've "given" you 5 of my coins! Of course, at this point only you and I know anything about this transaction. You know those 5 coins now belong in your wallet, but I could easily lie to everyone else and tell them I still have all 50 coins I started with.

The trick here is the P2P network. Instead of only giving YOU the message that I'm taking 5 coins from my wallet and putting it into your wallet, I'll give EVERYONE that message. The entire P2P network will get the message that my wallet is sending your wallet 5 coins. They can all verify that it is a valid message that could only have been sent by someone who has the private key to my wallet. Now the entire network agrees that, in fact, my wallet now only has 45 coins and your wallet received the other 5 coins. Interestingly, you don't even need to get the message for the transaction to have taken place. Everyone else agrees that your wallet now "owns" those 5 coins, even if you don't get the message right away.

Finally, if we track every transaction ever made in this manner from the beginning of the currency, it becomes obvious why the network accepts the fact that I had the 5 coins to send to your wallet in the first place. Somewhere in the history of transactions, my wallet must have received those 5 coins from someone else. A wallet address that has never been seen before must have 0 coins, so the only way my wallet could have 5 coins to send to you is if I can prove via some other verified and confirmed transaction in the P2P network that my wallet received those 5 coins from somewhere else.

This complete record of every coin moving between every wallet is called the "block chain". Each cryptocurrency has its own block chain stretching back to the beginning of the currency. It contains a complete record of every transaction ever made. Counter-intuitively this completely open and transparent system, in which I can see the flow of currency from every wallet to every other wallet, is 100% anonymous. Because each wallet is just a random identifier, and because all I need to prove I "own" a wallet is the private key, there is no way for anyone to know who I am. I can prove I own a wallet and that a transaction is valid without sharing any personal information of any kind. For all I know, every transaction that ever happened in the currency is just one guy sending stuff back and forth between all his millions of wallets.

Further, it's also 100% de-centralized. Because all of these messages happen on a P2P network, there is no central authority that can control the process. As long as I find enough P2P clients to confirm the transaction and the message gets to most of the P2P clients eventually, it's practically impossible to forge or undo.

The Two Big Gotcha's

This de-centralized and anonymous nature does have two significant limitations. One is a simple result of there being no central enforcement body. As a natural result, there is NO WAY to reverse a transaction! Once I create a message that I'm sending coins from my wallet to your wallet and it is confirmed in the block chain, I CANNOT undo that transaction! I no longer own those coins. The only way to "undo" the transaction is if YOUR wallet sent the coins back to me, voluntarily. This means that when doing business with coins you'd better trust the other person or else use a trusted 3rd-party/escrow agent. There is no bank or credit card company to call to reverse a transaction if you are being swindled or defrauded.

The second major issue has to do with the specifics of how all the transaction confirmations are handled and the way the block chain is created over time. I won't cover the very technical details, though I will talk about the block chain more in the mining section coming next. However, the important take-away is that if a single entity gains control over more than 50% of the block mining effort (NOT 50% of the P2P network, but 50% of mining new blocks), they can subvert the entire process! They can lie and cheat and forge information about past and present transactions.

Mining Blocks

If you were paying close attention in the previous section, you might have noticed one missing detail. If every new wallet starts out empty, and if the only way to "own" coins in a wallet is to have a valid transaction showing that the wallet received coins from somewhere else... then where do the coins actually come from?

The answer lies in the specific details of how the block chain, or transaction ledger, is created and updated over time. For a number of technical and practical reasons that I won't get into, the transactions in the P2P network are organized into "blocks". A single block records all of the transactions and confirmations that have taken place since the previous block. Once a new block starts, the current block is "closed out" and added to the block chain.

However, the only way for the current block to end and the new block to start is if someone FINDS a new, valid block. The process of looking for the next new valid block is called "mining". Again, due to super genius math that I won't cover, everyone on the network knows what the next valid block should look like so they can all agree when somebody finds it. But nobody actually knows how to find it except by random chance. Finding the next block takes a ton of processing power, trying random numbers over and over (and over and over... billions of times). If you happen to be the one who finds the next valid block, your reward is to get some coins "out of thin air" as part of that block. When you find the new block and then tell everyone on the network about the new block, they all agree that the first transaction recorded in the block is you adding "new" coins to the wallet of your choice. This is how new coins come into existence in the currency.

The block mining process has two key inputs that are initially set by the original creators of the currency: the block reward and the difficulty factor. They are based on algorithms and consensus within the P2P network, so while the starting values are set arbitrarily by the original creator, they can't just be changed arbitrarily afterwards.

The first key input is the number of coins to reward to the person who finds each block. For instance, when BitCoin first started, the reward for finding a new block was 50 coins. However, everyone also agreed that the reward would be cut in half each time 210,000 blocks had been found. Since there are currently 279,748 blocks, the current reward for finding a BitCoin block is now 25 coins. Once the 420,000th block is found, everyone will agree to cut the reward in half again.

The second key input is the difficulty factor. The goal of mining blocks is to find a new block after a certain amount of time has passed. For BitCoin, the target is for someone to find a new block every 10 minutes. However, finding a new block is based on random chance, and the number of "random guesses" being made is dependent on how many people are mining and how fast their computers are. If the random chance were fixed, then as more people mined with faster and faster computers, blocks would be found more quickly. To avoid this, the difficulty factor is used to adjust what the next valid block "looks like" in a way that makes it easier or harder to find. In BitCoin, the difficulty factor is adjusted every 2160 blocks (based on an initial algorithm and by consensus on the P2P network) so that, based on how many people are mining and how fast they are mining collectively, it will always be about 10 minutes (on average) until someone randomly finds the next new block.

I'm a cryptominer and hash a-way, I SHA all night and I scrypt all day!

The process of finding a block involves "hashing". Everyone on the network knows what the hash of the next block needs to look like, but because of the nature of hashing, there's no way to know how to FIND a hash that looks like that except to just hash random values over and over until you find it. This is the part of the process that takes "work" (computing power) to do.

In a cryptocurrency, the type of hashing being done has a big impact on how "hard" the work of finding the next block really is. BitCoin uses a hashing algorithm called "SHA-256", which has an important trait in that it is not hard "equally". Specialized hardware using ASIC's can be MUCH more efficient at hashing SHA-256 than a typical CPU or video card. An ASIC is basically a custom microchip that some very smart people with EE and CompE degrees have created from scratch. It costs them hundreds of thousands of dollars in research and development efforts to do this, and ASIC-based miners often sell for upwards of $10,000. But they are so much better and faster at mining SHA-256 than a CPU or video card that if you don't have an ASIC miner you might as well not even bother mining a SHA-256 based currency (like BitCoin).

Why does this matter? Well, if you recall earlier I pointed out one key weakness in the cryptocurrency architecture is that if any single entity gains control over more than 50% of the mining efforts, they can subvert the whole block chain process. The more expensive it is to get into mining, and the more custom hardware that is required, the more likely it is that the mining efforts will become consolidated into the hands of a few rich people who can afford the investment. This isn't a fatal flaw, but it is a danger.

In order to avoid this problem, another group decided to come up with a cryptocurrency based on a hashing algorithm that would stay "hard" even on ASIC's. This meant that ASIC's would not have a giant advantage over miners using modern video cards. Since there is a huge pool of people with advanced video cards, and since this pool is not going anywhere since it's not based on cryptocurrency mining but instead on playing video games, then as long as mining on ASIC's isn't much more efficient than mining on video cards, there should always be a large pool of people willing to mine without the high barrier to entry of having to buy specialized ASIC hardware. This algorithm is called "scrypt", and the first currency to use it was LiteCoin.

The benefit is that this keeps the cost of entry lower, hopefully leading to more diversity among miners and reducing the chance that any single entity could ever get more than 50% control of the mining effort. The key difference with scrypt is that it requires a lot of memory, and video cards just so happen to be very fast processors attached to very fast memory. ASIC's designed to mine scrypt currencies still require fast memory too (and a fast memory controller), so it can't be much cheaper than an equivalent video card. Anything that makes memory faster or cheaper will benefit video cards just as much as ASICs. While an ASIC scrypt miner can certainly be a bit more efficient (typically in terms of power usage), it should never become such an overwhelming advantage that mining scrypt currencies on video cards becomes pointless like it has for SHA-256 currencies.

AltCoins

There are now dozens (if not hundreds) of alternate cryptocurrencies in addition to BitCoin and LiteCoin. These are collectively referred to as "AltCoins", and most of them are based on the scrypt hashing algorithm.

The reason for this proliferation of currencies is two fold. One, sometimes there are actual practical reasons for a new cryptocurrency to exist. For instance, someone might have a use case where they want to tweak the block reward or target "time until new block" for various practical reasons. Or the currency might exist to support some other process; for instance, the process of finding and exchanging cryptocurrency can be an effective way to enforce network limitations or access control. There are cryptocurrencies that exist solely so that regular users of a network won't notice the processing power required to mine coins to "spend" on participating in the network, but spammers would have to devote a ton of resources just to mining currency in order to "pay" the cost required to spam the network. So there are some altcoins that exist for practical niche reasons.

The second and more common cause of proliferation is greedy speculation. A side effect of the mining process and the cryptocurrency architecture is that, at the start of a cryptocurrency's lifetime, it is MUCH easier for a single person to find new blocks since fewer people are mining the currency. This means that if you start mining a cryptocurrency very early on, you will get a large number of coins from mining while the difficulty is very low. If the currency then becomes popular later on, this speculative mining can pay off in a big way.

Of course, this only works if you get in on mining a currency very early in its lifetime and if the currency then becomes popular enough to have real value. What better way to be the first to mine a currency than to make a brand new cryptocurrency of your own? And thus, a ton of altcoins are born. Realistically most of these are speculative currencies created by people trying to get rich quick, while simultaneously trying to convince you that there is a real reason for the currency to exist (even though there probably isn't) so that it will become more popular... so that they (the early miners) can get rich quick. As such, you will see a lot of fervor and passion in early cryptocurrency adopters trying to promote whatever altcoin they've dedicated speculative mining efforts into (see, for example, coinye, DOGEcoin, Memecoin, etc.)

Cashing out (or in)

So... how do you turn a fiat currency (like, say, Canadian dollars) into a cryptocurrency? Or vice versa?

More and more, you can often avoid this question entirely. Every day more retailers and businesses are supporting transactions directly in the common cryptocurrencies of BitCoin and LiteCoin. For instance, EasyDNS, my preferred DNS registrar, let's you pay your domain registration and renewal fees directly in BitCoin.

That said, at the end of the day you still need a way to convert cryptocurrency to fiat currency (and back again). To do this you need a bank or currency exchange that supports both. Most exchanges of this kind only deal in BitCoin or, sometimes, LiteCoin. Once you have BitCoin or LiteCoin you can then transfer it to other wallets or other exchanges where you can convert it into other altcoins. Likewise, you can turn your other cryptocurrencies into BitCoin or LiteCoin and then transfer it to an exchange lets you turn that into fiat currency.

Since this exchange will be dealing with fiat currencies, any legitimate exchange of this kind will be doing its best to comply with local laws and regulations for banks or money exchanges. The legal implications of this are kind of up in the air right now in most countries and it's all a bit gray, but if the exchange you use isn't thinking about this aspect at all, chances are they (and you) are in for a big surprise some day.

Because the exchange must deal with government regulations, the exchange that works for you is going to depend in large part upon which country you live in and which country's fiat currency you want to use. In Canada, two major exchanges are CA VirtEx and the Vault of Satoshi. CA VirtEx has a cool feature where you can even get a debit card that works in all standard Canadian debit terminals that draws on your BitCoin balance behind the scenes. Pretty cool! Another popular exchange that supports US dollars is MtGox.

It's important to remember that the actual value of any cryptocurrency in terms of "real" fiat currency is completely dependent on the exchange rate between the two, just like the exchange rate for any two fiat currencies affects their relative value. Because cryptocurrencies are very young and niche, these rates can fluctuate wildly over short time periods. Cryptocurrencies are considered to be extremely volatile compared to most fiat currencies.

Mining and you; a practical guide

So, after all that... are you interested in mining cryptocurrency? Then read on!

1.21 Giga Hashes!?!?

The key metric you need to know for mining is the number of hashes per second you can perform. This is basically the number of "random guesses" per second you are making at trying to find the next valid block. Modern ASIC-based SHA-256 mining hardware is just now reaching several gigahashes per second (Ghash/s) while mining SHA-256 currencies (that's several billion guesses per second). In contrast, hashing SHA-256 on a video card is usually measured in, at best, megahashes per second (Mhash/s)... that's only several million guesses per second. You can see why ASIC mining is practically required for SHA-256 currencies.

For scrypt mining, a modern video card is typically measured in kilohashes per second (Khash/s). A good single video card setup will run from 100 to 400+ Khash/s, and ASIC's are unlikely to improve this number much for equivalent cost.

Profit

The most important thing about choosing to mine a cryptocurrency is to ensure that you aren't losing money on the prospect! If you are going to mine an scrypt-based currency on hardware and video cards you already own, then all you really have to worry about is the cost of electricity. Unless you are paying obscene amounts on your power bill, you are likely to come out ahead in this case.

However, the profitability calculation becomes much trickier when you are talking about buying new hardware JUST for mining. In this case you have to figure out how long it will take for that initial investment to pay off. The thing that is most often overlooked while trying to figure this out is the reality that, as time passes, the difficulty factor of the currency increases over time as more people are mining the currency more efficiently. Trying to estimate the profit (or loss) of buying new mining hardware depends on accurately estimating how this difficulty increases over time.

The previous point is critical, and can make a huge difference. If you could buy one of the most advanced $10,000 SHA-256 ASIC-miners today and have it mining BitCoin starting tomorrow, you could pay off the initial investment in a week and make a killer profit! However, if it takes 3 months for that same hardware to be delivered to you then, estimating with the current average increase in the difficulty factor for BitCoin mining, you would LOSE money. This problem is exacerbated in SHA-256 mining due to the recent introduction of ASIC-based mining hardware and the huge effect it has on the overall mining curve. If you can get your hands on an ASIC miner right now, you can make a killing, but by the time you actually get your hands on one... so will everyone else. And then you'll just be back to barely breaking even.

As a result of this, I'd strongly recommend starting with an scrypt-based currency (like LiteCoin) using hardware you already own. If you can't make a profit mining when your hardware costs are free (since presumably you already have a computer and video card that goes unused most of the time), then it probably wouldn't make much sense to invest a bunch in mining hardware either.

This calculator is a great tool for trying to determine profitability.

Mining Pools

While there was once a time when you could mine a currency on meagre hardware and find the next valid block all by yourself (thus keeping all the reward coins for you), that time has long passed. Unless you are investing thousands of dollars into a giant mining farm, the chances that you will find the next block yourself are pretty slim (and if you ARE investing thousands of dollars into a giant mining farm, you should probably find a better guide than this one!).

Remember, the chance to find the next block is completely random. You could find it on the very next hash, or never. When the overall mining difficulty was very low, the chance that you wouldn't find any blocks was also pretty low, so people could "solo" mine with reasonable results. But nowadays the chance that you are the lucky winner who finds the next block is extremely small.

To address this problem, miners consolidate their efforts into "mining pools". Everyone contributes to the pool by looking for the next valid block. They get a "share" of the pool based on the portion of work they do compared to everyone else. Once someone in the pool randomly finds the next valid block then everyone in the pool gets a split of the reward based on the number of shares they have contributed.

There are TONS of mining pools out there. I've settled on using TradeMyBit for a variety of reasons. First, it has sub-pools for many currency types so you can choose which currency you want to mine. Second, it has a "multi-pool", which allows you to mine the scrypt-based currency that is "most profitable" right now based on current exchange rates. Third, the mining pool servers (called stratum servers) have, so far, all been pretty reliable compared to other pools I've tried. Fourth, they aren't in any danger of reaching 50% mining share; remember, DON'T simply join the biggest pool you can find, you don't want any single pool to reach 50% mining share! Fifth, their fees are very reasonable compared to other pools I've looked at (the fee is simply the cut they'll take out of the shared profits to keep everything running).

Mining Software

Profitable scrypt mining uses modern video cards. If you are mining on an ATI card (Radeon), you want to use cgminer (note: use version 3.7.2 or lower; the 3.8 and 3.9 branches do not support GPU scrypt mining). If you are mining on an nVidia card, you want to use cudaminer.

I'm not going to cover setting up the miner software; there are a ton of guides out there (time to exercise your Google-fu!). However, here is a guide for cgminer on Windows and one for cudaminer on Windows. The mining pool you join will determine which stratum server you use, and many mining pools also have their own setup guides for the miner software.

AltCoin Exchanges

When mining currencies, especially AltCoins of any kind, you usually want to get your earnings transferred into LiteCoin and/or BitCoin. This is especially true if you are mining in a multi-pool setup like TradeMyBit where the currency you mine changes routinely to chase the most profitable exchange rates.

As such, you'll need exchanges that let you convert between all the various AltCoins and LiteCoin/BitCoin. The one I like to use is cryptsy (if you happen to sign up there, please use my referral link, thanks!). Cryptsy lets you setup wallets on their site for a bunch of AltCoins without actually having to download the wallet software for each and every AltCoin yourself. You can also setup automatic sell rules so that as soon as you receive deposits on those wallets they are automatically exchanged for BitCoin or LiteCoin. This works very well in conjunction with a multi-pool miner like TradeMyBit.

The Final Word

Cryptocurrencies are neat, and in many ways represent a far simpler and easier way to move monetary value around the internet in this day and age of international trade. There is even a cryptocurrency dedicated solely to simplifying the exchange of fiat currencies (ripple). As more and more online retailers and service providers begin to support direct BitCoin and LiteCoin payments, the landscape gets even more interesting.

Realistically a lot of the hype and buzz about cryptocurrency was from the speculation, bubbles in BitCoin value, and meteoric rise in BitCoin wealth for those lucky or smart enough to mine or invest in coins several years ago. For the rest of us, though, there is real, interesting, and practical value in the simple nature of cryptocurrencies far beyond this transient hype.

Antialiasing

0

There are so many confusing, poorly written, or just plain incorrect articles about antialiasing (AA) that I feel compelled to add another one to the mix. Every article I've seen either gets caught up in the minutiae and technical details of each AA technique, which doesn't really matter or, alternately, are so generic as to be useless in trying to get a decent understanding of the current state of AA.

I stumbled onto this realm of vitriol and confusion by trying to find out a bit of basic information about the latest fad in AA, FXAA (and its derivatives). Many of the articles and, especially, comments about this topic were hilariously misinformed. Though amusing to watch, it really speaks to the lack of a clear and simple explanation on the topic. I'm sure better articles than the one I'm about to write exist out there somewhere, but in my 97 seconds of googling I was unable to find one (though the AA article on PC Gaming Wiki is not bad). In short, someone is wrong on the internet, and I'm going to do my part to fix that!

I'm breaking this up into two parts. The first half discusses what aliasing is and why we care about using AA to get rid of it. There is a LOT of misconception out there about the fundamental nature of the problem.

The second half covers the current technologies out there to do antialiasing in the real-time 3D graphics world (which is to say, gaming). Its focus is on clearing up buzz-words and acronyms and classifying the different AA approaches in use today.

Aliasing and Jaggies

So what the hell is aliasing, anyway? In short, aliasing (in the context of computer graphics) is a graphical artifact that results from the fact that most displays have BIG PIXELS.

Unless you are reading this on a new iPad, the pixels on whatever display you are using are physically large enough that you can individually pick out a single pixel. This will be old news to anyone who has done graphics work or web design, but it may be surprising to computer users who don't spend their time dealing with this on a daily basis.

(As an aside, in case you came into this article not knowing what a pixel is: a pixel is the basic physical unit of display for any kind of TV or monitor. A monitor displays an image by controlling the color of each and every pixel on the display. A display cannot show an individual, uniform color element any smaller than a single pixel. The resolution of your display defines how many pixels it has. A resolution of 1920x1080 means that the display is made up of a grid of pixels that is 1920 pixels wide and 1080 pixels high. That's over two million pixels. This also happens to be the resolution of any modern HD TV or monitor labeled as "1080p").

To prove that your display has BIG PIXELS, I present the following image. Can you see the white dot in the middle of it? That white dot is a single pixel on your display. If you can see it, your pixels are large enough to be noticed!


So what does pixel size have to do with aliasing? Everything!

Because pixels are big and noticeable, it is impossible to draw a completely smooth, curvy line or a completely straight, diagonal line on a computer screen. When trying to do so, we end up with something that has a "stair-step" or "jagged" pattern. This pattern occurs because we can only draw parts of our line in one pixel or another. We can't draw it half-way between two pixels because a pixel must always display a single, uniform color across its entire physical size. Since pixels are large enough to see, most people will notice the aliasing, or "jaggies", in the appearance of the following curve:


Note that the use of the word "aliasing" to describe this graphical artifact comes from the signal processing world and predates computer graphics. In other words, we didn't just make this stuff up.

Antialiasing in Brief

You might be amazed at just how much effort goes into making curvy and diagonal things look smooth on your monitor on an everyday basis. All of your windows and fonts and web sites have had hours of effort poured into making sure that you never notice your pixels.

But the question is, HOW do we make sure you never notice your pixels? Well the simplest and easiest way is... blur!

Effectively we can use color and contrast to trick the eye into not noticing the jagged edges. We do this by using selective blurring of the jagged edges to more gradually change the color from one pixel to the next. This more gradual contrast from one pixel to the next makes the edge appear less well defined and less jagged. If we do it juuuuust right, it makes the line appear smooth and, counter-intuitively, more "crisp" than the jagged counterpart. Too much, though, and it just ends up looking blurry.

Here is an example of some AA smoothing being applied to our jaggie curve:




To clarify, we haven't made the pixels any smaller. We just added a lot more pixels to the line in various shades of gray to blend the white line into the black background. Despite the fact that every one of these pixels is just as visible as before, your eye perceives this collection as a much smoother line, because vision is just neat that way. Here's a zoom of the previous images to show how this works:




Note that there are other tricks in addition to blur for doing AA. Font rendering in particular makes use of a nifty thing called sub-pixel rendering, but I'm not going to cover that here. It's an overly technical thing that's not all that relevant for my main focus of 3D gaming AA.

Perception and Pixel Size

There's an important thing to clarify about aliasing and AA that everyone seems to spend a lot of time fighting about: not everyone notices aliasing to the same extent! Whether or not you care about AA and the relative importance you place on it versus other visual factors usually boils down to whether or not you notice the aliasing in the first place. And whether or not you notice aliasing has a lot of contributing factors.

High-contrast aliasing (like the white line on black background example) is, for most people, a lot more noticeable than low-contrast aliasing or aliasing that is occurring in a "busy" setting with lots of color, variable contrast, and motion. This is simply a subjective thing about personal perception and it is one reason that many people who may clearly see the "jaggies" in the example image on this page still don't notice aliasing at all in an actual computer game or movie being displayed on their monitor. It doesn't mean the aliasing has gone away, it just means that their perception of the aliasing in these contexts may change dramatically to the point that it stops being noticeable.

This really shouldn't come as a surprise, especially considering that AA itself often just manipulates contrast and other factors to reduce our perception of the pixels. In other words, AA only works because of perception in the first place! And yet people will get surprisingly vehement about this topic on forums -- to sum up the typical exchange, if you don't notice jaggies you're a graphical Luddite and if you do notice jaggies you're an OCD basement dweller.

Subjective perception aside, it may surprise you to learn that there is no "standard" size for pixels. Some displays simply have smaller pixels than others. The size of the pixels in your display is easy to figure out; take the number of pixels it has in one dimension and divide by its physical size in the same dimension (works with either height or width since most displays have square pixels). This will give you the "pixels per inch" (PPI) of the display. For instance, my monitor is about 11.75" high and has a vertical resolution of 1080, so its PPI is about 92.

By increasing the resolution of a display without changing its physical size, you increase the PPI. The higher the PPI of a display, the smaller its pixels (which just makes common sense... packing more pixels into a smaller space must mean each pixel gets smaller).

A standard desktop monitor is going to have a PPI in the range of 80 to 100. A lot of laptops, however, are in the 100 to 150 PPI range. And many mobile devices have a PPI of between 200 and 300. The new "retina" display from Apple has a PPI of about 320. Since aliasing is a direct artifact of big pixels, the smaller the pixels in your display, the less likely you are to notice aliasing. If you game on a laptop, for instance, aliasing might be much less noticeable for you than for a desktop gamer.

The holy grail of PPI is around 300 or so; anything higher than this and the pixels become so small that most people cannot pick them out individually (though the exact limit is a matter of personal perception and your own eyesight). Unfortunately there has been little impetus for display manufacturers to make high PPI monitors or TVs for regular consumer use. There are a ton of reasons for this, none of which I'm going to talk about here.

Viewing habits also subjectively change your perception of the pixel size. The further away you are from the display the smaller the pixels seem to you. You might call this "relative PPI" or any other number of fancy things, but the basic idea is that the further you are from a display the less likely you'll be able to pick out individual pixels and therefore the less likely you are to notice aliasing.

Why Aliasing is an Issue for 3D Gaming

This brings us, finally, to the last point of this first half. Why is aliasing an issue for 3D gaming?

Really, aliasing is an issue for ALL computer graphics, not just real-time 3D. Every time something gets drawn to the computer display, somebody somewhere has thought about aliasing and implemented a method or an algorithm to deal with it. The big difference is that static images (like the ones on a website) or simple 2D graphics (like your application windows and icons) have relatively well-understood, well-performing solutions. That's not to say it's always an easy problem; again, you might be surprised at just how much effort it takes to display a simple line of text clearly and without aliasing artifacts. But it is a problem that has been pretty much solved with satisfactory performance for most 2D applications.

For 3D graphics, the problem has to do with the dynamic nature of the final image. 3D graphics are generated by drawing polygons and then painting them with textures. The edges that occur between polygons present a big problem. These edges are routinely aliased and jagged. Likewise, even if we pre-process our textures to avoid aliasing, modern 3D graphics engines do a LOT of texture work. They scale them, rotate them, stretch them, distort them, skew them, and even stitch multiple textures together. All of this manipulation of textures can easily re-introduce aliasing back into the image as well. Finally, post-process effects like shadows and particles can add even more sharp, aliased edges to the rendered frame.

The question then becomes, how do we get rid of all that aliasing in a generic fashion without ruining the final image quality while still maintaining a decent framerate?

The State of 3D AA

There are three broad categories of AA techniques that exist today for modern real-time 3D graphics. I haven't seen these three categories identified as such, so I'm using my own labels for these. That means you aren't likely to find these exact category names described anywhere else, despite the fact that I think they are crucial to understanding the various options and techniques in modern AA. They are, in order of their introduction to mainstream 3D graphics:

  1. Scaled AA (scaling, SSAA, Adaptive SSAA)
  2. Pipeline AA (MSAA, TSAA/TMAA/AdAA/TrAA, CSAA/CFAA/EQAA, Quincunx/QSAA, TXAA)
  3. Shader AA (MLAA/FXAA, SMAA)

It's important to note that in my discussions on these techniques I will be greatly simplifying the technical details once we get past the broad categorical distinctions. Too many articles try to cover the nuanced technical differences between each individual form of AA and, frankly, it's completely irrelevant to anyone but a 3D programmer. If you happen to BE a 3D programmer, beware the cringe-worthy over-simplifications ahead.

Scaled AA

Before 3D graphics were a hot thing, 2D graphics processing had already been dealing with aliased images for a long time. It came up often when you wanted to scale an image; that is, resize an image to be larger or smaller. When scaling an image up, you had to somehow "fill in the blanks" with image data you didn't have. When scaling an image down, you had to decide which original pixels to use and which original pixels to throw out. If you didn't have intelligent algorithms to deal with this issue, the resulting scaled image could end up with lots of ugly aliasing artifacts just like the ones we want to get rid of.

Luckily a lot of smart people came up with a lot of clever algorithms for interpolating pixels in order to make the 2D image scaling look as nice as possible. These algorithms have been refined and tinkered with for so long that they are now extremely sexy and very fast. In fact many of these algorithms are even implemented directly in the hardware of modern monitors and TVs because they often have to deal with displaying a source image that is not the same resolution as the monitor.

The interesting result is that if you take a final, rendered 3D frame and simply resize it, some of your aliasing artifacts will disappear. You can abuse the hardware in a modern monitor or TV to do this for you by setting a game to render at a different resolution (usually slightly larger) than the actual display resolution, then having the monitor or TV scale it down for you. This can eliminate some of the most noticeable "jagged edge" aliasing, but it may also introduce other issues. For instance, it may blur text or the user interface at the same time.

This oft-overlooked "benefit" to scaling is one reason many console users never notice aliasing at all. All too frequently a console game is being "up-converted" by a TV to a different resolution than it was rendered in, and the aliased, jagged edges are smoothed away by the algorithm doing this. Of course, a lot of the other visual content is suddenly blurry and less crisp as well.

Scaled AA works best when you produce an image much larger than you need, with more detail than your monitor can display, and then scale it down. This leads to...

Supersampling (SSAA)

Supersampling is an extremely simple concept. If we render an image much larger than the final image needs to be, then scale it down to the necessary size at the end, we can get rid of all the aliasing artifacts while barely impacting image quality. The reason this works is fairly easy to understand.

As already covered, a 300 PPI monitor would have tiny, indistinguishable pixels and therefore no perceptible aliasing. So let's pretend that I have a monitor that is 19.2" wide and 10.8" high and 300 PPI. It would have a resolution of 5760x3240. If I rendered my image to this imaginary 300 PPI monitor I would be unable to distinguish individual pixels and wouldn't notice any aliasing at all. That'd be great!

Unfortunately, a desktop monitor of this size is usually going to be at a resolution of only 1920x1080 (100 PPI). However, we know that there are awesome and fast algorithms that can resize a large image down to a smaller size without adding any noticeable aliasing. Sure the image on the 100 PPI monitor might be a little less crisp and have a bit of blur in comparison to the image on the 300 PPI monitor, but this would be the absolute optimal solution whose only limitation is the PPI of the display device.

SSAA does exactly that. It renders a very large image (usually 2x or 4x larger than the desired final resolution) and scales it down. The result is a high quality image with no artifacts and very little blur or image distortion. SSAA is really the ideal AA solution and was the very first AA solution introduced to 3D gaming. To this day it still reigns as the most visually attractive form of AA as well as one of the simplest techniques to integrate into a 3D engine -- really an engine doesn't need to do anything at all except render very large resolutions.

Alas, SSAA is extremely expensive to do. Doubling our resolution (200 PPI) doesn't mean we have to do twice the work; we actually have four times as many pixels to draw as before! (1920x1080 = 2073600 while 3840x2160 = 8294400). Likewise, tripling the resolution (our 300 PPI example) means we have nine times the number of pixels to draw! This means I'd need a graphics card 4x the power of my current one just to reach 200 PPI on the same size monitor and 9x as powerful to reach 300 PPI.

This is why a common misconception I see floating about is simply not true: higher PPI monitors won't help the situation. If I could rush out tomorrow and buy a 300 PPI monitor to stick on my desktop I would still be in the exact same boat I am now; I'd need a video card 9x more powerful to render the same content to that monitor. If I had a video card that powerful I could just render the image much larger than needed and use SSAA to make it look really nice and clean without upgrading my monitor at all.

Adaptive Supersampling (Adaptive SSAA)

Adaptive SSAA is an attempt to reduce the performance impact of SSAA while still gleaning all of its benefits. In short, you try to decide if pixels that are near each other in the final output really need all that AA work done. If they do then the engine can render just that small area at a much higher resolution, then scale it down to get the final output pixels.

In practice, adaptive SSAA did not typically provide a significant enough performance boost to be useful. Note that these days, "Adaptive Supersampling" almost always refers to "Transparency Adapative Supersampling" (TSAA).

Pipeline AA

SSAA came along and people saw how beautiful 3D could be without aliasing, but unfortunately no one actually had a video card powerful enough to run SSAA for most games. This started a technology race to try and reproduce the graphical results of SSAA with less intensive algorithms that didn't melt down video cards.

A batch of techniques developed out of the realization that the 3D engine knows a lot about the 3D geometry of a scene, and that this information can be used by AA algorithms inside the rendering pipeline to make more intelligent decisions about where and when to spend processing power to apply AA to specific parts of the image.

One major drawback of these pipeline AA techniques are that, for the most part, they must be integrated into the graphics engine. This makes it very difficult to retroactively apply new pipeline techniques to old games or engines, or to take advantage of new GPU hardware improvements. A great example of this is the new nVidia TXAA technique that recently launched; while a very effective and good-looking AA technique, it only works in games with engines that have been explicitly modified to support this new process.

Multisample AA (MSAA)

The details of exactly how MSAA works aren't that relevant. What matters is that MSAA is very good at using the 3D geometry of a scene to apply AA only to areas that need it most. In particular, the sharp edge that shows up when a polygon is rendered over top of something. Tight integration with the rendering pipeline and the scene geometry allows MSAA to apply AA directly to this special edge case (har har).

MSAA can eliminate aliasing caused by polygon edges with an acceptable performance impact. Unfortunately, MSAA doesn't deal well with aliasing from other sources. For instance, it doesn't handle aliasing within textures (due to texture scaling, rotation, procedural generation, etc.).

There are many different nuances in how exactly MSAA can sample the image to perform its AA, and some of these nuances are given vendor-specific monikers. For instance, nVidia had a habit of adding "Q" to any of its MSAA modes that it thinks produce better quality AA (though it now seems to use Q in AA modes to differentiate between MSAA and CSAA without having to use either of those terms). Often these monikers relate to the geometric pattern used in the MSAA sampling method.

In practice, the exact technical details between MSAA modes don't matter and wouldn't help you pick one MSAA mode over another. What matters is trying out the different MSAA modes in game and picking the one that looks best to you with the least performance hit you are willing to tolerate.

Transparency Multisampling AA (TMAA), Transparency Supersampling AA (TSAA), Transparency AA (TrAA), Adaptive AA (AdAA)

For all its performance boosts, MSAA does not handle transparent textures. Transparent textures are a common way of "faking" intricate geometric detail without actually creating 3D geometry. For instance, a chain-link fence might be a very simple polygon with a complicated transparent texture that produces the chain-link wire pattern while allowing the background scene to show through where the texture is transparent (e.g. between the wires of the fence).

MSAA does not typically handle aliasing inside a texture at all, and transparent textures are textures just like any other. Their transparent bits, when used to mimic geometry, have a tendency to cause aliasing issues just like the edge of a polygon would. To address this deficiency, transparency AA re-introduces more expensive AA only for the areas of a scene that contain an object with a transparent texture. Typically this is done by applying good old adapative supersampling AA to just that part of the scene, but other AA algorithms may also be applied. These are usually vendor-specific (ATI vs. nVidia).

Note that, without context, most modern references to "Adapative Supersampling" or just "Adaptive AA" almost always relate to the specific case of transparent textures only, not full-scene supersampling.

Coverage Sample AA (CSAA), Custom Filter AA (CFAA), Enhanced Quality AA (EQAA)

CSAA, CFAA, and EQAA are vendor-specific extensions of MSAA. CSAA comes from nVidia and CFAA and EQAA come from ATI/AMD. As with the rainbow of vendor-specific MSAA modes, the details of exactly what CSAA, CFAA, and EQAA do in addition to the basic MSAA functionality is not all that relevant. The most important bit is to note that all three of these attempt to replicate the quality of MSAA whilst reducing the performance impact.

Picking one mode over the other simply boils down to trying them out to see which one you prefer while incurring the least performance impact.

Quincunx Super AA (QSAA), Quincunx

This is yet another MSAA method that has been given its own name. It relates primarily to the pattern used to take AA samples, but again the technical details are mostly irrelevant. It does have a tendency to blur textures across the board, however, which is a good lesson to remember that MSAA does not always impact only edge geometry.

TXAA

TXAA is yet another pipeline-based technique being introduced by nVidia. One of its biggest improvements is that the algorithm uses temporal information -- that is, not just data from the current frame but other frames as well -- in order to perform its AA processing. This can address a "shimmering" effect often noticed when moving through a scene with classic MSAA techniques.

Shader AA

Because MSAA and other pipeline techniques are geometry based and exist within the rendering pipeline, they don't deal well with aliasing introduced by shaders or other post processing effects. This can include things like shadows, bloom and HDR effects, particle effects, and so on. In fact it can even interfere with some of these. When MSAA was introduced these techniques were less common, but as 3D engines have become more advanced these sources of aliasing are showing up more often.

As a result of all this aliasing showing up in a scene that pipeline/MSAA could not deal with there was renewed interest in applying AA to the entire rendered image all at once. Some people call this "Full Screen AA (FSAA)" but I dislike the term because that would include supersampling AA, which is really its own separate thing, and also because it takes focus away from what is most interesting about this form of AA; the fact that it happens in post processing shaders.

Without getting into the technical details of the rendering pipeline or what a shader is, it's sufficient to note that shader AA can analyze the entire rendered image, including all of its post process effects, and try to apply AA to all of that. It's akin to being able to open up every rendered frame in Photoshop and apply a filter effect just before that frame goes out to the monitor.

It's not deeply embedded in the 3D pipeline like geometry-based MSAA, nor is it an example of massive supersampling or rendering high resolution versions that will be scaled down. Instead it is selectively applying blurring or sub-pixel effects to the final rendered image at the same resolution as the final output in order to try and eliminate aliasing.

Shader AA is interesting for a few reasons. One is that it tends to be extremely fast and has very little impact on performance because of the nature of the algorithms involved.

Shader AA can also be applied to almost any game on most modern video cards, even retroactively, by making simple changes to the 3D library to include the post process AA shaders. This is in contrast to pipeline AA which is deeply integrated into a game's rendering engine and the video card hardware and drivers.

Another feature is that a game that embeds a form of shader AA into its engine can get decent AA for virtually no performance penalty, and it can further include this AA at the most logical place in rendering for maximum benefit. For instance, a game might apply shader AA before rendering the user interface so that UI elements are not accidentally blurred out.

Finally, shader AA can work in conjunction with other types of AA. Since it has low performance impact and happens at the end of the rendering process, shader AA can be added on top of existing AA techniques rather than replacing them entirely.

For all these benefits, shader AA does have some drawbacks. Most notable is the fact that it affects the entire image. This can lead to blurring, color distortion, or brightness changes across the entire image that negatively impact the final quality.

Morphological AA (MLAA), Fast Approximate AA (FXAA)

Both of these are the vendor-specific implementations of shader AA that can be enabled directly in their respective drivers. MLAA is the ATI/AMD version and FXAA is the nVidia one.

FXAA is notable in that it has an "injector" form, which is a version that can be added into the rendering process of any DX9 or DX10 game regardless of driver support. This works by simply copying a few files into the game's executable location to update its DX9 or DX10 stack. Since this also contains the actual FXAA shader source code, it's also possible to tweak the AA settings to customize the exact AA output independent of whatever the current implementation may be in the nVidia driver.

Enhanced Subpixel Morphological AA (SMAA)

SMAA is interesting because it really illustrates all of the powerful benefits of shader AA. It's a 3rd party shader written independently from both major hardware vendors (ATI/AMD and nVidia). Because it's external shader code it can be updated by the authors at any time regardless of video card driver updates. The algorithm is continually being improved to increase edge detection accuracy while avoiding unnecessary blurring and quality degradation.

As with other shader AA, it can be applied retroactively to just about any DX9 or DX10 title provided the video card has the necessary shader support.

Time to Go

0
To say that the human race is in its infancy presumes too much. Sol is our mother and we are still in her womb, dependent on an umbilical tether to the only star we have ever known. As the fetus cannot fathom life beyond its cocoon, nor can we as a species comprehend what is in store for our extrasolar descendants. Our feeble attempts to reach the planets are but the twinges of a coming labor that we must endure. If we do not start to push for the stars soon, the birth of our race may come too late; our future will be stillborn.

Cataclysm Raid Progression Graphics

2

I was playing around with the WoW Model Viewer checking out how cool all my toons were eventually going to look someday, when I decided I should try to do something a little more productive with it. Because I like shiny things, and guilds like shiny things, and people like to be rewarded with shiny things as they achieve, uh... shiny things... I decided to create some shiny progression graphics that guilds can use on their websites as they fight their way through Cataclysm raid content.

You are free to use these graphics in any way you please (well, since it's all Blizzard's artwork regardless, in any way THEY please). However, PLEASE DO NOT LINK TO THESE GRAPHICS DIRECTLY! HOST THEM YOURSELF! All of these graphics can be downloaded in this convenient 11MB package. NOTE: That package also contains the original GIMP/XCF files, if you want to customize them... though you will additionally want to grab the Faerie font from UrbanFonts in that case.

Throne of the Four Winds

Throne of the Four Winds Tower Throne of the Four Winds

Bastion of Twilight

Bastion of Twilight Tower Bastion of Twilight

Blackwing Descent

Blackwing Descent Tower Blackwing Descent