Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

bmxouch

Blurring the Screen

This topic is 5282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am creating a game that interfaces with a device called an EEG Biofeedback device. The device reads brainwave data from a user and returns it to the computer. My game reads that information, and tries to give feedback to the user. What I am trying to do is create a blurring effect based on the brainwave data. I need it to be able to blur more or less. So, how do I blur the screen. Is there anyway to make it less blurry or more blurry? Thanks, any help is greatly appriciated.

Share this post


Link to post
Share on other sites
Advertisement
you could render the screen to a texture that increases/or decreases in size. =)
* Correction:
first: set a new viewport that is smaller than the one you got for the moment.

draw everything.

render to texture. (remember that you need power-of-two textures!)

switch back to the old viewport (i.e the original)

draw a quad that is the same size as the current viewport with the texture created in "render to texture"
- since the texture was created in a smaller viewport it will become stretched (thus blurred).

this is the common way of doing camerafocus in games etc.
Look up "Render to texture" or "Radial Blur" in the RedBook or on NeHe´s site!

Cheers mate!


[edited by - Rasmadrak on June 3, 2004 1:52:24 PM]

Share this post


Link to post
Share on other sites
This will seem unrelated at first, but let me get to my point.

Not sure how much this might help, but back when I was in high school our computer class was introduced to Second Reality - a demo by a bunch of guys called Future Crew. One of the elements of the demo was a smoke/plasma field that looked like billowing flowing plasma.

I managed to replicate the effect by generating random intense points throughout a field of black (at some set frequency, I forget what), and also the bottom of the display buffer (an undrawn line) was a long line of color-values constantly being set high in intensity, varying from max to nearly zero.

This buffer was an array, we''ll say PlasmaBuffer[m][n]. What I did was run thru the array, either one at a time or every other space - depending on how intense/faded I wanted the plasma to appear, and I *averaged* the values of whatever one I was checking with the pixel immediately next to it (up, down, left, or right of it...it depended on the direction I wanted the plasma to "flow").

I lost this code in a pretty nasty harddrive crash years back, and recently I''ve been considering trying to reconstruct it for an effect in some of my little 2d games. The reason I mention it now is that it occured to me that using a similiar method - averaging neighboring pixel-color values - *might* add a blur effect. I don''t know, but that''s basicaly what it did with the plasma, so to a degree that might help you. If you''re doing it in 3d, I guess you''d have to do it to the 2d image you render to just before you flash it to the screen...unless there''s some fancy way to do it with that alpha-blending stuff. I really don''t know.

Good luck.

Share this post


Link to post
Share on other sites
The most widly used blurring function is, for numerous mathematical considerations ,the gaussian function.
http://mathworld.wolfram.com/GaussianFunction.html

The sigma factor control the level of blurring.

So all you have to do is create a filter representating a 2d gaussian. The size of the filter should be rougly equal to 2.2 * sigma, if you want to keep your colors right.

Then you convolve your filter with each band of the image.

http://mathworld.wolfram.com/Convolution.html

A simpler mean of blurring the image is the mean function. That is, you set every pixel of the image as the mean of the 4 or 8 pixels around. You can control the level of blur by:

-Adding a factor, like new color = 50% color of the pixel + 50 % color of its neigbor

-If you want to blur more than 100% color of its neigbors, you can run the algorithm several time, or use the mean of the 20 closest pixels, 48 closest pixels, etc.

Have fun!

Share this post


Link to post
Share on other sites
if you are using DirectX, there is a sample in the docs called, Depth of Field that covers blurring pretty well.

Dredd
________________________________________

"To die with your sword still in its sheath is most regrettable" -- Miyomoto Musashi


Share this post


Link to post
Share on other sites
Awesome, are you trying to create a mind-reading game? How does this device work?

Red Sodium
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life. - Terry Pratchett

[edited by - red_sodium on June 4, 2004 11:55:36 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!