Hello.
I’m new to shaders and trying to use the shader from (Making specific shader for texture transition effect - Questions & Answers - Unity Discussions)
for skybox cubemap transition.
I did some modification like this:
Shader "Custom/Transition" {
Properties{
_MainTex("Base (RGB)", CUBE) = "white" {}
_DetailTex("Detail (RGB)", CUBE) = "white" {}
_Guide("Guide (RGB)", CUBE) = "white" {}
_Threshold("Threshold",Range(0,1)) = 0
}
SubShader{
Tags{ "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
#pragma target 4.0
samplerCUBE _MainTex;
samplerCUBE _DetailTex;
samplerCUBE _Guide;
float _Threshold;
struct Input {
float3 uv_MainTex;
float3 uv_DetailTex;
float3 uv_Guide;
};
void surf(Input IN, inout SurfaceOutput o) {
half4 c = texCUBE(_MainTex, IN.uv_MainTex);
half4 d = texCUBE(_DetailTex, IN.uv_DetailTex);
half4 g = texCUBE(_Guide, IN.uv_Guide);
if ((g.r + g.g + g.b)*0.33333f < _Threshold)
o.Albedo = d.rgb;
else
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
But I cannot get it to work:
Shader error in ‘Custom/Transition’: cannot implicitly convert from ‘const float2’ to ‘float3’ at line 86 (on d3d11)
Is it the right way to achieve the skybox transition effect? Thanks.