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 How can I downsample my game's resolution BEFORE applying certain screen space shaders?

Discussion in 'Universal Render Pipeline' started by badfitz66, Dec 6, 2022.

  1. badfitz66

    badfitz66

    Joined:
    Nov 21, 2013
    Posts:
    6
    I'm trying to make a game with a 3D pixel art style similar to the works of t3ssel8r on youtube. Apart from brief explanation in the description of their videos, there isn't much information on how it works especially the edge highlighting other than it's obviously some sort of edge detection shader.

    However, I was able to find this three.js project which intended to replicate the effect and seems to do so pretty well



    And it was open source! Though, upon attempting to port it I kept getting unsightly artifacts and it just wasn't working in general, which led me to this screen space cavity/curvature shader which did exactly what I was looking for. Though, this showed a new issue with how I was doing things.

    Currently, the downsampling happens AFTER the screen space cavity/curvature shader is applied, which caused issues where the lines would disappear at certain camera angles due to the downsampling. The only way to fix this seems to be if I were to downsample before the screen space cavity/curvature shader is applied and then apply the shader after downsampling.

    However, I just don't know how to do this. The downsampling is handled by this render feature I found and it's RenderPassEvent can be changed but anything before After Rendering Opaques causes it to stop working (no downsampling happens). I tried messing around with the screen space cavity render feature to see if I could add a changable RenderPassEvent which I was able to do but it has the opposite issue of it can't use anything after Before Rendering Opaques.

    How can I make sure the downsampling only happens before the cavity/curvature shader is applied (or make the cavity/curvature shader get applied after downsampling has happened). I've tried looking around but I just don't really know where to start. Any information on doing this would be greatly appreciated!



    (also, yes I know about ProPixelizer but I don't really want to use a paid asset at the moment)