First water iteration

ok, finally got going on the conversion of the water stuff to jme.

this very second i can't get my cvs to work so i have mailed the source to mojo, hopefully he can spread it to you or check it in(if it works on his comp :wink: )



lots of things have been completely reworked, since i figured some nice things out on how to separate the parts.



improvements and changes from the water i had before:


  • the water effect is a stand alone render pass, and has no hardcoded connection to what kind of mesh it uses for rendering
  • you register the mesh you want to use as water-surface to the water effect pass. so now you can use a quad or a grid or anything you like with simple changes
  • the projected grid is a stand alone trimesh extension, and can be used to whatever you wish, not just water rendering. could be moved to jme's shape package
  • the projected grid uses a height generator class to generate it's heights, so you can plugin whatever nice water movement algorithms you wish. i have made a sample generator for the tests.



    i have made three test programs to start off with. test for the projectedgrid water effect, for a simple water effect with a quad as mesh, and a test for the projected grid itself.



    lots of things still needs to be done, and i know exactly what to do, but have to go away for 3 days on a vacation trip.


  • make all the hundreds of settings easier to understand and change(a swing gui like renparticleeditor would be nice)
  • fix the last issues with the projected grid, that will make it use the grid alot better etc etc (i got the code for it, but don't have time to shape it up)
  • make alot more samples that show all the powers of the effects



    there are so many things that don't show itself in the tests. just by changing some settings and skybox etc you can get really cool effects…will get to that…



    would like you to try the stuff before i go out to the public with a report…



    laterz…

Can't wait to try it :slight_smile: Have fun on your vacation

Been playing with it a bit, and it's simply amazing. Really. Best water I've seen bar none. I'll get it out to everyone first thing tomorrow.

good to hear it works! :wink:



some notes i forgot that i will fix ASAP when i get back:

  • at present the water effect is only using the projected-grid shader. there is a simplewater-shader in the source too that should be used when the water is simpler and mostly flat. it's alot more optimized and robust on handling looking from under the water.
  • the code has zero documentation



    by the way, pressing 'f' on the projectedgrid and projectedwater tests will freeze the grid updating so that you can move around and see how the grid actually looks.



    gotta run…back in three days!



    ciao

…and the sample height generator is only simple perlin noiser + sine wave and could be improved alot…fast fourier transform is often preferred…perhaps could be a challenge? :wink: make the nicest moving water height generator…+ the nicest settings compared to speed

Awesome…have a good trip MrCoder. :slight_smile:



darkfrog

Tested it on Ati (X700, that’s a PS2.0 card). The tests run, and with decent enough FPS (though the wave generation is slower, but mrCoder mentioned that before)



I do get some gray areas at the edges of the screen though. I marked it with red (taken in TestQuadWater).







They move along with the “wave” effect.

yeah there are some artifacts when mixing non projected grid mesh with the projected grid shader…i'll try to find the best way to easily incorporate the simplewatershader for those cases…i'm afraid i didnt have the time to sort out all those issues when doing the conversion, so i'm thankful for getting those listed :wink:

To be clear, I get the same thing with TestProjectWater.

gotcha…it's on the issue list now!

I noticed that in TestProjectedWater the grid is updated twice per frame, because it's done both in the draw method of ProjectedGrid and in simpleUpdate. I removed the "projectedGrid.update();" in simpleUpdate and my FPS almost doubled.



Overall, I'm very impressed. The whole system is pretty adaptable and flexible, and it looks amazing. It was definatly worth the wait :stuck_out_tongue:

hah! thanks alot! i was coding away the need for the update method and must have forgot to remove the update call :slight_smile:

this is what makes it all worth converting stuff to jme and get it out, for all the input and bugfixes you get :wink:



actually it is mojo you need to thank, he's the one that "ruled by fear" and threatned to beat me up if i didnt get it out hehe. exactly the foot in the ass i needed

Wow, I'm impressed.  Hey mojo, see if you can get some other great stuff out of him now. :slight_smile:

Where do we get our hands on it to test?  I'd love to crank out an editor.

mojo has it…i'd looove to help out on that editor part :slight_smile:

Of course.  I can keep my hands off it too if you'd rather write it.

doesnt matter :slight_smile: the first one that get going on it mention it here…i can't start on anything until i get back home in three days

Josh and I were making extensive use of the water today and noticed a few things that need to be added to the issue list:


  1. There is some LWJGL calls in the water classes that should be abstracted away.
  2. If you translate the water grid/quad it breaks reflections.
  3. Reflections have a few artifacts, seeing sky through terrain in reflection, incorrect terrain reflection, etc
  4. Reflection of skybox requires a huge skybox and an equally large farplane to see that skybox. This creates difficulties for some other things we have in the scene.
  5. We could not get Bloom to work properly with it, but this may be unrelated.
  6. How can we control the water better?
  7. How come the water doesn’t bounce off cliff walls? :wink:



    Here is a pic of one of the reflection artifacts:



just an update on these issues, even though mojo and renanse are somewhat up to date through icq etc…


  1. can be abstracted away but would prefer to use pure java implementation of those methods instead(gluLookAt and glFrustum). honk the horn if you find them on the net
  2. the clipplanes used when rendering the reflection is based on the waterrenderpass waterheight, and pays no respect to the translation of the meshes set with the watereffect. dunno how nice it would be and if it would make any sense to store the meshes in the effect and use their translation values, doesnt feel like it.
  3. it's all due to the clipping + texture offset from the waves. i have used a magic number added to the waterheight so that clipping occurs somewhat under the water surface to get rid of seeing the skybox, but it's really a matter of trial and error from scene to scene…a solution to this would be to render everything again from the main camera view and extract the depthbuffer and make less offsets where water-depth is low(which is info you extract when adding refraction anyway). this would also allow for making foam close to land etc etc…this is a next step in making the water better looking, and alot slower…
  4. this one got fixed today
  5. lots of digging together with renanse, and he finally found some problems with renderstates bleeding over from render to texture operations. should be fixed now
  6. variables should be made clearer, more settings can be extracted from the shaders. and an editor gui would be great
  7. see point 3.

and, the llama edge issue was also due to lookups outside the texture from the wave offset. changing from clamp to eclamp took out that artifact…(clamping in the shader also possible)