Water Material With Smaller Size Water Mesh

Hey Guys… I got a question do handle using a water material with a smaller ground mesh…

I am trying to put water in a little square pong that is about 5 x 10 units/meters…

All the example of using the water material are using a ground mesh with 512 width and height and the the water material render target size is also 512… Now the water looks great but the waterMesh is WAY TO BIG… If i use a smaller width and height for the water mesh… anything below 256 and you start get BLOCKY water…

How do use water material on a small piece of ground mesh that fits in a small 5 x 10 pond like area ???

Are you sure that by tweaking the parameters of the water shader you can’t get the result you want?

Maybe a repro PG would help here.

I am play around with some more… What are the parameters for controlling the actual size… what the difference of renderTargetSize ?

I think the parameters are listed on this page: Water - Babylon.js Documentation

1 Like

Yeah i checked there… There is a problem if you make a SMALL ground mesh… there ire big ridges in the mesh… I think i figured it out… You have to actually scale the Y of the ground mesh to make that alot smaller to get rid of the ridges it create when making a small water plane … like 12 x 12 for example… not 512 x 512

Adding as well @julien-moreau who might have an idea :slight_smile:

Hey @MackeyK24 :slight_smile:
Waves are based on the mesh’s geometry. If the mesh is too much lowpoly then you’ll see ugly waves etc. Anyway, for a lowpoly geometry, you use the property “.waveHeight” of the WaterMaterial instance and set to 0. This will look like a calm lake etc.

Does it what you are looking for?

1 Like

FYI… Its also the Ground Mesh (Plane) Y component that… if you scale down the width and height of the ground mesh to say like 12 x 12 … YOU MUST ALSO scale down the Y (height) of the ground mesh… Other wise there will be WAVY RIDGES in the ground mesh itself

That’s not the wanted behavior and I’m sorry for that!
To be sure I understand well the problem, can you reproduce that in one of the water playgrounds? I’ll fix that ASAP so you’ll not have to scale the mesh anymore

Here yo go: https://www.babylonjs-playground.com/#1SLLOJ#1174

Uncomment line 32 that applies scaling to the waterMesh.scaling.y to see work around… but would be better to support smaller water mesh dimensions :slight_smile:

1 Like

Yo @julien-moreau … Hows the progress with is going ???

Yo @MackeyK24 absolutely 0 progress on it, I was pretty unavailable these days but I’m back since today!! Sorry for being late I’m fixing it ASAP

@MackeyK24 I’m on it :slight_smile:

@MackeyK24, to reduce the ridges count, I just added a new property “waveCount” which can be used to control the number of waves applied on the ground. Is it looking good to you?

For example: water.material.waveCount = 2

Which gives (in your playground):

Of course, you can set the “waveHeight” property to adjust the height. Finally: