Water trails

As some of you maybe know I have a crash on ships. Also we have the awesome water-filter from nehon.

So what would be really cool are water trails (like in this image:



I thought of something like this:

The code could look like this:


waterFilter.addTrailsCastingSpatial(Spatial object)

waterFilter.setTrailLiveTime(float seconds) //after this time, the spawned trail effect disappears. With this you can control the length of the trail

waterFilter.setTrailSpawnInterval(float seconds) //needed so that new trail-effects are spawned in a defined interval

waterFilter.setMaxTrailSize(float size)

waterFilter.setTrailFoamTexture(Texture2D foam)


These are just first thoughts. So if anybody wants to join the brainstorming: you’re welcome.

mhh…i would more favor a particle emitter approach…

It’s gonna be kinda difficult to do this in the water filter.

We can be aware of objects hitting the surface with the depth buffer, but being able to determine the direction and the velocity of an object would require some trickery like done for motion blur…

and this would considerably slow down the filter…

I don’t think particles are a solution, it would have to be in the water shader to avoid clipping and z-fighting issues I guess? Question is if the actual computation of the water trail image has to happen inside the shader, that could be external.

I was thinking about this the other day after I played your demo… a quick work around solution would be to make a trail like you suggest in your diagram … out of invisible geometry that is sitting just under the surface of the water, it could be disks that are ‘dropped’ by the boat every nth of a second, and they grow in size over time and also move down the y axis (further away from the surface of the water)… the water shader will draw foam / shoreline waves over the disks if they are close enough to the surface, and as they move down, the effect will fade away … I think this makes sense …

Here is OLI RUSH project, as a reference:


some videos are there.

Also halflife2 has good references.

@nehon: yeah, you’re right. It would be awesome if the trail has a velocity but I guess that would be to much effort for just a nifty effect, expecially when there are 20 or 30 objects on the water. I thought of a trail that consists of circles which are drawn fast one after another. And while they are fading out they are going to be bigger, which, maybe, would look like a trail.

@thetoucher: hm, interesting. I think a particle emitter could do the same. Instead of going down the y-axis it could fade out.

I think I’ll give the particle way a try even if there’s the clipping-problems.

If we wanna go really nuts we could try simulate the water effect from anno 1404 or Silent Hunter. Instead of simulating trails with textures they’re creating real ones on the water.^^

I think they also use a real mesh for the water don’t they? Then its kinda easy, you just need to run a simplieifed fluid simulation. (Even half life 1 water was capable of this) However the current shader would be probably incompatible with this in almost every way possible. The simple one ight work tho.

the particule approach won’t give any z fighting or clipping issues if the particles stays above water, particles don’t write depth. Also, you’ll have to place them in the translucent bucket and have a translucentBucketFilter, but i guess you’re familiar with that.

the dynamic ripple approach is doable, we would just need a generated height map, and use it in addition to the actual height map to generate ripples. The hard par would be to place it at the correct position.

@thetoucher approach is interesting, even only one object (a sort of flat triangle just below the water surface) for the trail could give good results I think. set it to only render depth, and scale it according to the boat velocity…or even cull it when the boat doesn’t move…nice idea.

@ceiphren i see you got it to work in last version of pirate hell.

It looks really nice!

So you went the particle emitter way?

@nehon: yeah, I’m not really happy with that but today is my last day where I have time to develop stuff for the contest. So particles were the fastest solution.

When pirateHell evolves I’ll look for an advanced method to create the trails. thetouchers idea sounds promissing but the one from EmpirePhoenix would allow more fancy stuff. We’ll see if the jme is able to handle that amount of calculations.