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

Question Scriptable renderer feature drawing on top of unaffected objects

Discussion in 'Shaders' started by ChichoRD, Sep 14, 2021.

  1. ChichoRD

    ChichoRD

    Joined:
    Jul 31, 2020
    Posts:
    19
    Hi,
    I'm developing a 3d game and decided to give it a low poly look. For that, I searched on the internet for what it's called a screen space curvature render feature and found the one I'm trying to fix (I attached the files, they were developed and distributted by @MalyaWka in this thread Voxel Edge Smooth Effect - Unity Forum).



    (Desired look)

    The pass is quite customizable, however one feature does not work as I pretended, the layerMask: In the DepthNormalsPass.cs file you can see it being used in the constructor of the FilteringSettings (line 97) used in the DrawRenderers method after it. So that pass gets the normals that are gonna be used then to draw the effect I'm looking for.
    However when you exclude a layer from the pass, instead of not drawing the effect in areas covered by objects in other layers, it just draws the cavities and the valleys over them:

    upload_2021-9-14_15-1-24.png

    (Red box (the player that is in a non included layer because I don't wanna give him the effect) has the effects of the geometry behing rendered over it (Not the whole mesh, just the valleys and cavities, the player is not transparent))

    Any idea of how to fix that?

    I tried to implement a texture subtraction, with the intention of passing the whole screen render texture to the shaders that work behind (not included shaders in the message because they are fine), then passing the render texture of only the excluded layers (but did not figure out how to mask the screen render texture based on layermasks) and then subtracting them in oreder to only draw the effects over objects witthin the layers

    The only thing that "works" is setting the player material render queue to over LastGeometry (> 2500), so it renders in an order as it were a transparent (it is not).

    Should you have any solution or idea, please tell me, and really thank you for reading my message
     

    Attached Files: