Shader Madness david.nikdel posted in general on February 19th, 2006
I’ve been doing a lot of messing around with HLSL recently and one thing that has really started to bother me is that I can’t find a definitive reference for the language. I’m not talking about tutorials, I mean answers to questions like “what are the possible enumeration values of MinFilter” or “what is the actual syntax of the operator <X>”. It’s getting on my nerves. I know this document must exist somewhere, but MSDN constantly comes up bare and google is inundated by so many code snippets it’s hard to find something that is authoratative.
In any case, I’ve managed to piece together the beginnings of my attempt at adding specular bloom and motion blur to a test project. This is what I have so far:
The picture on the left is the true color output, the center is visualization of the offset image, and the right is a visualization of the light intensity map. I say visualizations because the actual maps are floating point textures (the offset image is R16G16F and the intensity map is R32F). All three are generated in a single pass using multiple render targets. Right now, you can use the X,Y,and B buttons to switch between views. I haven’t yet finished the process of combining them all together.
I have been reading around and I can’t find or think of a good way to do motion blur on the GPU. Because each pixel in the input contributes to an unbounded number of pixels in the output, the only way to do it via GPU (that I can think of) would involve doing a grid search and finding the correct pixel to blur from. This seems like it would get expensive. I will probably try this as well as a CPU approach. I’ll post more later as to whether or not this was a success.
Project Offset david.nikdel posted in general on February 16th, 2006
If you haven’t seen the amazing tech demos for Project Offset, you need to scoot over to IGN and check them out. This engine is cutting edge. Their three main claims to fame are: full self-shadowing on all objects including particle systems, HDR lighting with specular bloom, and full scene motion blur.
This got me thinking about just how they pulled all this off. If I had to guess (and, mind you, this may be completely wrong) I would assume that the self-shadowing is a combination of pre-baked statistical lighting to spoof global illumination falloff in areas traditionally poorly lit –like characters’ armpits– combined with depth-based, per-light shadow maps and a pixel shader checking to see if each point is visible by each light (by doing a map lookup and comparing depths).
As for the specular bloom and motion blur, these are traditionally post-process effects. I was thinking about it and, while you would certainly have to use custom shaders to help generate these effects, the actual blurring is most likely still done as post. Seeing as all the next-gen consoles (as well as the high end PCs) have multiple cores, it stands to reason that this is no longer out of the realm of possibility for realtime games. One core can perform post while the other is rendering the next frame. The technique for specular bloom seems like it would be pretty straight forward if they are using floating point textures to represent the pixel luminosity. As for the motion blur, I assume they are probably generating a helper texture — something akin to a normal map in that it’s a map of vectors but representing velocity (relative to the camera) rather than a normal. Once again, this would be highly facilitated by the use of floating point textures since velocity vectors need not be of unit length.
Anyway, the point of this post is that I’ve decided to turn this C# project into a pixel shader test-container. It is easy to manage and add things to the framework; perfect for messing around. I think I might see if I can get some motion blur of that sort working in there. Sounds like a fun challenge.
I think I’m going to modify this XInput project to morph into something I’ve been reading a lot about lately: Acoustic Wavetracing. The general concept is that sound, like light, propagates as a wave which means we can borrow some techniques from light raytracing. The main difference, however, is that, unlike light, the speed of sound is not (for all intents and purposes) infinite.
Heh, well that was the beginning of a post I was going to make until I found out that something similar has been being done in hardware on the newest sound cards since 1999. Just thought this was funny. More ideas to come…
Pixel Playtime david.nikdel posted in general on February 10th, 2006

So, I’ve got this project going where I’m playing with Managed DirectX, XInput (for the XBox360 controller), and rendering to a texture all at the same time. Getting everything working has been fun, but I’ve sorta run out of steam as far as where to go with it. Moving a teapot around with a controller is quite a novelty on a PC, but it does get old pretty fase. To test out some of the things you can do with render-to-surface, I wrote a pixel shader to stretch the edges of the screen in a neat, warp-speed sort of way. The picture above probably shows you a bit more what I mean, although the effect would be more pronounced if the teapot were textured. I’m thinking about implementing one of the GPU-based motion blur algorithms I’ve read about. I’ll post more on that as it develops.
Honestly, I was not a fan of C# when it was first announced, but with Visual Studio 2005 and .NET 2.0, it has really come into its own. I recently got to take Windows Forms out for a spin while working on a project at work for collating the various log files that are generated on our kiosks. Each line in the log file has a time stamp, so we really needed nothing more than a GUI for reading in the logs, sorting them, and presenting the user with some search and save mechanisms. It’s a bit more complicated than that, but that’s the gist of it. Nothing hard, right? Maybe a day or two? I decided to use .NET 2.0 and Windows Forms and had the barebones features implemented within a few hours! That’s including the obligatory MSDN time since this was my first crack at Forms. It really is slick. Any property you can set on a control is accessible through the WYSIWYG editor, adding delegates is a snap (or a click as it were), and they’ve cleaned up a lot of the previous problem areas like adding menu and status bars and aligning things so they scale correctly when the window resizes. The best part was that everything I just described was set up even before I hit the code!
Once I got in there, it was easy to implement the base functionality while still having time to add nice-to-have features like a dynamic context menus, color coded rows for different log message types, and a status and progress bar. Even application preferences are niftily handled. You can define a set of properties to use as preferences in the WYSIWYG editor and a class is generated for the lot of them which takes care of persisting the values, calling delegates when they change and saving the new values should you decide to change them. All I had to do was implement a preferences dialog that presented the settings (within controls), allowed the user to change them, then saved them off when they clicked OK. There’s even the notion of application and user based preferences.
Combine this with the fact that every system function under the sun (as well as a host of utility classes) is exposed to you via an organized hierarchy and it certainly makes windows development seem like much less of a chore. They even fixed some of the big headaches from v1.0 like adding partial classes to rid the world of unsightly “don’t touch me” #regions. I can’t wait for .NET 2.0 for linux hehe. Now, I’m not convinced they have everything right when it comes to Web applications (for one, I really do not like the ViewState — more on this later) but for windows GUI development, this is the way to go, hands down. I will never use MFC again unless I have to, that’s for sure. It will be interesting to see how this all interacts with WinFX/Avalon and the new XAML GUI paradigm.
Ok, so I added a page on MeCHeM, the game me and some friends entered into the Hidden Agenda game competition a few years ago as well as a tutorial I did for NeHe.GameDev.net when I was in highschool heh. At some point I need to write up something about this demo app I’m working on right now and upload what I have so far (even though it’s not done yet). Perhaps I’ll do that tomorrow if I can find the time.
Also, mental/electronic note, Guitar Hero is a freaking badass game. It’s so simplistic, but highly addictive. Must remember to play it more often. Ronnie brought up the idea of playing a game or two after we work out. I think I could get used to that.
So far… david.nikdel posted in general on February 5th, 2006
Ok, so far I’ve uploaded my resume, written a quick page on GnomeKP (a project I did a while back) and finished configuring everything. Hopefully I’ll not be lazy and continue updating everything here. I’d like to post the rendermonkey grass billboard test I wrote last week, as well as my .NET XInput wrapper and the graphics demo I’m working on currently. I think I’m going to go back to working on that now though.
Intentions david.nikdel posted in general on February 5th, 2006
My intention here is to create a place where I can post my resume, code samples, and personal projects as well as provide thoughts on how they’re going and just maybe receive some feedback. Expect the layout and design to change significantly as I start getting things in order.
|