It's in the last revision.
usage is simple, create a FilterPostPorcessor, add a WaterFilter and just get the cam under water.
In the video there is a WaterFilter, a LightScatteringFiltern, a BloomFilter,and a DepthOfFieldFilter.
You can see the code in TestPostWater.
I encourage you to test it, because it's a bit too dark in the video.
I made this on my Ati Card, so i'd like you fellow monkeys to test it on your hardware....especially mac users :D
SCHWERWIEGEND: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.renderer.RendererException: compile error in:ShaderSource[name=Common/MatDefs/Water/Water.frag, defines, type=Fragment] error:ERROR: 0:146: 'texture' : no matching overloaded function found
ERROR: 0:146: 'r' : field selection requires structure or vector on left hand side
ERROR: 0:153: 'textureOffset' : no matching overloaded function found
ERROR: 0:153: 'r' : field selection requires structure or vector on left hand side
ERROR: 0:154: 'textureOffset' : no matching overloaded function found
ERROR: 0:154: 'r' : field selection requires structure or vector on left hand side
ERROR: 0:155: 'textureOffset' : no matching overloaded function found
ERROR: 0:155: 'r' : field selection requires structure or vector on left hand side
ERROR: 0:156: 'textureOffset' : no matching overloaded function found
ERROR: 0:156: 'r' : field selection requires structure or vector on left hand side
And this for the PostWater test:
SCHWERWIEGEND: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.UnsatisfiedLinkError: org.lwjgl.openal.EFX10.nalGenFilters(ILjava/nio/IntBuffer;I)V
at org.lwjgl.openal.EFX10.nalGenFilters(Native Method)
Java Result: 143
SCHWERWIEGEND: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.renderer.RendererException: compile error in:ShaderSource[name=Common/MatDefs/Water/Water.frag, defines, type=Fragment] error:ERROR: 0:146: 'texture' : no matching overloaded function found
ERROR: 0:146: 'r' : field selection requires structure or vector on left hand side
Wow man, love the depth-depend blue color of the water. And the sound effect is good too … You like the god of the sea or some??? Definitely use this in my game !
I had to comment out the second DirectionalLight in TestPostWater.java (local variable ‘l’), or I get nothing but black screen.
In my own app, I had to remove a particle emitter and flickering point light (my prototype campfire) or I got similar problems (not totally black, but mostly black). The PointLight seemed to cause most of the problem, but I still got artifacts with the particle emitter in the scene.
I’m running an NVidia 8800GT, 275.33 (latest) drivers.
How hard would it be to make it so you could define multiple water volumes using this technology (imagine a mountain scene with several lakes at different altitudes)?
KuroSei said:
Looked nice from the video so I tried...
Well. It killed my Graphics Device totally. My IDE hung up so sadly i cant tell you the Exceptions if there were.
I updated my graphics drivers and tried again.
Same result... Are there special requirements for this shader?
Thats what i have... Its a laptop onboard graphics chip. ATI Radeon 3100
Yeah the test case is quite intensive, you can try to disable Bloom, LightScattering and DepthOfField, then you'll have only the water filter
@mattias
Yeah this is a known issue the filter does not work anymore with multiple light source, it should be fixed soon.
For the different altitudes lakes, it's kinda hard. One solution could be to have multiple areas defined by 8 points, or a center and a radius (woud be faster...but would be spherical). Since the shader sample the position of the pixel in world space, could be doable to render water only in those area.
The problem would be that the water would look the same in this different areas. you wouldn't be able to have the sea and a lake with muddy water in the same scene. All sea or all muddy.
That would be possible to pass all the parameter for each area, but there is already a lot of them for one area, that would require a lot of bandwidth to the GPU.
It's doable...but, it could bring a lot of hardwares to their knees I guess.