080709 / Anti-Aliasing

previous | next

Anti-Aliasing

Got anti-aliasing working in engine without hardware AA, using temporal jitter, sub-pixel positioning, and frame feedback. The 720P shots below (running at over 60fps on my NVidia 8600 GTS) were generated from only 256 K/pixels per frame. So I'm effectively only computing 25% of the screen pixels a frame. Which is great, builtin "keeping it low res".

Click image for the full 1280x720 resolution shot, updated it actually works now!

I'm very satisfied with the results thus far, moving to GPGPU from CPU has enabled me to get a 64x speed up in the l-system traversal. There is still a lot of work to do (lighting, physics, content creation tools, etc), and I've still got a lot of possibilities for optimization, so this thing will be awesome when finished...

A Little Profiling

You can only get so far with GL_EXT_timer_query, and I don't expect NVidia to release the newest PerfKit for Linux any time soon, but I have some rough estimates. First, I a previous said that somehow the 8600 GTS was point draw limited around 68 Mpoints/sec. I cannot remember where I got that number from, but it is dead wrong.

Early in the engine I was getting 287M points/sec when drawing 128-bits/point, texture fetching 128-bits/point, and doing a large amount of math (over 80 gpu_program4 shader instructions per point).

At this point I'm doing 256-bits/point ROP (and 256-bits/point TEX) at 170M points/sec (on 8600 GTS). Without porting over to Windows and using NPerf, guessing I might be hitting a bandwidth limit either from a combination of texture cache over fetch on cache miss, or ROP bandwidth limits from scattering. I should have something like 272 ALU ops/point best case performance from the hardware, so I'm probably not ALU bound yet.

Good news is that I have broken through the G80 1/8 performance barrier for point drawing (based on SIMD packing in the fragment shader) in terms of ROP performance. I'm about 1/4 the way to the estimated peak ROP performance on this card (perhaps the G84 doesn't share the G80's limitations). Since I'm doing points instead of 2x2 pixel quads, this makes sense. Not sure yet if this limit can be broken (when ROP is probably designed for 2x2 pixel quads), but I have a few ideas to try out when I get to the windows port.

Part of the performance I've managed to get I'm sure has to do with a combination of doing all the math in the vertex shader, working with a FP32 RGBA framebuffer (which I'm guessing is much more ROP bandwidth efficient for scatter), and that I've designed my algorithm so its point scatter has both great destination locality, and good MP utilization (so it doesn't starve what I'm guessing are limits on output 2x2 pixel quad queues in the hardware).

Newest NVidia GL Drivers

Just switched to the latest NVidia drivers (after not updating for perhaps the last 6 months), and my test program ran significantly faster on the newest drivers. Seems like they might even have an optimization to not fetch vertex attributes when you don't use them... (I'm computing vertex attributes from gl_VertexID).

In any case, thanks all at NVidia for single handedly keeping OpenGL up to date!