In my current project, I was trying to come up with a way to antialias and fade the entire screen during gameplay, in 16-bit color. As you can imagine, it was slow. So hey, here's the algorithm for everybody who wants to do something to every pixel on the screen that's just too CPU-eating to be done at the rate you want: In case you don't get it, I'm saying you do only a subset of all the pixels onscreen, but you do them in such a way that the ones being done appear to be semi- random. Obviously, your number has to be such that it will hit every single pixel and then repeat. If what you are trying to do to the pixels takes so long that you can only do 10 or so each frame, you're screwed, so don't bother. I do 640*20 pixels per frame (20 lines worth, the screen is 640x480), so it takes 24 frames for it to do the whole screen once. Pretty bad if you think about it, but you know, it looks really good. Except one thing- it really bogs the game down. A lot less than it would if I did the whole screen though! I'm sure all those people who know junk about cache optimizations and all that crap scoff at this, but they're just not artist`es. Hmph. P.S. the number I used was 640*280+1, which ensured the pixels being updated were nowhere near each other generally, so you don't get much of a banding effect.
|