[Solved] Help with trail color gradients in Unity

Hello! :smiley:

I’m new to VFX, and I was trying to make a trail for a projectile in Unity using its built-in trail renderer, when I ran into an issue while making a color gradient for it.

My problem is that when I play the projectile animation with the gradient applied to the trail, the middle part of it appears transparent, like if the trail was “chopped” or “cut”, just like in this picture

I find it very weird, because when the animation is played with the color of the trail fully set to white, the trail is continuous, just how I want it to be.

Another strange thing is that when i set the trail color to fully red or fully pink, it plays continuously just like the white trail in the last image, but if I set its color to something like green or blue, it becomes transparent, just like the section of the gradient in the first image.

I really have no idea of what is causing this problem :sweat_smile: I know I didn’t offer much information to it, but it would be great if you could reply with whatever you think may help solving this. Thanks!

instead of white try pure blue — is it invisible that way?

1 Like

Yes, I tried that! It is invisible that way too :confused:

you will have to show us the shader, my guess is the texture output is only using red, but not sure

This is the shader i’m using for the material with the trail texture, I don’t know if there’s something wrong with it but it’s just an additive shader I used to make particles in another project that worked just fine

reproduced

isolate alpha with a split node to make sure it is being fed the correct channel,(the issue is it is using the Red to do alpha so you get nothing there)
image

2 Likes

Isolating alpha with the split node like you did solved the problem of it being transparent, but now my texture has a black background :confused:

To be honest, I don’t know if this issue has to do with the shader or with my texture itself (which is a .TGA file with a black background), because when I test this shader with Unity’s default particle texture (that also has a black background, even though I don’t know what file type it is) it works just fine
image

On the other hand, when I test Unity’s legacy “additive” and “additive (soft)” particle shaders, my texture works fine

Also, when I plug the blue output of the split into the alpha input on the shader editor while using my texture, I get the result I wanted, but now with the color red being invisible

Please forgive me if I’m doing the wrong comparisons with Unity’s default shaders and textures, as I don’t fully understand how things work yet. Also, do you have any idea of why my shader was using the red to do alpha? I found it really weird :laughing:

Thanks again for helping me!

Isolating alpha with the split node like you did solved the problem of it being transparent, but now my texture has a black background :confused:

i don’t know how additive blending can possibly do this

does the TGA file has an alpha channel? – the only thing that let’s me copy your results is Alpha blending and removing my Alpha channel
trail_bug_01

once I put it back on I can at least get the shape
once it is additive black removes entirely even without an alpha
image

1 Like

That’s it! The blending was actually on alpha and the texture didn’t have an alpha channel

Once I set the blending to additive without an alpha channel in the texture, these were my results

(You can still see the transparent outlines for the trail)
I had to add an alpha to the texture to remove the outlines. Is there a way to remove them without adding an alpha channel?

Anyway, adding it and changing the blending to additive on the shader solved my problem! Thank you very much :star_struck: