Jump to content
 
tedw4rd

Unexpected Z-fighting on the Focus Plus

Recommended Posts

I'm working on a project using Unity 2018.3.10 and WaveSDK 3.1.6. There are several objects in my main scene that render perfectly fine when running off my desktop, but experience significant z-fighting when running on the Focus Plus. Some of the objects that are z-fighting are almost 1 cm apart. It makes the whole scene look terrible, especially because this also happens where any two meshes intersect. All of these objects are using the standard Unity shader. Is this a known issue? Is there anything I can do to reduce the z-fighting (aside from restructuring my scene)?

Share this post


Link to post
Share on other sites

@tedw4rd This may be a floating point precision error. How far away are the objects that are z-fighting? Can you share a sample scene to reproduce?

Share this post


Link to post
Share on other sites

@tedw4rd Also, here's some tips you can try:

 

https://www.unity3dtips.com/unity-z-fighting-solutions/

 

Z-fighting happens because two or more surfaces are at the place with almost the same depth (looking from the camera).

The renderer pipeline need to check which surface is near, and which surface is far, but it fails to correctly distinguish this information.

Intuitively, there are two easy ways to reduce the z-fighting issue.

 

  • Separate these surfaces apart.

In the demo you shows, the z-fighting issue happens on the text and the board.

It’s easy to fix by moving the text forward a little bit, rather than putting it exactly on the board surface.

 

  • Increase the precision of depth buffer.

Increase precision of depth buffer also helps the rendering pipeline to distinguish nearer and further surfaces.

https://docs.unity3d.com/ScriptReference/Camera.SetTargetBuffers.html

Share this post


Link to post
Share on other sites

Bundling up the relevant scene is going to be really difficult at the moment. However, I have two planes that are parallel and 0.02 units apart that are z-fighting right now. I also have some meshes that actually intersect that have z-fighting along the intersection.

image.png.70c1112450dd4dba95dc8e225c95e0b4.png

Even though the intersection is on the orange line, I'll still see z-fighting out to the purple line.

 

I guess it would make sense that this is a floating point precision issue. I'll give some of these tips a try.

Share this post


Link to post
Share on other sites

Update:

I've been messing around with this for a while now and I'm still having z-fighting troubles. Typically my view frustrum is only 500 units deep (0.1 to 500), but even when I reduce it to 10 units (0.1 to 10) I still see all sorts of flickering. According to a few tests I've done, the camera is rendering to a RenderTexture with a 24-bit depth buffer. I'm not sure how to increase the precision any more.

Share this post


Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...