- Home /
Fade out material using alpha channel
I tried to fade out the muzzle flash of a gun by using the alpha channel of the material. It uses the Particle/Additive shader and the mesh has two materials. I tried the following code, but nothing happened
var Farbe1 = Color(255,255,255,0);
var Farbe2 = Color(255,255,255,255);
MuzzleFlash.material.color.Lerp(Farbe1,Farbe2,FireRate);
The MuzzleFlash variable is a Renderer. What could the reason for the problem be?
Normally, you don't need to fade out muzzle-flash. The time from when it flashes until it is completely faded is so short that it is nearly undetectable.
Yeah, but it looks like it's flickering because it appears and disapperas within 1 second :/ And in the transparent shaders, I haven't found an additive that make's the black parts from the texture invisible.
Small note - Lerp isn't an instance function, so your last line is near identical to Color.Lerp(stuff); - not setting your material color
Answer by DaveA · Mar 06, 2011 at 08:27 PM
Look in the particle shaders. I'm a fan of additive soft. You could also put alpha channels on your textures if that might help. You shouldn't have to do anything fancy (no script anyway).
Your answer
Follow this Question
Related Questions
Vertex Alpha value doesn't update? 1 Answer
Fade in a GameObject Material? 1 Answer
Way to get a material to alpha-fade along the texture? 0 Answers
Optimize code changing transparency of large number of Objects 0 Answers
Tinted alpha 1 Answer