How to change UV on water?

i’m new on babylon.js and i want to change to knnow if is it possibe to change the scale pls …

1 Like

Welcome then :slight_smile:

If you were to manually code yourself the Water Material, you would indeed use some scale over UV. But here, since it’s already implemented, all you need is tweaking wavelength :slight_smile:

2 Likes

if you just wanna change the scale on the bump texture
you can do it by uScale of vScale properties on the texture : O

or as Trico said, changing the wavelength does the same thing

1 Like

And you can animate the UV offsets:

thanks all but i want to change the UV because otherwise, with the water texture, the meshes are not aligned properly

You can do it in realtime here:

And then set by code the values using these props:
image

Changing that can help me with the mesh who are not aligned properly ?

What does this exactly mean? Show us an example of your “not aligned mesh” so we can understand your problem.

1 Like

here is with the texture and without and when the texture is on the mesh are not aligned, sorry for my bad english


No worries.

I believe you mean this part gets unaligned. There is a gap.

As you can see the mesh is still in place (marked by the blue gizmo):

However when using the water material the vertex shader is manipulating/transforming the vertices of the mesh on the GPU so this is kind of expected. Since your ground has low tesselation it moves the whole mesh.

Your mesh:

When creating the ground you can specify the subdivisions parameter to achieve this water like surface:

Subdivided:

Regarding the disc you are out of luck because the geometry doesn’t allow to properly apply the water material because it needs a grid like vertex structure as you can see on the ground.

You can create a plane and use an opacity texture to mask out the unwanted areas of the plane to get the haf of the disc rendered. Or you can create a custom mesh with the vertices positioned in a grid. Or draw the disc in a 3D software…

You can also increase the number of vertices by calling:
planEauDemiDisque.increaseVertices(4) the result will be not satisfying. I believe you want to connect the two meshes to get one water surface.

I think, the best approach will be to draw one mesh for example in Blender and import it to the scene.

2 Likes

or you can set water.waveHeight = 0 if you don’t wanna displace

like so,

2 Likes

water.waveHeight = 0

In this case he doesn’t need the watermaterial at all :slight_smile:

1 Like

ye : )

2 Likes