Unity3d 在unity中组合2个着色器
我的游戏中有一个球体,我需要在它的内部有一个纹理。 为此,我使用了一个特定的脚本。 我还希望能够淡入淡出纹理与功能,我在另一个脚本 但是我不能把这些脚本组合起来。无论我尝试什么,图像都不会显示在球体内部 着色器包括: 翻转内部:Unity3d 在unity中组合2个着色器,unity3d,textures,shader,transition,alpha,Unity3d,Textures,Shader,Transition,Alpha,我的游戏中有一个球体,我需要在它的内部有一个纹理。 为此,我使用了一个特定的脚本。 我还希望能够淡入淡出纹理与功能,我在另一个脚本 但是我不能把这些脚本组合起来。无论我尝试什么,图像都不会显示在球体内部 着色器包括: 翻转内部: Shader "Flip Normals" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Tags { "
Shader "Flip Normals" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
Cull Front
CGPROGRAM
#pragma surface surf Lambert vertex:vert
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
float4 color : COLOR;
};
void vert(inout appdata_full v)
{
v.normal.xyz = v.normal * -1;
}
void surf (Input IN, inout SurfaceOutput o) {
fixed3 result = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = result.rgb;
o.Alpha = 1;
}
ENDCG
}
Fallback "Diffuse"
}
和音量控制器:
Shader "Custom/AlphaBlendTransition" {
Properties {
_Blend ("Blend", Range (0, 1) ) = 0.0
_BaseTexture ("Base Texture", 2D) = "" {}
_OverlayTexture ("Texture 2 with alpha", 2D) = "" {}
}
SubShader {
Pass {
SetTexture[_BaseTexture]
SetTexture[_OverlayTexture] {
ConstantColor (0,0,0, [_Blend])
combine texture Lerp(constant) previous
}
}
}
}
是否可以在仍然从内部球体查看纹理的情况下组合这些着色器?有一种方法可以避免同时使用这两种着色器。您可以使用任何3D建模软件导出具有翻转法线的球体,然后将其导入Unity,以便使用AlphaBlendTransition着色器仅应用一种材质。这将非常有用!非常感谢。