Mask Shader with Paricles

Hey,
I’m using a simple Shader to mask a texture. Works ok, but it also masks particles (fire, dust, fog…), the halo of a light or other textures. How can i tell it just to only mask the texture (blood texture in my case).

Here The shadercode and a screenshot:

Shader "Masked/Mask" {
	
    SubShader {
		
	Tags {"Queue" = "Geometry+10" }
        Lighting Off
        ZTest LEqual
        ZWrite On
        ColorMask A
        Pass {}
    }
}

Thanks in advance for any help

You can’t do that unless you use a camera specifically for the blood, but you can move it to a really late queue and the blood even later.

hey, thanks for you help. i guess the best possibilty would be to overlay the camera for the blood only on top of the other. is this possible in unity? I just found the depth-value, which doesnt quite do what i want :slight_smile:

It should do what you want if you don’t clear the color or depth buffers with it.

can you give a simple example, i’m pretty new to this and didn’t understand too much of what you said… :slight_smile:

All of Chapter 6 in the tutorial series in my signature deals with the depth buffer, if you want a lot of info about it. But the basic idea is, with a Unity Camera, you have two buffers that you can choose to clear, or not. If you use another camera with the Clear Flags set to Don’t Clear, and all other settings are the same, and the cameras’ transforms are synced, then it’s the same thing as having only one camera, only less efficient.

I don’t know what you do or do not understand about this stuff, yet. If you understand the shader above, then you’re in good shape. If you just got that from somewhere else, then making sure you understand it, in its entirely will allow you to progress with confidence. I think, if you can get yourself to that point, though, you’ll probably realize that the shader is a poor choice for your needs, and you’ll end up having to write something that makes more sense and is more efficient.