WaveWorks Infinite Ocean Planes

I figured I would post this here as well. I have implemented the integration that allows for using the WaveWorks Quadtree generator to create infinite oceans. This is still very much a Work in Progress, it can still be a little crash happy when trying to set it up, but after that it runs quite fine. Could still be optimized some more. There are a few caveats to using it:

  • Does not work with Static Lighting, causes discoloration and other artifacts, so make sure to turn off precomputed lighting in the World Settings, and run a Light Build at least once.

  • Shadows casted onto the water surface look very abnormal in the editor, but appear fine in game.

  • Only works with opaque materials at the moment, dont even know what will happen with a translucent material.

  • Only flat tessellation, trying to use PN Triangles will result in incorrect behavior

  • Only supported on SM5 at the moment.

Take a look at the sample project provided on how to set it up, but basically you:

  1. Create a new WaveWorks asset and configure

  2. Create a new material, use the WaveWorks node to set the Normals and Displacement (Only Flat Tessellation is supported - But it does not really use flat tessellation either, it has its own tessellation and crack fixing code). Dont feed anything in Tessellation Multiplier, it has its own calculation for that.

  3. Create a new Blueprint Actor and add a WaveWorksComponent, then assign the material from above, this should then create the quad tree. ← This is where it can crash. If it does, just restart and try again.

  4. Drop the actor into the scene, doesn’t matter where, it is infinite in all directions, to adjust the height, adjust the Sea Level variable in the WaveWorksComponent.

Next on the plans are:

  • Implement Alloc/Free patch for controlling which patches are visible, good for hiding water that is permanently covered by terrain.
  • Implement a single patch feature so you can have small areas of water, would be just a configurable plane.
  • Bouyancy and displacement readback
  • OGL and DX10 support (Using geo-morphing instead of tessellation for DX10)

If anyone has any features they would like to see, let me know.

I would like to give a big thanks and a shout out here aswell to Temaran for his work on the RenderDoc plugin for UE4, this saved me some hassles on figuring out some unknown variables needed for the integration. If your doing shader development of any kind, you should go grab it here:

Gorgeous! Awesome work GalaxyMan!

Thanks! How do you create the wavework component? I don’t have it in the BP editor.

I have been trying to read the displacement for ages, I will definitely be keeping an eye out for that!
Then I could adapt the community ocean project’s shader to work with WaveWorks, should be interesting :stuck_out_tongue:

That’s awesome!! :smiley:

I think he uses the gameworks plugin from nvidia

There’s a GameWork plugin now? I used 4.9 engine modified to include nvidia gamework stuff (waveworks+flex+hbao++vxgi)/

No, there is no plugin (as far as I know), I meant the modified engine :smiley:

You need my latest changes, i only committed the code last night, once u have that, u should see a Wave Works component in the list of Components in a Blueprint Actor

SM4 support for WaveWorks has been committed, also fixed a bug with Turbulence that allows for SM4 packaging. This does not mean all the GameWorks techs work in SM4, only WaveWorks does, but you can package the entire project for SM4 just make sure to disable the other techs ingame somehow.

It will use geomorphing instead of tessellation, so you need to update your material and have it pass the WaveWorks Displacement pin to the World Position Offset output instead of displacement. Refer to the sample project, where I use a FeatureLevelSwitch to swap which output is used based on feature level.

OGL support is going to be a long while away, a bunch of other shaders for the other GameWorks techs need to be modified to at least be compilable in GLSL

Thanks! I’ll try to see if your changes can be merged in our modified engine!

Is it possible to make wind blows to a point rather than a direction (so if you’re making an island for example)?

Not that I am aware of, WaveWorks only takes a direction.

A pity. And what about collison with landscape?

WaveWorks purely is a visual thing, it provides no collision data. Even for buoyancy, all I get is the current displacement values so I can implement some kind of buoyancy myself. So you’ll have to handle any kind of interaction with the environment.

Well I got displacement readback going, and implemented a quick and dirty buoyancy test, turns out, haven’t got a clue on how to setup actual buoyancy, so will leave that for others to implement if they feel like it.

To read back samples, there is a new function on the WaveWorks Component - SampleDisplacements. Feed it in a list of sample points in World Position as a Vector2D, and it will return a Vector4 containing the displacement for that point.

Code will be committed shortly.

Awesome work dude!

Hey, I just merged your latest stuff, with the WaveWork component. The infinite ocean is realy great, however it is tiling too much.

Also, regular plane won’t work

Any idea why? Thanks in advance :slight_smile:

In The WaveWorks asset, play with the FFT size, larger numbers should result in less visible tiling. And regular planes won’t work as the new implementation of WaveWorks has a very specific shader implementation, I will be implementing a plane version soon. Fixing translucency rendering for WaveWorks first.

Where is the FFT size? Can’t find it.

I only added it recently. You’ll have to grab the latest code. The WaveWorks asset is now split into Simulation and Parameters. Allows you to set some more parameters. Such as displacement readback, FFT size, Aniso Amount, etc.

Thanks dude! Just rebuilt everything! Just why does it needs to recompile every shader every time I’m rebuilding it? I have say like 16,496 shaders unit to compile when loading the editor, and that doesn’t even include 4,512 in the terrain.