Weird behavior when using WaterMaterial

Hi everyone,

I’m working on a simple water effect on a plane. I’m using the built-in Water Material. Every examples are made using big ground objects. However, I’m working with a little plane object and modifiying waterMaterial.waveHeight does not produces the expected effect. Instead of adding waved to my plane, it becomes weirdly stretched, as shown in this example (playground). (see lines 43, 44, 45)

I don’t know if it’s a bug or if I’m using the water material wrong. Any help would be much appreciated !

Regards

Hi,
You had some inappropriate values in there.
A zero bump height means you got no waves anymore.
The value for wave height should be set between 0.001 and 0.5 approx.
Generally for a calm lake a value around 0.1 is fine.
So, something like this, may be?:

1 Like

Hi, thank you for your help and for your example.

How to get actual waves here ? It looks really flat and I’d like to actually see some waves, like in the demo example (at the mesh border you clearly see relief on water). I cannot achieve this effect in my example.

Hi,
Two things here:

  1. As for the watermaterial with its bump effect, wave lenght and height you can put higher values to get more waves (or higher and longer waves), as you can see here:
    https://playground.babylonjs.com/#EFZP88#2

  2. The demo example actually doesn’t use a plane but a mesh (or you could do a heightmap). Obviously the mesh is not flat and adds to the waves effect

2a) The undersea level ground is also a mesh or a heightmap, again this will change how your water looks.

Edit: Note that you were speaking about a small water surface. Generally a small water surface does not have that many high waves (a matter of physics, obviously :wink:

1 Like
  1. The demo example actually doesn’t use a plane but a mesh (or you could do a heightmap). Obviously the mesh is not flat and adds to the waves effect

The shader used to Water Material does not move any vertex ? If so, I have my answer.

Edit: Note that you were speaking about a small water surface. Generally a small water surface does not have that many high waves (a matter of physics, obviously

Yeah of course, but let’s say I’m in a particular case :slight_smile:

No, this is an old and quite simple material. It simply applies the bump from the material. It does not affect the mesh.

No, this is an old and quite simple material. It simply applies the bump from the material. It does not affect the mesh.

Okay, I understand now. Thanks a lot ! Is there any place I can found the shader code that runs behind though ?

Thank you again for your help.

Sure, it’s all there on GitHub but now that they moved everything, I’m not sure to be able to point you straight at it. Give a minute, I can try call in the people who did this material. They’ll sure know…cc @julien-moreau

1 Like

Just moving this to Questions since it’s more appropriate :smiley:

Hey there just checking in, was your question answered? @tanquetil

Hi,

Sorry for the late reply. Yes, this can be closed :slight_smile: