Español
Fuente/ Codesnippets

OpenGL Motion Blur (Accumulation Buffer)

 

Sven
Bader
Mit el Accumulation Buffer dejar se bastante nette Sachen realisieren, como para Ejemplo una Bewegungsunschärfe.

La idea es, dass uno mehrere Frames en un zusammenfasst. Gibt lo no Bewegung, así merkt uno no hay diferencia ansonsten sieht uno, como bewegten Objetos Schlieren ziehen.

In mi Ejemplo aumenta el Anzahl el zusammengefassten Bilder con el Geschwindigkeit y lo se zusätzlich ni kleine Abweichung instalado, en el Effekt a verstärken.

Ohne Accum Buffer (oder Stillstand)



Mit Accum Buffer



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


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

proc DrawGLScene

    parámetros dx!, dy!, dz!
    declarar id&
    ogl("glClear",~GL_DEPTH_BUFFER_BIT | ~GL_COLOR_BUFFER_BIT)'ogl("clear") cleared a viel!
    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

    declarar  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)
    caso max! <= 1 : max! = 1
    caso max! > 10 : max! = 10
    ogl("glClear",~GL_ACCUM_BUFFER_BIT)

    whileloop 0,  max!-1

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

    endwhile

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

ENDPROC

' Hauptprogramm
' -------------
declarar hWnd&, ende%, hpic&,tex&,tex2&
CLS 0
oGL("Init", %hWnd, 1, 1, 1, 0)
'Texture de Icons
Mcls 32,32
startpaint -1
DrawIcon "A", 0,0
endpaint
hPic&=create("HPIC",0,"& MEMBMP")
tex&=ogl("getTextureBmp",hPic&,1)
DeleteObject hPic&
'Texture de 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.

Sinestar encargado ende%

    WaitInput

    If IsKey(27)

        Ende% = 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:14.10.2021
Ladeanzahl71
Descargar
2.png  
67 kB
Hochgeladen:14.10.2021
Ladeanzahl58
Descargar
3.png  
55 kB
Hochgeladen:14.10.2021
Ladeanzahl67
Descargar
 
14.10.2021  
 



Zum Quelltext


Título del Tema, max. 100 Signo.
 

Systemprofile:

Kein Systemprofil creado. [anlegen]

XProfan:

 Contribución  Font  Smilies  ▼ 

Bitte registro en una Contribución a verfassen.
 

Tema opciones

1.601 Views

Untitledvor 0 min.
Sven Bader01.03.2023
Ernst29.05.2022
ByteAttack20.05.2022
Michael W.30.03.2022
Más...

Themeninformationen

Dieses Thema ha 1 subscriber:

Sven Bader (1x)


Admins  |  AGB  |  Applications  |  Autores  |  Chat  |  Política de Privacidad  |  Descargar  |  Entrance  |  Ayuda  |  Merchantportal  |  Pie de imprenta  |  Mart  |  Interfaces  |  SDK  |  Services  |  Juegos  |  Búsqueda  |  Support

Ein Projekt aller XProfan, el lo son!


Mi XProfan
Privado Noticias
Eigenes Ablageforum
Temas-Merkliste
Eigene Beiträge
Eigene Temas
Zwischenablage
Cancelar
 Deutsch English Français Español Italia
Traducciones

Política de Privacidad


Wir uso Cookies sólo como Session-Cookies wegen el technischen Notwendigkeit y en uns hay no Cookies de Drittanbietern.

Wenn du hier en unsere Webseite klickst oder navigierst, stimmst du unserer Erfassung de Informationen en unseren Cookies en XProfan.Net a.

Weitere Informationen a unseren Cookies y dazu, como du el Kontrolle darüber behältst, findest du en unserer nachfolgenden Datenschutzerklärung.


einverstandenDatenschutzerklärung
Yo möchte no Cookie