Motion Blur

Blitz3D Forums/Blitz3D Programming/Motion Blur

Shambler(Posted 2003) [#1]
I stumbled across an interesting effect whilst writing my Blitz3D game engine.

Try and guess how it's done, no prizes ^^ and I'll post the source in a couple of days.

http://homepage.ntlworld.com/jm.keay/motion.zip


Rob(Posted 2003) [#2]
The old cameraclsmode trick? by not clearing color, but using a dark plain sprite overlay, you force it to fade what it leaves behind. Fast and no need for any copyrect.

It doesn't work well at all when you don't have a dark background though - assuming thats how you did it?


Rob(Posted 2003) [#3]
Graphics3D 640,480,16,2
camera=CreateCamera()
CameraClsMode camera,0,1
sprite=CreateSprite(camera)
EntityColor sprite,0,0,0
PositionEntity sprite,0,0,1
pivot=CreatePivot()
For i=0 To 100
	temp=CreateSphere(4,pivot)
	PositionEntity temp,Rnd(-200,200),Rnd(-200,200),Rnd(-200,200)
	EntityColor temp,Rand(127)+128,Rand(127)+128,Rand(127)+128
	ScaleEntity temp,2,2,2
	EntityFX temp,1
Next
blur#=0.1
While Not KeyHit(1)
	If kbdelay<1
		kbdelay=10
		If KeyDown(44) blur=blur-0.01: If blur<0 blur=0
		If KeyDown(45) blur=blur+0.01 If blur>1 blur=1
		EntityAlpha sprite,blur#
	Else 
		kbdelay=kbdelay-1
	EndIf
	TurnEntity pivot,.1,.1,-.2
	RenderWorld
	Text 0,0,"Use Z and X to change blur. Current Blur:"+blur#
	Flip
Wend
End


And THATS how it's done! :)


Shambler(Posted 2003) [#4]
Near enough , but using an inverted sphere with alpha =)


Vertex(Posted 2003) [#5]
A better variant is, You use any Sprites, Copy an
rendering on there textures, and fade old renderings
over the complete screensize. This You can use at
any szenes:
[CODE]
Graphics3D 640,480,32,2
SetBuffer BackBuffer()

Cube = CreateCube()

Camera = CreateCamera()
PositionEntity Camera,0,5,-10

Light = CreateLight(1,Camera)

Dim Sprite(10) : Dim Texture(10)
For I = 10 To 0 Step -1
Sprite(I) = CreateSprite(Camera)
ScaleSprite Sprite(I),640,480
PositionEntity Sprite(I),0,0,640
EntityAlpha Sprite(I),0.8 - I / 2.0
EntityOrder Sprite(I),1

Texture(I) = CreateTexture(256,256,256)
EntityTexture Sprite(I),Texture(I)
Next

While Not KeyDown(1)
Frame = Frame + 1

TurnEntity Cube,2,4,1
Y = Y + 1 : PositionEntity Cube,0,Abs(Cos(Y) * 10),0
MoveEntity Cube,0,1,4

UpdateWorld
If Frame > 2 Then
Frame = 0
For I = 10 To 1 Step - 1
Texture(I) = Texture(I - 1)
Next
CameraViewport Camera,0,0,256,256
RenderWorld : CopyRect 0,0,256,256,0,0,BackBuffer(),TextureBuffer(Texture(0))
CameraViewport Camera,0,0,640,480
EndIf
RenderWorld : Flip
Wend
[/CODE]
cu olli