wraitii Posted July 10, 2012 Report Share Posted July 10, 2012 (edited) 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: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 July 10, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
FeXoR Posted July 10, 2012 Report Share Posted July 10, 2012 Looks very nice to me! Quote Link to comment Share on other sites More sharing options...
zoot Posted July 10, 2012 Report Share Posted July 10, 2012 (edited) 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 July 10, 2012 by zoot Quote Link to comment Share on other sites More sharing options...
FeXoR Posted July 10, 2012 Report Share Posted July 10, 2012 (edited) 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 July 10, 2012 by FeXoR Quote Link to comment Share on other sites More sharing options...
majapahit Posted July 10, 2012 Report Share Posted July 10, 2012 Excellent wavy appearance.Btw is it possible to empty/flood a river or create drylands on the sea to increase gameplay experience? Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 10, 2012 Author Report Share Posted July 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
Pureon Posted July 10, 2012 Report Share Posted July 10, 2012 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? Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 10, 2012 Author Report Share Posted July 10, 2012 (edited) 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 July 10, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
Pureon Posted July 10, 2012 Report Share Posted July 10, 2012 Ah, well thanks for taking a look Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 10, 2012 Author Report Share Posted July 10, 2012 It looks like a precision issue in the dot product... I'm not completely sold on how it can be averted. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted July 10, 2012 Report Share Posted July 10, 2012 Hard to tell with just static screenshots. I mean, I can see the difference in smoothness, but I'd need to see it in action. Quote Link to comment Share on other sites More sharing options...
k776 Posted July 10, 2012 Report Share Posted July 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 10, 2012 Author Report Share Posted July 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
Gen.Kenobi Posted July 10, 2012 Report Share Posted July 10, 2012 Will be there a way to control the Ocean animation? Waves and stuff?Blender has a pretty cool simulator... Maybe it can be used, somehow? If it could be procedurally generated, without the need of tile textures it could look better and more realistic...http://savetheoceansim.com/blog/ Just trowing in 2 cents Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 10, 2012 Author Report Share Posted July 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
WhiteTreePaladin Posted July 10, 2012 Report Share Posted July 10, 2012 Rolling seas would be awesome though. Anything comparable to BFME2 would be great. Quote Link to comment Share on other sites More sharing options...
zoot Posted July 11, 2012 Report Share Posted July 11, 2012 The problem with that system is that it requires the water plane to have more vertices Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 11, 2012 Author Report Share Posted July 11, 2012 WIP foam: Quote Link to comment Share on other sites More sharing options...
zoot Posted July 11, 2012 Report Share Posted July 11, 2012 WIP foam: Quote Link to comment Share on other sites More sharing options...
myconid Posted July 11, 2012 Report Share Posted July 11, 2012 WIP foam: Looks promising! Are you adding foam to low-depth areas, basically? Is it a new texture or are you calculating it in the shader?Btw, I had an idea:https://github.com/myconid/0ad/tree/watertest(needs recompile) Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted July 11, 2012 Report Share Posted July 11, 2012 Is it possible to improve the water texture? Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 11, 2012 Author Report Share Posted July 11, 2012 (edited) 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 July 11, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
Shield Bearer Posted July 11, 2012 Report Share Posted July 11, 2012 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? Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 11, 2012 Author Report Share Posted July 11, 2012 (edited) 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 July 11, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
myconid Posted July 11, 2012 Report Share Posted July 11, 2012 (edited) 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 July 11, 2012 by myconid Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.