Hiello all. I’m struggling with Z-Fighting popping issues on my water shaders for my flying game. When I go to very high heights the ocean shader I have flutters badly along coastline edges, it happens on all water shaders I try.
To get round this I used a near & far multi cam rig to avoid z-fighting issues. The thing is my game is VR and well Oculus Rift is not happy with the 2 cams and plus it does cost CPU so 1 cam would be ideal.
Do you have any ideas on how to get around this nasty flutter effect at far distannces when meshes meet at very close positions.
It’s not really the shader, it can happen with any 2 meshes laying flat on top of each other. In this case it’s the terrain meeting the water at the shore line and the meshes fight each other to be at the front or the back. The real question is how do you solve it with one camera, maybe it’s impossible due to floating point restrictions.
I’ll try in the shader forum but let’s be honest those guys are like the Men in Black, they keep it all to themselves. I’ve not never got an answer there.
Huh, I’ve gotten a lot of good responses from the shader forums. There is also a graphics forum that may be appropriate. This one is about the overall design of a game – planning it, writing the storyline, the gameplay loop, and so on – not really about coding or addressing bugs.
It does sound like a z-buffer precision issue, and as I understand it the easy fix (which may or may not work depending on other factors) is to move the near clip plane further out to improve precision at longer distances.
Here’s a pretty neat explanation of how to calculate the error rate with different near/far clip settings relative to the bit depth of your z buffer: