WGDC 2000 - Direct3D
State of the art 3D graphics
Microsoft's Direct3D API has come a long way since the early days of DirectX, with all the leading graphics cards now supporting the latest version, and the majority of new 3D accelerated games running on it.
With DirectX 7, support for new hardware features such as texture compression and hardware Transform & Lighting acceleration was added, and the results can be spectacular.
During the opening speech of WGDC 2000, Microsoft's Mike Burrows showed us the now famous "Isle of Morg" demo, created by The Whole Experience to show off many of the latest graphics hardware features.
The demo makes extensive use of dot product 3 bump mapping, hardware T&L acceleration, dynamic lighting, vertex blending, and other features to produce some stunning graphics. Wide open terrain is dotted with trees and plants, standing stones and buildings jut out of the ground, and all kinds of bizarre and graphically detailed creatures wander around the world.
Other old favourites included the "balls" demo, which shows a Newton's Cradle, with the silver balls that make it up reflecting an environment map of the inside of one of Microsoft's offices. Unfortunately, just as Mike was explaining the "very simple physics" behind the cradle, the central of the five balls decided to suddenly pop out the side, with the four remaining ones carrying on swinging backwards and forwards as if nothing had happened. Whoops - quite a balls up!
The particle fountain is another well-known (but also well behaved) demo, showing a pyrotechnic spray of particles that are alpha-blended and motion blurred to produce a spectacular effect. As Mike commented, "we'd love to see this in games". Ditto for the water demo, which shows a pool of water which ripples and reflects its surroundings believably.
Put That In Your Pipeline And Smoke It
Which is all well and good, but no doubt what you really want to hear is "what's new in DirectX 8". The answer is a mixture of improved hardware support, some house-cleaning, and a spattering of new features.
One of the most important additions is a programmable graphics pipeline, with support for pixel and vertex shader effects. What this means is that, for example, instead of having to rely on the standard DirectX 7 transforms to take advantage of T&L acceleration, you can now also program your own using vertex shaders.
This allows more flexibility than the current fixed pipeline. One example we were shown used a simple vertex shader to produce a fish-eye effect, distorting your view of the world. Not tremendously useful in practice maybe, but it did show that the effects you can come up with aren't limited to straightforward geometry acceleration, unlike in DirectX 7.
"I don't know how many of your games are going to be based on fish eyes, but now's your chance", joked Richard Huddy of NVIDIA.
There is one slight problem though - none of the current generation of T&L graphics cards support this feature, so all your customised vertex shaders will be running in software for most players. We will have to wait until the next generation of hardware appears later this year before we start to see the full benefit of this new feature. Time to upgrade .. again?
The good news though is that even running in software the vertex shaders are "surprisingly efficient", although as Richard Huddy commented, "we don't make money by going slower than the CPU".
Another key feature supported in DirectX 8 is volume textures, which are essentially made up of lots of thin slices stuck together to form a three dimensional texture map. Wherever the volume texture intersects the game world, the appropriate pixel is read from the volume texture and applied to that point.
Perhaps the most obvious use for this is in dynamic lighting effects. Attach a light map made up of a spherical volume texture to a rocket, and as it moves it will realistically light up its surroundings. Or how about creating a volumetric light-map for a lamp shade, based on the shape of the shade and the bulb inside it? Now when you move the lamp, the shadows it casts on the room will be eerily accurate.
Another suggested use was for texturing objects which you want to cut up. For example, if you give a lump of marble a volume texture and then the player blows a hole in it, they will be able to see the veins running through the inside of the marble.
Texturing terrain is another possible application. At the moment terrain in games such as Starsiege Tribes or Asheron's Call is rather repetitive because the textures on it are tiled endlessly. In future you will be able to texture terrain using a volume texture. Because different parts of the volume texture will intersect the terrain in different places, it won't repeat itself as obviously as a normal surface texture.
There is one problem with volume textures though, and that is that they take up a lot of memory. In fact, using mip-mapped volume textures was described by Microsoft's Colin McCartney as "the most effective way of using as much video memory as you possibly can".
So you will no doubt be glad to hear that another of the new features in DirectX 8 is support for DXVC - DirectX Volume Compression, the volume texture equivalent of the widely supported DirectX Texture Compression. DXVC simply takes each slice in the volume texture and compresses it with DXTC's algorithms, greatly reducing the amount of memory and hard drive space consumed by volume textures.
Support for DXTC is also improved in DirectX 8, and the number of games using it should begin to rise rapidly now that most graphics hardware also supports the feature. NVIDIA's GeForce cards, S3's Savage series, ATI's forthcoming Radeon 256, and even 3dfx's Voodoo 5 graphics card can all handle DXTC.
The advantages this brings are numerous. Compressed textures take up less space on your hard drive, use up less memory, and take up less of the precious memory bandwidth which limits the real world performance of most current graphics cards. This means faster frame rates and less texture thrashing in games with lots of textures.
For games specifically designed with DXTC in mind, the benefits are even greater. Developers can use bigger and more detailed textures, which will make games look much more realistic, and if a player has a graphics card which supports DXTC the game will take full advantage of it.
But if the player's system doesn't have hardware DXTC support, the game can simply decompress textures as levels load, and then use the first "mip-map" of each texture. This is half the resolution of the texture along each axis, meaning that it takes up about a quarter of the memory that the full size texture would, making it more manageable for older hardware.
Of course, however detailed your textures are, if the characters and terrain underneath them are made up of a handful of polygons your game is still going to look blocky.
N-Patches provide a seemingly magical solution to the problem - a game reads in a low polygon model, but what appears on your screen is a fully fleshed out organic looking character, with smooth edges and as many polygons as your hardware can handle. How?
Well, it's all rather technical, but the short version is that your model is made up of a number of triangles. What N-Patches do is to take each triangle and split it up into smaller triangles. The corners of these new triangles are then adjusted according to some nifty mathematics, and the end result is that your character is made up of more triangles and has a more smoothly curved surface.
Jason Mitchell of ATI demonstrated this by taking our old friend, the Quake Shambler, and used N-Patches to increase the number of polygons that make him up. The result was stunning to say the least - the blocky five year old Shambler turned into a rounded, curvaceous figure, with up to 64 times as many polygons in his body as the original version, and none of his sharp, angular edges!
Effectively it's a reversal of the "Level Of Detail" system that many games are now supporting. With LoD, developers produce a highly detailed model, and the game then reduces the detail if the frame rate dips too low or the model is a long way from the player's viewpoint.
With DirectX 8, developers can now produce a relatively low detail model, and if the player's hardware supports N-Patches it will then add extra detail to the characters automagically.
And last but not necessarily least, DirectX 8 also adds support for "multi-sample rendering", as used by 3dfx with the T-Buffer effects on their latest Voodoo 5 graphics cards.
Essentially multi-sample rendering just means that you are rendering the same scene more than once and then combining the end results. For example, on a 3dfx card full-scene anti-aliasing is achieved simply by taking two or four "samples" for each pixel instead of the usual one, and then averaging the result in the T-Buffer and outputting that to your screen.
More realistic shadows can be achieved by rotating a shadow by a small amount around its origin - the object casting the shadow. By combining two or four slightly different shadows in this way, you will end up with a shadow that is still fairly sharp close to its origin, but has blurred edges further away.
At the moment these multi-sampling effects are only supported by 3dfx's Voodoo 5 graphics cards, and we have yet to see any games using them. Now that they are part of DirectX 8 support might become more widespread though.
Direct3D is now without a doubt the most important graphics API for Windows - most new games support it, as do all modern graphics cards. The big new features which are being added to Direct3D today are the ones which the next generation of graphics hardware will all support, and that next year's games will be taking full advantage of.
With new features like N-Patches, volume textures, programmable pixel and vertex shader effects, and improved texture compression being added to the latest version of DirectX, the future of 3D graphics is certainly looking bright, shiny, highly detailed, and more realistic than ever.
WGDC 2000 - Future Of Windows Gaming
WGDC 2000 - DirectSound and DirectMusic
WGDC 2000 - DirectInput Mapper
Spring 2000 Graphics Card Round-Up