Times, trials, and turbulence.
Today saw more progress on my 3D rasterizer project. Clearly most readers aren’t nearly as fascinated by this topic as I am, so I’ll have to try and fit some more game development-y content in here rather soon. Yay or nay?
Step 2: Triangle rendering
After the tedious step of getting DirectDraw working, the main thing any rasterizer needs to be able to do is draw triangles. And fast. My algorithm is pretty fast, but the current code is only my first shot at it. As time goes by I’ll work on optimizing it further, and squeezing out as much performance as I can out of this. This and the below step are the workhorses of a 3D engine. I can venture into some detail about the algorithm I’m using if there is any interest.
Step 3: Vertex attribute interpolation
Sounds fancy, but what does it mean? Lots of values get interpolated — or “shaded across” — a given triangle, such as colour, surface normals, and texture coordinates. I’ve managed to implement per-vertex colours at this point, but have yet to abstract the values more so that it can be used to interpolate virtually any value across the triangle. What does this mean in terms of graphical shininess?
(Above: Gouraud-shaded triangles, using vertex attribute interpolation.)
If you are not already familiar with the joys of linear interpolation, I suggest you read up on it. It’s an indespensible technique that any game developer can easily benefit from. You’ve probably been using it for ages without even realizing it had a spiffy name!
Cleaning up my existing code, and figuring out how to turn this all into some kind of graphics pipeline. This will call for some research: probably looking at how OpenGL and Direct3D do their pipelining — fixed function, that is. Afterwards, implementing matrices will be the main task. This includes transformation matrices, the projection matrix, and a camera matrix. That’s when things start to look a little more interesting. 🙂