Is there a way to filter out a color to be transparent in shader graph?

I am new to shader graph and am following a tutorial to make a laser shot. The thing is there are some parts of the shader where it should be transparent but they are black. Is there a way to turn black color into trasparent in shader? The shader graph and the resulting effect can be seen below.

As you see theres some black in my effect, i want it to be transparent. Thank you!


Your screenshot is too small for me to read the details of your graph, but you set transparency by feeding data into the alpha channel of the Fragment. Right now, it looks like you are always using the default value of 1, which will make everything opaque.

If you want to filter out a specific color, you would check whether the final color your graph is producing is equal to the color you want to filter out. If it is, feed 0 into the alpha channel. Otherwise, feed 1 in. However, that will only work if the color exactly matches the color you specified.

I suspect you’re looking for something a little bit different. Without being able to see the details of what your graph is doing, it is hard for me to guess. But probably there is some part of your graph that has an alpha value of 0 that you think should be transparent, but it is being ignored because you’re not feeding that value into the fragment at the end. If you just take your final color produced and split it apart into its respective channels, then feed the alpha channel into alpha and the rgb channels into the main color, whatever alpha values you’re generating in the graph will show up correctly.