Search Unity

Resolved _CameraOpaqueTexture for transparent sprites?

Discussion in 'Shader Graph' started by dr4, Sep 14, 2019.

  1. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    108
    Hi, I created a "behind glass" effect using _CameraOpaqueTexture, now I'm trying to adapt it to my 2D game, the problem is that everything in my game is using the new "Sprite Lit Master" Node, by default this seem to be "Transparent" and there is no option to change it like in the PBR Master node (where you can select Opaque)

    upload_2019-9-14_14-55-21.png

    because of that I cannot adapt the effect to my game and really need to find a workaround, is there any known solution? something like _CameraTransparentTexture that does the same with materials set to transparent
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    If you change the material’s queue to <2500 they’ll show up in the opaque texture. However they may sort incorrectly.
     
    morepixels and dr4 like this.
  3. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    108
    I could marry you right now, that did work! just one problem, in game everything looks perfect now, but the sprite with < 2500 disappears in the scene, couldn't figure out how to bring it back
     
  4. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    108
    solved, I had an "skybox" option selected on the scene, no clue what it does but after unselect it everything looks fine, thank you again!
     
  5. LandHT

    LandHT

    Joined:
    Feb 3, 2017
    Posts:
    84
    I think i'm in that worse case scenario.

    I'm using _CameraOpaqueTexture for water refraction.

    So i have 3D water, waves, refraction... and 2D ships.

    Placing the ship on the surface makes the part of the sprite that is occluded by the waves or submerged not visible.

    Using <2500 makes it look completely submerged & refracted, i can see it being a solution for submerged sprites but is not enough for those half submerged half above surface cases.

    Any ideas?