Water effect

Member
Posts: 117
Joined: 2010.09
Post: #1
Hi all,

My game is a top-down affair and I need a water effect.
Not interested in realisim as wish to keep to 60fps.
Essentially imagine a room filled with water (floor etc. showing through) and the room can be drained so the water level visually sinks.
My first thought was a non textured alpha quad that simply shrinks from the centre and reduce the alpha to fade it out.
Not sure if the alpha alone will kill draw fps; as must function on opengl 1.1 at 60fps :-)
Or perhaps grab the screen as a texture (how do I do that?) draw an alpha quad over the texture and then draw the new texture back to the screen.
Any other methods???; as an aside it would be nice (if possible at 6ofps) to make the 'water' wave i.e. create a slow rippling effect.
Potentially any alpha effect could cover maybe 70% of the screen!!

Any suggestions welcome.

Cheers
Quote this message in a reply
Apprentice
Posts: 7
Joined: 2010.12
Post: #2
I recommend choosing the simplest solution and then testing performance.

"Top down" could mean a lot, but I imagine you'd have some kind of false perspective?

But I imagine you would just draw the water with alpha inverse to depth of water. I.e. deeper water, more opaque water. Although dark blue/green fog would be better, since then things near the surface would be easy to see and things deeper would be harder to see. In fact, a combination -- the texture for a watery appearance, the fog for water depth.

Hardware-accelerated fog should be plenty fast enough. Just read up on glFog*() (man glFog in terminal on Mac OS X).
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
Since he's on the iPhone board, he means ES 1.1. That does include fog, though. Not quite sure why anyone's writing 1.1 code any more though Rasp
Quote this message in a reply
Moderator
Posts: 442
Joined: 2003.08
Post: #4
Why not ES 2.0? He could be targeting 3Gs devices and later?
Alex
Quote this message in a reply
Member
Posts: 117
Joined: 2010.09
Post: #5
Hey all,

I wish my app to run on iphone 3g at 60fps hence the opengl 1.1.

Cheers
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
I'm sure both remaining 3G users will appreciate the effort Wink
Quote this message in a reply
Member
Posts: 117
Joined: 2010.09
Post: #7
Lol!
Come on; how many iphone 3g (not 's') exist still in the entire world?
Must be millions (I have 1, so there's one :-) ).
If it runs at 60fps on the basic hardware then it will be obviously fine on any hardware! (can always add visual 'treats' for 3gs etc.).
Just trying to appeal to the widest audience and deliver a console feel at 60fps.

cheers
Quote this message in a reply
Moderator
Posts: 442
Joined: 2003.08
Post: #8
Well, iPhone 3g devices don't support anything past 4.2.1 and have half the ram of the 3gs which has half the ram of the iPhone 4. It's technically discontinued and the 3Gs are so cheap many people may have upgraded. Also, 2 years after they came out (the length of at typical cellphone plan term), the iPhone 4 came out which most people could get subsidized. I can't specifically find the usage numbers by device however, so these are just my thoughts. And as you have an iPhone 3G yourself, doesn't look like there's much of a choice Rasp. Sorry for derailing the thread a bit, good luck with the water!
Alex
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #9
How is the room itself being drawn? Is it a 3D model with perspective for depth or is it 2D map/sprite based? In terms of its style, is it 'real' perspective or 'dungeometric' (where you draw the floor flat but objects are draw as if they're viewed at an angle from the side with no scaling for depth. The specific method and style of the room drawing pretty much dictates what you can do with your water.

If it's actual 3D with perspective or dungeometric (if you're drawing it orthographic and being sneaky) you can get away with a flat quad (or animating texture on a quad) for the water as its depth will be visible on the walls. For a true flat overhead room style, you're limited to showing the water depth by its transparency and objects in the room appearing as the water goes below their height. That or make it so that all rooms are essentially sloped towards their centre and the water simply shrinks in towards the centre as it lowers (bit of a cheat that one, and somewhat limiting).
Quote this message in a reply
Member
Posts: 117
Joined: 2010.09
Post: #10
Thanks all.
As mentioned I myself have an iphone 3g; so am kind of stuck with that spec; but also I decided if it runs at 60fps on that when ported to Android (with even more variations of spec) then hopefully should be 60fps on that also!! (i.e. min android spec).
The room's are true 2D i.e. tiles; no perspective via opengl.
I guess I am looking at the non-textured alpha quad; but I am certain just the alpha fill-rate will be an issue.

Cheers
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Wave tips 2d water chrisevans1001 1 2,696 Dec 9, 2011 04:12 PM
Last Post: OneSadCookie
  Creating a water effect iamflimflam1 0 2,449 Aug 4, 2009 06:46 AM
Last Post: iamflimflam1
  Odd effect on loading a .png with alpha channel. Madrayken 4 2,982 Jul 14, 2009 03:45 PM
Last Post: Madrayken
  How do the hell do the water effect in koi pond? Najdorf 14 7,884 Mar 23, 2009 04:21 PM
Last Post: aBabyRabbit
  Texture2d rainbow effect on flip THRESHE 15 6,548 Mar 19, 2009 08:33 AM
Last Post: AnotherJake