This is how the fragment shader looks in the default Unity shader “Particles/Alpha Blended”(file name “Particle Alpha Blended.shader” in downloadable default shader zip):
Blend SrcAlpha OneMinusSrcAlpha
fixed4 frag (v2f i) : COLOR
{
#ifdef SOFTPARTICLES_ON
float sceneZ = LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))));
float partZ = i.projPos.z;
float fade = saturate (_InvFade * (sceneZ-partZ));
i.color.a *= fade;
#endif
return 2.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord);
}
Why is final color multiplied with 2?
Colors are always multiplied by 2 in all the shaders. I asked this question myself a while ago and pretty much got the answer - that's what you do! However, somewhere, and I can't find where, I read an explanation a month or so ago. Wish I could fully remember what it was. Anyhoo - multiply * 2 to look like any normal Unity shader
– whydoidoitI can't really find any other default Unity shader which multiplies with 2? An example? I you somehow remember where you read that explanation, please share it.
– voldemarzReally- well they all do it internally if it's not a vertex/fragment program. I pretty much don't use the default shaders any more - so all mine * 2.
– whydoidoitHere's my forum question: http://forum.unity3d.com/threads/155099-Vertex-lit-shader-lighting-is-too-dark Here's my answers question: http://answers.unity3d.com/questions/333699/shader-lighting-is-too-dark.html
– whydoidoitNo idea on that reference I'm afraid.
– whydoidoit