2006-01-05

Vertex / Pixel shaders

I've been coding like crazy lately, every day for most of the day. Well so much for working on game mechanics. Instead I decided to play around with vertex shaders so that I could remove any Fixed Function Pipeline code and get the engine running with shaders instead. I'm familiar with assembly shaders, having written some for XBOX, but I decided to play around with the new High Level Shader Language since it seems that this is the future of programmable graphics hardware. It was pretty straight forward. I looked at some DX sample code and figured most of it out. I compile the shaders using fxc.exe and generate header files that contain the binary shader code. It took a while to get everything working smoothly because I didn't know about the Vertex Declaration, which I believe is new to DX9. So for a while things weren't working properly and I didn't know why. I eventually figured this out and things were fairly smooth from then on. I have a basic vertex shader that just passes the incoming vertex information out with the only exception that I upload a world/view/projection matrix into a constant register and do the vertex transformations in the shader. The pixel shader just passes through the vertex color. Currently I don't even use this shader since I haven't figured out the texture lookup in HLSL yet.

So that was my last big accomplishment. Everything is up and working again, but now I have the shader portion of the engine in place. Plus a did a bunch of other modifications that were needed to work with this change to shaders. I also switched from using clock() to using QueryPerformanceCounter() in order to get better resolution when timing the framerate. Plus it will help when I finally implement my own profiler. So much to do, so little time. Classes start on Monday.

0 Comments:

Post a Comment

<< Home