Finally... Decent Water

Community Forums/Graphic Chat/Finally... Decent Water

Red Ocktober(Posted 2005) [#1]
strongly influenced on the code by rob cummings, and the cubemapping demo in the code archives, i finally got what looks like i'll be using it for the blitz version of the sub thingee...



still a lil too mirror like, but close to what i'm looking for...

yeah... i think i'm gonna go with this...

--Mike


DH(Posted 2005) [#2]
So what's the secret?


Vorderman(Posted 2005) [#3]
That looks really nice - can you make the water a little bit transparent so you can see the sub through it?


John Blackledge(Posted 2005) [#4]
Impressive! Go on, give us a clue.


Robert Cummings(Posted 2005) [#5]
NICE work red.


note:
You lot can download the cubed demo from www.redflame.net/files/cubed.zip

Probably guess who I am now hehe.


Red Ocktober(Posted 2005) [#6]
thanks guys... it took me long enough to get it working half right...

actually... there's no secret... the basis for the code is in the archives somewhere, and rob cummings (is that you oneeyed :) ) was generous enough to let us 'look at' his cube demo code a while back...

my stuff is a direct outgrowth of these code pieces... 6 sided cube mapping... what i did waste a lot of time with, was not setting the cubemapping camera range far enough to get my skybox reflecting... aside from that, it's nothing new or special...

i'm just riding on the shoulders of those who came before me... and i'm appreciative of their ingenuity, and their generosity...


Vorderman... yes, you are quite correct... i'm playing around with this, and a few other things, now, in order to make it a lil less mirror like... and a lil more ocean like...

remember a while back i put forth a sort of challenge to see who could come up with some water that looked like, or came as close to the water in this scene...



well... i'm still trying... but to be honest, i haven't got a clue on how to get the refracted stuff in there... and the whitecaps...

damn... i should've decided to make an underground fps instead of a game on the water...

any suggestions... please... :)


--Mike


Braincell(Posted 2005) [#7]
haven't got a clue on how to get the refracted stuff in there... and the whitecaps...


Doesnt look refracted to me, just like it is a reflection with a lot of noise. They may have code that makes the cube map textures noisy by scattering the pixels. Dont know how possible that is in blitz tho. You could also try to blur them but then the reflections on the waves in the distance wont look as detailed/sharp as on the screenshot. I really think you should try figuring out how to scatter pixels on a cubemap, but you should have a high res cubemap.

Someone correct me if im wrong with my idea here.

The white caps... i have an idea, why not make a vertical texture that is vertical to the water. I mean if you had a flat square going straight up, if you textured it the texture would be flat on it, with more blue below and whiter and whiter (with whitecaps texture) above. Then, if you have water whoose verts you can access individually, you can change their UV coordinates based on their Y (height above "flat" water), and then the higher it goes the higher the V moves. In effect, i think thats what Becky did in her sailing demo thing and i thought how it could be done. You could add more than one texture too and blend some, move them, etc.

Oh one more thing i noticed. I see why you might be saying refracting and not reflecting. Under certain higher angles there are no reflections. This i think is shader stuff.

Hope any of these ideas help at all?


Picklesworth(Posted 2005) [#8]
The Source engine renders the scene 3 times for its water.
Once for refraction and scattered bits of nothing, once for lighting, and then the final render.

That water in the last screenshot looks nice!


Paolo(Posted 2005) [#9]
I pretty much like the first pic Mike,
as you said it is a bit too mirror but with one more
"noisy" texture in the plane will look great !
Add that texture and post the same screenie again please :)


Red Ocktober(Posted 2005) [#10]
Lenn... i think you're right... it may be a shader working...

Mr. PW... that last shot is from a indie program called Virtual Sailor... yeah, the guy who made it sure does know water :)

--Mike


IPete2(Posted 2005) [#11]
Red,

Try "cleartexturefilters" to get that break up in the detailed textures.

IPete2.


Red Ocktober(Posted 2005) [#12]
will do... thx IPete...

hey there Paolo... long time no see... the plane pic was taken from Virtual Sailor... it's an example of the scene i was trying to recreate using Blitz3D...

--Mike


Paolo(Posted 2005) [#13]
oops ... I was talking about the >water plane< in the first pic (in your first post)
I mean, as you said it is too much "mirroring", having one
more texture above the plane will make it look better I think ...


Oddball(Posted 2005) [#14]
any suggestions... please... :)
To make the water seem less mirror like try darkening the water mesh so it blends with the cube map. I'd also give it a bit of a blue tinge, but experiment to see what works best. Maybe a better suggestion is to use a tiled texture under the cube map to darken the water. This could then be used to add a bit of noise to the water reflection too.
I'd use a variation on the particle system for the white caps as they only appear when a wave is reaching it's highest point and beyond a certain distance you can't see them anyway. So I'd stick a few of emitters in the scene to create the effect on near by waves as they reach their peak.
As for making the water transparent I wouldn't bother. I've seen very few oceans that are transparent enough to see below the surface more than a few feet away.

Hope some of these ideas are useful.


Oddball(Posted 2005) [#15]
I was bored so I had a go at cube mapped water. It's a colored mesh with a noise texture then the cube map on top.

Click to enlarge


Not bad for 30 minutes work. Now it just needs a few white crests on those wave peaks.


Braincell(Posted 2005) [#16]
Would be better if you put noise infront of the camera (ie transparent quad) while making the cube map. That would give it noise. But i talked about scattering, not noise :)


Red Ocktober(Posted 2005) [#17]
thanks for the suggstions guys... i'm trying a few things out...

my bad Paolo... i read it wrong...

my situation is slightly complicated by the fact that...

1- my skybox is huge... 800000
2- my water isn't a flat plane, it is undulating the vertices via a sin wave...
3- i use 9 of these water meshes and each moves in a treadmill fashion as the sub/ship moves in order to provide the illusion of a continuous ocean surface for the immediate view, no matter in what direction the sub/ship is moving...

Oddball... why did it take you so long :) the whitecaps and the refracted 'lighting', yeah... that's gonna be the fun part...

i think Becky had a lil of that in her boat race thingee...

Lenn... your idea sounds like it may have some promise...

thanks again guys for the ideas...

--Mike


Finjogi(Posted 2005) [#18]
Hmm. why 9 water meshes.. it would seem more economical to use just one and scroll it one polygon size assuming you use regular grid. Like almost all old scrolling games, scroll one tile size and then update grid offset. Just a thought :)


Red Ocktober(Posted 2005) [#19]
sure it would be more economical... but because you are on a ship in motion... and the water has to appear not to move every 5 seconds or so... economy must take a back seat to the game environment (one of the big differences between demos and actual games... it's easy to whip up a cubemapped demo, a lil more work to actually put it into a game)...

let me expound on this a lil :)

a single mesh would need to be moved continuously to keep up with a ship in motion... using 9 grids, the grid you are on never moves while you are on it, only the ones surrounding you... so you should have grid ready for you always when you arrive at your new position...

the illusion of a continuous, uninterupted ocean is maintained...

--Mike


Braincell(Posted 2005) [#20]
I think what he suggested was that you make one grid and move with with the ship but the movement ON the grid should appear stationary so if you can make the waves seem to "stay put" while the grid moves, would give you some economy. It would require additional maths (and a little brainwork) but it would be more economical. You just have to calculate how much the ship moves and change the phase of the waves by a certain amount (depending on their frequency vs distance).


jfk EO-11110(Posted 2005) [#21]
wasn't there a problem with the part that is underwater? wasn't it mirrored too? How did you solve that?


Red Ocktober(Posted 2005) [#22]
Lenn... ahhh, ok... i see now, sorry Finj, if that's what you were talking about... the thing i'd have trouble with is the part where...
It would require additional maths (and a little brainwork)
:)
the 9 grid treadmill is something i've used before and it seems to work so that's why i stuck with it... copyentity() seems pretty quick...
besides... to give the illusion, i'm gonna need either one big mesh, or 9 lil ones... so, with the additional math, i dunno how much economizing i'm gonna get outta it...
but i will give it a try though... never can tell... thx

jfk... this is not a mirror, i'm using a cubemapping process to derive the reflections...
the problem i was having was using the mirror function to get the reflections... it mirrored everything above and beneath the mirror plane...

--Mike


thanks again for the help


Ross C(Posted 2005) [#23]
Red, why don't you use a cubemap for the water? Create a cubemap with masked bottom and top texture, and 4 white sides, so, when the normals of the water reach a certain angle, the cubemap will show the white sides, on the peaks.


Red Ocktober(Posted 2005) [#24]
hhmmmmm.... hhhhhmmmmmmmmmmmmmmmmmmm....

lemme try dat!!!


seriously, thanks Ross... i'll give it a go...

i am using a cubemap now, but stumbling all over the place with small problems, mainly getting the reflections not to go all over the place when the viewpoint raises it altitude (y setting)... haven't really had a chance to attack the other stuff yet...

--Mike


Hotcakes(Posted 2005) [#25]
I quite like Black and White 2's water:

Nice wobbliness underneath the mountains, waviness everywhere, moon reflection in the water in the lower right hand corner, shore splash overlapping the beach (not much).

Of course it's almost all done with shaders, you can tell because the sea is just one huge flat plane. Looks really convincing in motion though...