Search Unity

Question Shader drawing over rendertexture

Discussion in 'Shaders' started by Deleted User, May 20, 2023.

  1. Deleted User

    Deleted User

    Guest

    Hello forum,

    I've attached two gifs of what I want the shader to achieve. Basically, the shader is just black voronoi blobs going around on a white background. This is the one I'm currently using: https://www.shadertoy.com/view/fs2XRW
    What I want to do is have the substracted result of that so it draws the black blobs and smears them over the rendertexture like in the 2nd gif.

    What I'm currently doing is:
    Have an orthographic camera with a 'don't clear' flag look at a quad with the shader applied. And underneath that quad, have a transparent quad that makes sure it gets somewhat cleared over time.

    And for some reason it never works as the 2nd gif. Anyone know how to achieve this effect?
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    You'd need the blob shader to be transparent too. If it's not transparent and has a white background it'll be overwriting the previous data with white.
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    I've been thinking about this 'depth clear' technique I'm trying without avail.
    But I think this is not what I need. Well, sort of.

    I think I need this fade to happen earlier. Within the shader itself.
    https://www.shadertoy.com/view/fl3fzr
    Sort of like how the lines in this one. I'm wondering, is it possible in Unity to do this 'delayed clear' within the shader instead? I'd really love to port the colored lines one now to learn how these types of effects
    Buffer.jpg
    are ported over. Always wondered about it and never managed to figure it out.
     
    Last edited by a moderator: May 26, 2023
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,443
    Deleted User likes this.
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    That particular shadertoy is doing something a bit more complicated than you're attempting to do. But the short version is Buffer tabs render to a render texture (iChannel#), the Image tab renders to the screen. Common just has code snippets you can call from any other tab.

    For what you're doing, all you really need to do is have your blob texture render using an alpha blend where the white areas are mostly transparent. That's it.
     
    Deleted User likes this.