Skip to content

How would you apply the behind factor property to the Outline in the Selection effect. #48

Answered by alelievr
PhillipGenant asked this question in Q&A
Discussion options

You must be logged in to vote

Indeed it's not enough to add that because the alpha factor is 0 when the pixel is not directly above the outlined objects, so to fix that you need to do the same as for the outline color: sample the depth buffer multiple times to find the max depth of the custom object and use that to check if the outline is behind something. I've modified the original selection fullscreen shader to achieve something similar:

    float4 FullScreenPass(Varyings varyings) : SV_Target
    {
        UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(varyings);

        float depth = LoadCameraDepth(varyings.positionCS.xy);
        PositionInputs posInput = GetPositionInput(varyings.positionCS.xy, _ScreenSize.zw, depth…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@NathanYYVGProductions
Comment options

@alelievr
Comment options

Answer selected by alelievr
@NathanYYVGProductions
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants