I am currently creating a dissolve shader. The idea is that I have a object which has a StandardMaterial3D applied and I want to add my dissolve shader material on top (next pass or overlay) so that I can read the screen texture of the standard material but apply the extra dissolving effect.
The dissolve shader alone works as wanted so it discards pixels that are above a certain world coordinate threshold. However when using this material as an next pass on the standard material I don’t know how to override the alpha values of the corresponding pixels in the previous pass. Is this even possible? Or do you know a different approach to achieve the result I want? (I don’t want to use the dissolve shader as base for all my assets)
I don’t think this is possible, you are writing the color of the first pass to the screen texture and reading the screen texture in the second pass?
I don’t know what your dissolve material does, but a solution would be to combine the two into a single shader, that way you can discard and it will remove parts of the surface.
if this is for a dynamic system, you could create two materials, one solid and one with the dissolve effect.
if there are too many materials, maybe this could be automated by creating a new material by code?
you are writing the color of the first pass to the screen texture and reading the screen texture in the second pass?
Exactly, so that I can keep the original look of the object for the part that is not dissolved yet.
This is how the dissolve shader alone looks right now (on the blender monkey). I want to replace the red color with the material beneath.
I have already thought about your suggestion but then I would basically have to remake the whole StandardMaterial-Shader for the combined shader in order to be able to use all its features.
Oh wow, I didn’t know that. I guess that will at least work as a interim solution. Thanks!
Still I have some hope left that there is an option I am missing to work with overlaying materials I won’t mark it as solved yet in case someone else has another idea