Hey there,
Got a question that could’ve been in shaders, but i’m not totally sure what the best solution here would be.
I have a levels i create in a custom editor, in a sort of fixed perspective, and i need to hide dissolve/slightly hide, maybe just make temporarily transparent, depending on if my asset is hidden.
I was considering making a Shader that dissolves the world geometry based on some specific distance the entity is from the camera, but, the issue i keep coming to here is that, i want this to be a shader that can “clip” the information, or alter the pixels, of a material that shades before this does.
The idea was to make a material that renders after the main material, and then it handles this…
I haven’t made a global shader like this, ever, so i wonder, what would be the best approach here? Would making a screen shader make more sense? If it would, how would i specifically target the entities i’m talking about with this particular shader? What are the methods in achieving this sort of effect, is there something easier i can do with some new Unity feature i’m not aware of?
I heard of replacement shaders, but to my knowledge, it seems to have to replace the shader of all of my assets that are being rendered, which doesn’t make sense, cause all my assets have custom materials that do their own things.
I feel at a lost, i’ve been googling for weeks now and i can’t find a solution to this that feels elegant.
My ideal situation is to be able to just have a replacement shader i can put on the camera, that targets specific assets, without me having to change the materials of the objects i’m talking about, and works over-top the materials they have.
That or if i can define a “global” shader that gets applied to everything after they’ve already rendered, that let’s me edit the resulting information of their frag / vert shaders.
Any ideas?
- PROGRESS *
I’m currently looking through this tutorial:
https://connect.unity.com/p/articles-dissolving-the-world-part-2
I’ve implemented a shader noise library, and currently am trying to do that solution where
I have 2 cameras, one renders my objects, and based on the depth of these, it clips the object using the perlin noise variables.
However, when i call “Clip” in an image effect shader, it becomes black… I don’t understand, it is set to depth only, and it should be rendering after the first, i actually confirmed that’s exactly what happens, but when my 2nd camera renders out no pixels , it blocks the previous camera.
What am i doing wrong? Why doesn’t the CLIP function work properly and just not render pixels, therefore, not blocking the image underneath?