1 Attachment(s)
Ok, by popular demand: Special Effects for DX!
Here they are, what you've all been waiting for: special effects for DX games!
Now you don't have to rely on the user's graphics card, it's all software-rendered :)
Best of all, it can run at a huge FPS even though it was made in pure VB code!
It's very easy to use: add a reference to the dll to your project, a wrapper module, call the tiny initialization function and use the SpecialBlt function wherever you need :p
Here it is, in a small 77kb download. It's even expandable to other engines like DX. Have fun ;)
NOTE: Because I'm a lausy DX programmer, the demo (read: DEMO, the effects work fine :D ) doesn't change the color depth of the monitor automatically to 24 bits. Make sure you do that so it doesn't give you any weird errors :p
The how and why of lookup tables.
Wow! realtime chat!
Well, i've got 2 years experience doing this stuff, so I think I might be able to explain it by now ^_^
I'll try to explain how you use lookup tables for alpha blending...
You see, you create a table, 255x255 bytes. Then, you initialize it like this:
VB Code:
For Alpha = 0 to 255
For Value = 0 to 255
Table(Alpha, Value) = Value * (Alpha / 255)
Next Value
Next Alpha
Now, you've got a table. How the heck do you use it? Simple.
You use an algorithm like this to alpha blend an entire image:
VB Code:
For Y = Y1 To Y2
For X = X1 To X2
DestImage(X,Y).Red = Table(255 - Alpha, DestImage(X,Y).Red) + Table(Alpha, SourceImage(SourceX,SourceY).Red)
DestImage(X,Y).Green = Table(255 - Alpha, DestImage(X,Y).Green) + Table(Alpha, SourceImage(SourceX,SourceY).Green)
DestImage(X,Y).Blue = Table(255 - Alpha, DestImage(X,Y).Blue) + Table(Alpha, SourceImage(SourceX,SourceY).Blue)
Next X
Next Y
If you want me to elaborate, let me know :)