Interesting Graphics Techniques

BlitzMax Forums/BlitzMax Programming/Interesting Graphics Techniques

I was wondering if anyone had experimented with or discovered any interesting or unusual 2D graphics techniques in Max?

Specifically, I'm wondering if there's a way to create a real-time blur effect, or make an image look as though it's out of focus (e.g. too close to the "camera").

Any suggestions or interesting code nuggets welcome :)

Here's one I made a while back...

http://www.blitzbasic.com/codearcs/codearcs.php?code=2116

Note that's its pretty math-intensive, and you'll need a fairly decent machine if you're intending to run it real-time.

Here is my bloom .
The same technique might be useable full-screen but never tested.

Here's another blur function I whipped up --

It's much faster than my other blurr in the code archives, but more limited in how 'blurry' it can get.

SuperStrict
Graphics 640,480

Local img:Timage=LoadImage("j:\monkey4.jpg")

Local strenght:Int=0
' Strenght is either 0 or 1 -- 1 is blurrier, but slower as well.

SetBlend(alphablend)
SetScale 1,1


While Not KeyDown(key_escape)
	drawblurry(img:Timage,strenght:Int)
	Flip
	Wend
WaitKey()

Function drawblurry(img1:TImage,strenght:Int=0)
	DrawImage (img1,0,0)
	
	If Strenght>0 Then 
		SetAlpha 0.2
		DrawImage (img1,-2,-2)
		DrawImage (img1,-2,2)
		DrawImage (img1,2,-2)
		DrawImage (img1,2,2)
	End If

	SetAlpha 0.25
	DrawImage (img1,-1,-1)
	DrawImage (img1,-1,1)
	DrawImage (img1,1,-1)
	DrawImage (img1,1,1)
End Function


Isn't there such a thing as hardware blurring these days?

And if not, why not? ;)

With a shader, yes.