English
Source / code snippets

OpenGL Motion Blur (Accumulation Buffer)

 

Sven
Bader
with the Accumulation Buffer can integrally nice things release, How to that example a Bewegungsunschärfe.

The idea is, that one several Frames in a zusammenfasst. gives it no movement, so observes one none Difference otherwise sees one, as moved Objects Schlieren wander.

In my example increased the Number of abstracted Images with the speed and it'll additional another small deviation installed, around the effect To join.

without Accum Buffer (or stood still)



with Accum Buffer



with Accum Buffer + Schütteleffekt (dx!, dy!, dz!)


 $H windows.ph
declare xrot!, yrot!, zrot!
declare xpos!, xspeed!, ypos!, yspeed!, zpos!, zspeed!

proc DrawGLScene

    parameters dx!, dy!, dz!
    declare id&
    ogl("glClear",~GL_DEPTH_BUFFER_BIT | ~GL_COLOR_BUFFER_BIT)'ogl("clear") cleared To plenty!
    oGL("Color", 0.7,0.7,0.7,1)
    oGL("Origin", xpos!+dx!*0.1, ypos!+dy!*0.1, zpos!+dz!*0.1)
    oGL("Rotate", xrot!, yrot!, zrot!)
    oGL("Move", 0, -1, 0)
    oGL("Texture", tex&, 1)
    oGL("Cylinder", 1, 1, 2, 24)
    oGL("Texture",tex2&, 8)
    oGL("Origin", 0, -10, -24)
    oGL("Quad", 29, 20)
    xrot! = xrot! + xspeed!
    yrot! = yrot! + yspeed!
    zrot! = zrot! + zspeed!

endproc

proc Redraw

    declare  i%, max!, dx!, dy!, dz!
    dx! =  1.0
    dy! =  1.0
    dz! = -1.0
    ogl("Clear")
    ogl("Push")
    max!  = if(abs(yspeed!) > abs(xspeed!), if(abs(yspeed!) > abs(zspeed!), abs(yspeed!), abs(zspeed!)), abs(xspeed!)) * 0.75
    max!  = round(max!, 0)
    case max! <= 1 : max! = 1
    case max! > 10 : max! = 10
    ogl("glClear",~GL_ACCUM_BUFFER_BIT)

    whileloop 0,  max!-1

        DrawGLScene(dx! * &loop, dy! * &loop, dz! * &loop)
        ogl("glAccum",~GL_ACCUM, 1.0 / max!)

    endwhile

    ogl("glAccum",~GL_RETURN, 1.0)
    ogl("Pop")
    ~SwapBuffers(%hDC)'supplant show!!

endproc

' Hauptprogramm
' -------------
declare hWnd&, end%, hpic&,tex&,tex2&
CLS 0
oGL("Init", %hWnd, 1, 1, 1, 0)
'Texture from Icons
Mcls 32,32
startpaint -1
DrawIcon "A", 0,0
endpaint
hPic&=create("HPIC",0,"&MEMBMP")
tex&=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
'Texture from Icons
startpaint -1
DrawIcon "KNOPF1", 0,0
endpaint
hPic&=create("HPIC",0,"&MEMBMP")
tex2&=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
xpos! = 0
ypos! = 0
zpos! = -5
xrot! = 35
yrot! = 55
zrot! = 0
xspeed! = 0
yspeed! = 0
zspeed! = 0
Ende% = 0
setTimer 10' max. 50 Frames /sek.

WhileNot end%

    WaitInput

    If IsKey(27)

        end% = 1

    ElseIf Iskey(39)

        yspeed! = yspeed! + .02

    ElseIf Iskey(37)

        yspeed! = yspeed! - .02

    ElseIf Iskey(40)

        xspeed! = xspeed! + .02

    ElseIf Iskey(38)

        xspeed! = xspeed! - .02

    ElseIf Iskey(33)

        zpos! = zpos! - .1

    ElseIf Iskey(65)

        xpos! = xpos! - .1

    ElseIf Iskey(68)

        xpos! = xpos! + .1

    elseIf Iskey(83)

        ypos! = ypos! - .1

    ElseIf Iskey(87)

        ypos! = ypos! + .1

    ElseIf Iskey(34)

        zpos! = zpos! + .1

    EndIf

    redraw()

EndWhile

killTimer
end

1.png  
41 kB
Hochgeladen:10/14/21
Downloadcounter71
Download
2.png  
67 kB
Hochgeladen:10/14/21
Downloadcounter58
Download
3.png  
55 kB
Hochgeladen:10/14/21
Downloadcounter67
Download
 
10/14/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.607 Views

Untitledvor 0 min.
Sven Bader03/01/23
Ernst05/29/22
ByteAttack05/20/22
Michael W.03/30/22
More...

Themeninformationen

this Topic has 1 subscriber:

Sven Bader (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie