I want to have transparent effect.Can I assign o.Albedo in the following way:
o.Albedo =half4( tex2D (_MainTex, IN.uv_MainTex).rgb,0.2);(here alpha is assigned 0.2)…
It doesnt work???help me…
o.Alpha=0.2;…still doesnt work…Did I miss something???
From http://docs.unity3d.com/Documentation/Components/SL-SurfaceShaders.html :
Surface Shader compile directives
Surface shader is placed inside CGPROGRAM…ENDCG block, just like any other shader. The differences are:
It must be placed inside SubShader block, not inside Pass. Surface shader will compile into multiple passes itself.
It uses #pragma surface … directive to indicate it’s a surface shader.
The #pragma surface directive is:
#pragma surface surfaceFunction lightModel [optionalparams]
Required parameters:
surfaceFunction - which Cg function has surface shader code. The function should have the form of void surf (Input IN, inout SurfaceOutput o), where Input is a structure you have defined. Input should contain any texture coordinates and extra automatic variables needed by surface function.
lightModel - lighting model to use. Built-in ones are Lambert (diffuse) and BlinnPhong (specular). See Custom Lighting Models page for how to write your own.
Optional parameters:
alpha - Alpha blending mode. Use this for semitransparent shaders.
(and for future reference, try not to beg with help me help me threads with multiple question marks, but put a title for topic that makes sense).
I am using surface shader.so there would not be the “pass”,only “subshader”.where cant I set the alpha???Help me
From http://docs.unity3d.com/Documentation/Components/SL-SurfaceShaders.html :
Optional parameters:
alpha - Alpha blending mode. Use this for semitransparent shaders.