Bug on water material: water not smooth

Hi!

I’m hoping this isn’t user error, but I think I found an issue with the water material.

When looking at the first link on the water material page in the docs on my end, the water is not smooth (Using BJS 5.21.0), however if I change the BJS version to 4.1.0, it’s smooth sailing (sorry about the pun).


In the example, the only thing I could see that was outdated was the use Mesh.CreateGround instead of MeshBuilder (I thought it might be a subdivision issue), but it didn’t do anything. I also couldn’t find any existing mention of this bug.

Thanks

Hi @Nexum , welcome to the Babylojs forum!

Thank you very much for reporting that! We will take a look at the water material to see what is going on.

@sebavan , have we made any significant changes to the water material between there releases?

Also, @Nexum , in your comments you mentioned that you were comparing BJS 5.21.0 to BJS 4.1.0, but in your images it says 4.2.1 and 4.1.0. Does that mean it is broken since 4.2.1?

1 Like

This is the related PR:

Fixed TriPlanarMaterial and WaterMaterial by julien-moreau · Pull Request #9055 · BabylonJS/Babylon.js (github.com)

@julien-moreau , maybe you can help here? Thanks! :slight_smile:

1 Like

Hi @srzerbetto, thank you for your reply! Sorry about that - while typing up my post I tested the versions between 4.1.0 - 5.21.0 (my current) and then found that it stopped working correctly in 4.2.1 already

According to the PR @RaananW linked above, you should get the same output than in 4.1 by setting waterMaterial.waveCount = 40.

4 Likes

Maybe we should change the default (20 right now)

2 Likes

Ah, waterMaterial.waveCount was what I was missing. Thank you so much!