Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

One transparent object inside another sorting problem.

Discussion in 'General Graphics' started by battou, Mar 10, 2015.

  1. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    222
    I have two semitransparent objects: skysphere and water sphere. I cant make them to render properly. Its ither sky always renders above water, even when camera is under sky and above water, or water always above sky, even when camera is above sky. Any way to sort them properly? I tried to make water opaque, but then ZWrite Off dont working, and I need depth texture that excludes water.
     
  2. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    What I usually do when I need transparent objects to render in a specific order, is make a shader for each of them, and specify their render queue offsets to force them to be drawn in the order I need.
     
    theANMATOR2b likes this.
  3. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    222
    I also use this practice, but in this case they must be rendered in different order depending on camera position. Whel, one of three pases of one shader. Looks like best way is to make separate shader with it's own queue order for that pass.