GLBasic forum

Main forum => GLBasic - en => Topic started by: djtoon on 2012-Feb-14

Title: water simulation
Post by: djtoon on 2012-Feb-14
i want to create this effect:
http://www.box2d.org/forum/viewtopic.php?f=8&t=7574

thay baiscly
blur the image and then add a color threshlod
any way to do that in glbasic?
10x
Title: Re: water simulation
Post by: erico on 2012-Feb-14
Long time ago , there was a thread that discussed some types of fast blur
I recall someone talked about the following technic:

Make a very low resolution copy of your screen, maybe 2 or 3 different smaller resolutions.
Apply, full screen scalled, them over the original with some set of transparencies and as for the color, you can psycho alpha blend something. :S

hope it helps, but I´m sure the subjects has been around a while. :good:

edit: oh, kitty got a proper reply to it on the other "full screen blur" post...and I think I posted on the wrong thread...damn it

Title: Re: water simulation
Post by: Kitty Hello on 2012-Feb-14
what they do is a set of balls that react like water. I think they implemented some type of auto-attact (joint) and cut-off.

The drawings in the latest post (bottom of that page) look like they have only drawn circles around each "water" point, and used a much wider radius than the real physics partice uses, so they overlap and it "looks" like water.

You might want to ersearch on fluid dynamics:
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=73110&lngWId=1

Some guy on RR did that once.
I "think" it was him:
http://www.projectorgames.net/
(Anyone remember that snow - app that run on a huge projector with 4000x3000 pixels resolution?)
Title: Re: water simulation
Post by: djtoon on 2012-Feb-15
the physics is box2d that i got
then you do agussian blur on the screen
and do a color threshold and walla water :)

the blur+color threshhold that we dont have in glbasic :(
Title: Re: water simulation
Post by: Kitty Hello on 2012-Feb-15
I have no idea how to program gaussian bluring.
If you want my bur code to have colour teinting, you can use POLYVECTOR instead of the ZOOMSPRITE. There's code on the forums already.
Title: Re: water simulation
Post by: Slydog on 2012-Feb-15
If anybody's interested, here's a great (detailed but complicated!) article on Gamasutra:
(There's a sample code link (titled 'Listing 2') near the bottom of the first page.)
Four Tricks for Fast Blurring in Software and Hardware (http://www.gamasutra.com/view/feature/3102/four_tricks_for_fast_blurring_in_.php)

Or, to achieve a simple blur effect, couldn't you just shrink a sprite using STRETCHSPRITE to a much smaller size, then restretch the small image back to the original size?  This should loose a lot of detail, but not sure how good the blurred re-enlarged sprite will look!