【发布时间】:2016-05-21 16:36:25
【问题描述】:
我的游戏中有一个球体,我需要在其内部添加纹理。 为此,我使用了一个特定的脚本。 我还希望能够使用我在另一个脚本中的功能淡入和淡出纹理。
但我无法组合这些脚本。无论我尝试什么,图像都不会显示在球体内。
着色器是:
翻转内部:
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
}
}
}
}
是否可以在组合这些着色器的同时仍然从内部球体中查看纹理?
【问题讨论】:
标签: unity3d textures shader transition alpha