Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Problem with 2 planes with ZWrite Off

Discussion in 'Shaders' started by MartijnHoekstra, Aug 11, 2014.

  1. MartijnHoekstra

    MartijnHoekstra

    Joined:
    Aug 6, 2014
    Posts:
    4
    Dear all,

    Currently I have this issue within a scene coming from an external source. I have no influence on the coordinates/positions of the layers.
    Within that scene there are several planes on top of each other. One part I have issue with is 2 overlapping planes:
    Plane 1 = Landscape (Texture - Alpha blended at the coast line )
    Plane 2 = Sea ( Diffuse Bumpmapped Texture )

    These are Z-fighting and a lot of flickering. ( in both #Scene and Game View)
    I tried: changing clipping planes (near > 1.0) without any luck.

    Therefore I created a new shader and put "ZWrite Off" in combination with Custom Render Queue.
    From the external scene data, I can derive a group. Which basically gives away the renering queue number. These go from 1 to 16 or higher.
    Landscape has Group 2 -> I gave this Custom render queue 200
    Sea has Group 1 -> And this one Custom render queue 100.

    This solved the issue partially: In the #Scene view this works perfeclty now.
    But in the Game view, neither plane gets shown. As if they cancel eachother out.
    See image below:

    I have recreated the issue in a new project, with just 2 planes and fooled around with the MOST easy shaders.
    Where I put ZWrite off, but I keep getting same result.

    Any of you have a good solution for this? (PS: I am running Unity 4.5.1f3)

    Problem_2Planes_with_ZWriteOff.JPG
     
  2. BrightBit

    BrightBit

    Joined:
    Jan 22, 2013
    Posts:
    264