realtime blir like effect ?

BlitzMax Forums/BlitzMax Beginners Area/realtime blir like effect ?

djdee(Posted 2007) [#1]
Hey! (sorry about the topic title, its supposed to be blur)
Im having a question. Im currently in the planning/tech-testing of dev for a small indie game. Im thinking about including some underwater blurring effects if its possible. Either in the form of a particle effect where you have like small bubbles that disrupts the view behind them sligthly. And/or big effects that moves wavelike over the whole screen, or between different layers in the graphics draw-order. So, my question is related to the actual altering of pixels to acheive this effect. Im guessing its gonna involve the pixmap. How would this be done generally in blitzmax ? Anyone have any examples or example codes available ??


SpaceAce(Posted 2007) [#2]
Off the top of my head, wouldn't it be pretty easy to just have a bubble graphic with varying levels of transparency then just ALPHABLEND draw it on top of the scene for the bubbles-obscuring effect?

SpaceAce


Perturbatio(Posted 2007) [#3]
From the code archives: Pixmap Blur


Perturbatio(Posted 2007) [#4]
Also here


ImaginaryHuman(Posted 2007) [#5]
I am guessing that for realtime blur a pixmap which has to be transferred over the graphics bus every frame is not going to be very quick. Also to blur what is underneath that graphic you either need a copy of the backbuffer drawn in main memory or downloaded, over the graphics bus, to combine it with your blur pixmap. Plus you have to calculate the blurring on a per-pixel basis with the cpu instead of the gpu. We're not exactly talking realtime speed here.

What you could do is have an RGBA texture, read the backbuffer into it with something like glCopyTexSubImage2D(), then draw a `mesh` grid of quads that are textured using the grabbed screen, the vertices of which you can animate to make the whole screen content morph/wobble/stretch to create a liquidy effect. It should be fast enough for realtime full-screen. It wouldn't do any blurring, though. To blur you could take that texture and draw it small, then grab it back and draw it fullsize, so that you use the filtering/smoothing to create a blur effect.


djdee(Posted 2007) [#6]
Thank you all for the input and valuable advices. That RGBA texture with a grid sound interesting. I have thought of something similar as well, since i saw that gridwars game. I wouldnt know how to get started with that though. i will research into it and see if its doable. The nice thing is that it can be interactive with the game elements. Any pointers to where to look for it. More ideas are welcome.

Another question. When they do this in for example the visualisation in winamp, is it done on the gpu/gfxcard ?


ImaginaryHuman(Posted 2007) [#7]
I don't know how you'd do it under directX, but under OpenGL you'd create an empty texture and then use glCopyTexSubImage2d() to copy the backbuffer into the texture. You might then have to manage the uploading and handling of your own textures rather than using Images, although Blitz has some helper functions. I suggest googling the opengl red book and blue book.

As to winamp, no idea, never seen it. I know the iTunes visualizer can be either OpenGL or not, but it's not very amazing.