Mesh "stuttering" on water plane when main character camera moves

So, my game object (the white cube in the vid) keeps “stuttering” when I move (see video attached), I do not know what it is, but I do know that it only happens when I move.

So, I found that reducing the size of the water geometry did it. I’m worried about what other players might see.

Also, the stuttering is still visible, just less now.

Im assuming water is just a simple plane with a normal map applied onto it?

The stuttering is called z-fighting, and it’s caused by the triangles fighting over whichever should be rendered first. To fix it you’d need to increase the vertex count in the water plane (or indeed reduce its size, it’s kinda equivalent.) You can’t have just a single plane representing the entire ocean, it’s best you split it into waaaay smaller tiles.

2 Likes

I was literally thinking about splitting it up into tiles. I don’t even know if it will tile properly to be honest with you. I’m using waterjs (not water2), would setting the same time offset make them tile properly? Or maybe giving them all the same water material?

1 Like

Sometimes just increasing the subdivisions on the plane you’re putting the water on will fix it.
so if you’re create a new PlaneGeometry(100,100,… pass a higher value in the width/heightSegments parameter)
https://threejs.org/docs/#api/en/geometries/PlaneGeometry

Another thing to try/check is making sure your camera.near and camera.far are closely matched to what is in your scene.

like… if your world extends 200 units in a direction, set your camera.far to like 250 or so, and set the camera.near to the largest number you can but still not clip the near plane into your scene, like .5 or so…

This concentrates the resolution of the depth buffer in a smaller area and gets you more accurate depth buffering.

1 Like

Try set to water mesh.renderOrder=-1; or mesh.renderOrder=1; without plane splitting to tiles.
material.depthTest=false;

1 Like

So as @manthrax has also mentioned, just increasing the subdivisions did it. Sorry for the delay. I’ve been adding audio and a bunch of stuff to the game, haven’t had time to come here.

Tiling was a lot easier than expected, but dropped my performance significantly, by almost 50%. My FPS went from 144 to ~70-100. Which honestly was very strange to me. I split my scene into a grid, then only showed the current bucket the player was in and the ones surrounding it (neighbourhood). Still the same FPS drop. So I just gave up and stuck to a large mesh with larger segment values.

But something strange happened when I tiled the water geo