- Home /
How to make mesh-render mode particles fade out?
I have a particle system that is emitting chunks of rock. These are of course are meshes, using the mesh rendering mode under particle settings, and use a mobile diffuse for performance.
These rocks land on the ground- but then dissappear instantly when they hit the end of their lifetime. I would prefer for them to fade out instead.
The alpha option in color over lifetime doesn't work, because they are being shaded by a mobile shader and not just the color over lifetime thing in the particle window. Does anyone know of a method to make them fade out?
Hi, using the alpha of a texture or color would mean the material is "transparent" and this mean sorting + rendering with blending after opaque geometry. This could impact performances, you can try transparent+diffuse shader and modify the alpha over time to see how it impacts performances.
Another option would be to have a alpha-cut shader that is cheaper that real transparent shader. $$anonymous$$aybe animating the alpha or the alpha-cut parameter is possible but I've never tried it. With the right alpha in the texture, you could have a kind of "dissolve" effect with texels disapearing as the alpha-cut value is modified. Some shaders also have this dissolve effect pixel by pixel in screen space using a noise/random texture, it should be nicer than texel-based but I don't know the cost on mobile.
Another option would be to use scaling to make the particles disappear.
Answer by FortisVenaliter · Aug 21, 2015 at 04:01 PM
You need to use a shader that supports Vertex Coloring. Then the shuriken colors will apply to the particle meshes. I think there's a vertex-colored diffuse shader, but not sure if there's one for mobile. You might need to look at both and combine the code to make one that works well for mobile.
The game isn't actually for mobile; I was just using the mobile shaders for these chunks of rock for efficiency. There can be about 200 of them in frame, you see. I will see if the vertex colour option works.
Answer by JesseSmith · Apr 08, 2016 at 10:27 PM
So there is a difference between the alpha value defined by "Color over Time" and the alpha a shader is defining. "Color over time" in Unity's particle system sets the values for a vertex. What you want is to take that vertex alpha and apply it in the shader (as the shader ultimately defines the color/alpha). Here is some example code describing what to do and not do:
struct Input {
float4 vertexColor : COLOR; //vertex color set by Color over Lifetime
};
void surf (Input IN, inout SurfaceOutput o) {
//o.Alpha = _Color.a; // This will not make the particle's alpha appear to change when rendered
o.Alpha = IN.vertexColor.a; // This will
}
There is other shader code missing here but the point is you have to get the alpha from the vertex being updated by the particle system and apply it in the shader.
I'm about a week into trying out Unity and I could use a little help with some context for this code. Where does it go into the shader code and what's a good shader to edit? To give you an idea of the final effect I'm going for I need emission (with outer glow), cutout, and particle driven alpha fading.
Your answer
Follow this Question
Related Questions
Particle rendered behind meshes/billboards? 0 Answers
Problems with rendering Particles 0 Answers
Best Method For Best Particles? 1 Answer
how to make an horizontal mesh? c# 0 Answers
Weapon system 0 Answers