ProjectedGrid and legacy water effects from jME 2

Hello,



has anyone been working on porting the ProjectedGrid and the JME 2 water effects to JME 3?

Because I have started doing so, more or less as a personal exercise…



I think it’s time to share the information and show a screenshot that might look familiar :slight_smile:







It’s work in progress and there are some features still missing.

Anyway, feel free to check it out:



https://github.com/mschell/jme3test





Greetings,

Matthias

7 Likes

Hehe cool. Nobody was working on this as the water has pretty much been replaced with post process water really… The projected grid has been worked on in some way but the “real” solution will involve the lighting shader.

Sure, I thought so! I especially missed the jme 2 water effects, as they are more suitale for offshore scenes and have a simple interface to the wave height field.

But I will definitly check out how you can get similar results out of the awesome post process filter…

That will naturally be the next thing to go from here.




@normen said:
The projected grid has been worked on in some way but the "real" solution will involve the lighting shader.


Sorry, I didn't quite get what you mean. You can apply any material to the projected grid in the code here. What is not "real" then?

I mean the solution we will use for jME3.

Would it be possibly to get the grid information? I mean for buoyancy etc like sloshing objects.

Yes, the grid info is totally separated from the graphics via the HeightGenerateor interface.



[java]public interface HeightGenerator {

public float getHeight( float x, float z, float time );

}

[/java]

The code was a little bit messy but i got it to work. Looks nice so far. I will try to play later in the week with it.

Agreed, some parts really need a refactoring! I didn’t want to change too much before I got it to work. Thats the reason why…

So one week turned into four.

I made a little video and combined your waves with my buoyancy. Now the object reacts to the wave height. Please ignore the occasional flickering and the not so good reflections. Never found good params.



http://www.youtube.com/watch?v=JNHo0mEKGJs&list=UUIrZ6NCFuOgilI6_obEz1Fg&index=1&feature=plcp

5 Likes

Very cool :slight_smile:



Are you sharing the code or is it TOP SECRET-agent 007-level :slight_smile:

I missed this post very good work @Lockhead !

This is based on jme2 projected grid water?

So you ported it to jme3?

Very nice! :slight_smile:

What OpenGL extensions will this water require?

I can’t seem to use the other water effects with my Intel card (reporting as OpenGL 2.1 but probably missing some features), so I’d be very interested to know what this effect requires, as the water effects in jME2 worked well with it.

The credits for porting the water goes to matthias (see the first post). I only utilized his work in my project ;).

Also he made his work available for all. See the first post.

Cool to see your results, it looks nice :slight_smile:

For objects close to the water surface like your ROV, the reflection map shows some annoying artifacts. It used to be like that also in jme2…

No clue how to fix it without too much effort… When I find time to continue on that project again I will do some research here.

@matthias
@Lockhead

I am using the ProjectedGrid as well in my ship simulator and until now, without problems. However, since my simulator is getting some more features, I start to notice some issues:

I have created a ProjectedGrid with sizeX=100 units and sizeY=100 units (my ship is around 1 unit). As soon as I start to come closer to the edges, flickering occurs and the waves are getting ‘less detailed’. Also, white areas will occur in the waves (as if there is no water at all, but the ship keeps bouncing as it should on the waves, so the waves are still calculated, just not displayed properly).

Below you can see this in a video I made. I decreased the size of the grid to 20x20 units to speed up the process (it makes the waves ugly, but this is just for testing)and I have cut some parts out of the video. In the HUD you can see in red the travelled distance (in world units). In the last part, I disconnected the camera from the ship (it is connected with a CameraNode and switched back to the FlyCam: Same artefacts.

In the video:
00:00 - 00:20 --> Some flickering from the beginning. This has to do with the fact that I reduced the sice of the grid to only 20 units.
00:20 - 00:43 --> Little bit more flickering
00:43 - 01:17 --> Strange visual artefacts at guns (barrels showing through), some white areas alongside the edge of the screen (01:08 and further, travelled 400 units).
01:17 - 01:50–> Ship and guns are flickering as well. More white areas, also at bottom of screen.
01:50 - end --> Disconnected camera to show same results. Ship seems to rol normally on the waves, but all parts are flickering.

Strange thing is that also the parts of the ship (pay attention to the barrels of the guns) show weird behaviour, so not only the water. This makes me wonder if it has to do with the regular camera and not with the ProjectedGrid? I see the same issues when I set the wave height to 0 (I made several sea states (from no waves to a big storm).

Any idea what can cause these artefacts? I have tried to understand what exactly the code is doing, but the only thing I have managed so far is to get the ProjectedGrid working and to create different sea stated during runtime. Understanding the process of creating the actual waves and shaders is one bridge too far…

Video:
[video]http://www.youtube.com/watch?v=TYOAqB9a-0k&feature=youtu.be[/video]

@matthias
@Lockhead

Forget about above post: After removing the grid I still have this issue so I will have to look further. It does not seem to be related to the grid!

Hey. I am experiencing several issues with the code. I have posted an video of some of the issues. i would be so grateful if anyone could help. (Many Sleepless nights :frowning: )
Link: http://www.youtube.com/watch?v=QHbukUVZo_o&feature=youtu.be

Yes, I am experiencing those effects as well lately. I have been playing around with the grid for my simulator a long time already and I am SURE it did not show this behaviour in the past (say about one year ago).

I have not payed too much attention to it, but could it be possible it is due to some changes in the engine?

On June 2012 it was working okay, see my first buoyancy attempt:

First I thought it might have to do with my new graphics card GTX 580 but now you are experiencing similar issues, I start to doubt that. I will see if I still have that old code and if I find it I will run it again, see what it does.

[EDIT] –> GTX 580 off course…

1 Like

Yeah. Even the reflection is working fine. Could it be that we changed some parameters? I am working on implementing the gerstner wave method into JME so that will ultimately replace this water effect.