Jump to content
Sign in to follow this  
wraitii

Of water and waves

Recommended Posts

Let's use this new forum. Following my conversion of myconid's efforts to ARB, I have ported the water shader (and now, the water with shadows effect). In turn, I figured: why not give a shot at improving this? And hence I tried.

First, a link to this album, which shows (in the first version) the many differences between the old and the new shader. I think we'll all agree that the new shader allows the "waviness" factor to mean much more.

I've just added three pictures, and in particular, those two, which show the wave size scaling with waviness:

L8cNq.pngDJtyY.png

I'd like to know if the direction I'm taking is allright with the rest of the team/most people, and if anybody has idea for improvements.

Additionally, thanks to myconid's efforts, we have shadows on the water, and I have taken the liberty of having murkiness effect the transparency of shadows (I'm not sure how water works, but it made sense at the time).

Edited by wraitii

Share this post


Link to post
Share on other sites
Additionally, thanks to myconid's efforts, we have shadows on the water, and I have taken the liberty of having murkiness effect the transparency of shadows (I'm not sure how water works, but it made sense at the time).

I think that makes a lot of sense, given that "murkiness" in real life™ is due to particles in the water which would receive shadows if they were modelled individually.

Edited by zoot

Share this post


Link to post
Share on other sites

I think that makes a lot of sense, given that "murkiness" in real life™ is due to particles in the water which would receive shadows if they were modelled individually.

Yes, though perhaps there could be just 2 shadows (then without particles): One on the water surface and one on the ground below the water. The shadow on the water would be for refractivity differences of water/air and particles in the water/at the water's surface. The second would account for the light still shining through. The second (to be absolute realistic) might also need to consider the refractivity difference of air/water.

I have no idea about particles or GPU abilities in general, just a though.

Edited by FeXoR

Share this post


Link to post
Share on other sites

Yes, though perhaps there could be just 2 shadows (then without particles): One on the water surface and one on the ground below the water. The shadow on the water would be for refractivity differences of water/air and particles in the water/at the water's surface. The second would account for the light still shining through. The second (to be absolute realistic) might also need to consider the refractivity difference of air/water.

I have no idea about particles or GPU abilities in general, just a though.

To do that (and a few other things), we'd need to have some sort of basic raytracing. We have to know the distance between the light entering the water and hitting the ground. It can perhaps be approximated, but it's already much harder to compute.

Share this post


Link to post
Share on other sites

This looks very interesting, the water variety the new shader allows is clearly an improvement.

Has it helped decrease the obvious tiling the current water has at certain camera rotations?

Share this post


Link to post
Share on other sites

No, if anything, in the current state, it's probably more obvious.

I'll look into what causes this tiling anyway, because it should not happen.

Edited by wraitii

Share this post


Link to post
Share on other sites

Nice work. Keep it up.

Also, we want the ARB and GLSL implementations as close as possible. So any code that can be shared between the two renderers should be shared please.

Share this post


Link to post
Share on other sites

Well, right now, the ARB and GLSL shaders give the same results and take the same inputs.

When myconid implements his post-processing effect, I'll be able to improve the quality of the water with proper knowledge of depth, but in the meanwhile, this will do.

I'll try to implement a basic foam, it should not prove too hard. Proper wave breaching is out of the question in the current version of the shader.

Share this post


Link to post
Share on other sites

The problem with that system is that it requires the water plane to have more vertices than it currently has (I'd say at least 4 times more), and it would then require to calculate each frame the water physics. While it's certainly possible, it's way slower than what we have know if we want a proper result. It's far from impossible, but it would really only benefit for simulating stormy seas.

Share this post


Link to post
Share on other sites

The problem is that it is animated. If it is to be improved, we need 60 animated (seamlessy) frames. Current size is 128*128, using at least 256*256 would improve the quality.

@Myconid: yeah, that's the idea. I'll scale it with waviness, so that on shallow maps like Oasis, if waviness is low, the foam won't be seen all over the place.

Edited by wraitii

Share this post


Link to post
Share on other sites

The problem is that it is animated. If it is to be improved, we need 60 animated (seamlessy) frames. Current size is 128*128, using at least 256*256 would improve the quality.

@Myconid: yeah, that's the idea. I'll scale it with waviness, so that on shallow maps like Oasis, if waviness is low, the foam won't be seen all over the place.

@Gen_kenobi: Do you think you could make a nice looking water texture with 60 frames? ;)

Share this post


Link to post
Share on other sites

FYI, in the current form of the shader, it should try to simulate a wavy ocean, but not one where waves are 3 meters tall. Something like this. It's practical because if can be scaled down fairly nicely.

For really stormy seas, the current system is simply not working.

BTW myconid, I'm still unsatisfied by the way the game currently gives you water depth and so on, so I think I'll try to do something with the heightmap anyway, in order to have an idea of the direction of the coast (could be used to properly simulate shore waves).

I've merged with your waterTest branch, currently recompiling.

And yes, new texture. Basically took some stuff on google, and modified it in photoshop. I'm using two textures, one rotated and moving differently, multiplying the result to give randomness, but it's not perfect.

Edited by wraitii

Share this post


Link to post
Share on other sites
For really stormy seas, the current system is simply not working.

Agreed. I think the massive water plane we have at the moment is too inflexible (pun intended) and you can't really do much with it. Maybe eventually we can replace that with multiple small water planes that each has its own elevation, materials, etc and can be placed in Atlas as objects.

BTW myconid, I'm still unsatisfied by the way the game currently gives you water depth and so on, so I think I'll try to do something with the heightmap anyway, in order to have an idea of the direction of the coast (could be used to properly simulate shore waves).

I've merged with your waterTest branch, currently recompiling.

I hear you. Updated my biwater branch with some hacky and inefficient code to give you access to the depth buffer so you can experiment in the shader. (not confident that it works, btw, haven't tested it)

And yes, new texture. Basically took some stuff on google, and modified it in photoshop. I'm using two textures, one rotated and moving differently, multiplying the result to give randomness, but it's not perfect.

Nice, looking forward to see what you do! :)

Edited by myconid

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...