Hello
I have my terrain water very close to each other so there is a z-fighting all the time on edges of the coast. How can I avoid it? For example to tll the terrain to be drawn always before water or sth like that?
reduce the view distance, ensure that far clip plane / near clip plane is never larger than 30000
Yes… I thought about that but where can I set that for built-in FPSwalker prefab?
The values Dreamora refers to are properties of the camera. So unless the FPSWalker prefab is or includes a camera, it won’t be there, it will be on the main camera in your scene.
Remember that the key to Z-fighting is the ratio between the near and far planes.
For example:
Near: 0.1, Far: 1000
Near: 0.5, Far: 1000
You’ve only offset your near plane by 0.4 world units. It’s not a huge distance. The ratio between your near and far planes just improved 5 fold, however.
So don’t just automatically crank down the far plane, as you can often get more mileage cranking up the near plane. Often without much/any noticeable difference too!
Also, you should remember that the z-buffer is not linear. So you inherently get greater precision closer to the camera than you do further away. This is logical and helpful, but it makes it even more important not to needlessly set your nearplane too low or you’re wasting a huge proportion of your z-precision on things you don’t need/won’t see.
Hope that helps.
Ok… so I’ve added a Camera component to the built-in FPS walker prefab and now I can’t move mouse vertical… Why that happened?
I didn’t suggest adding a camera component. Your camera should be a separate gameobject.
The FPS prefab contains a camera already (in the ‘head’ of the walker). Sorry, beyond that I don’t know how to access it.
Ok
thanks a lot everyone
I found fixed it.
thanks for the info @sybixus2.
I am tweaking my near/far clip planes and this is useful to know.
I’m trying to find the ideal setting that doesn’t allow the player to see through walls they are touching while also providing a clear non-Zfighting view into the distance.