Hi! I have this shader:
Shader "Custom/WallB"
{
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Base Color", 2D) = "white" {}
_BumpMap ("Normal Map", 2D) = "bump" {}
_UVs ("UV Scale", float) = 1.0
_Offset ("Offset", Vector) = (0,0,0,0)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf StandardSpecular fullforwardshadows
#pragma target 3.0
sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;
float _UVs;
float4 _Offset;
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
float3 worldPos;
float3 worldNormal;
INTERNAL_DATA
};
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandardSpecular o) {
float3 Pos = (IN.worldPos + _Offset) / (-1.0 * abs(_UVs));
float3 c1 = tex2D(_MainTex, Pos.yz).rgb;
float3 c2 = tex2D(_MainTex, Pos.xz).rgb;
float3 c3 = tex2D(_MainTex, Pos.xy).rgb;
float alpha21 = abs(IN.worldNormal.x);
float alpha23 = abs(IN.worldNormal.z);
float3 c21 = lerp(c2, c1, alpha21).rgb;
float3 c23 = lerp(c21, c3, alpha23).rgb;
o.Albedo = c23 * _Color;
float3 normalTex1 = UnpackNormal(tex2D(_BumpMap, Pos.yz));
float3 normalTex2 = UnpackNormal(tex2D(_BumpMap, Pos.xz));
float3 normalTex3 = UnpackNormal(tex2D(_BumpMap, Pos.xy));
float3 normal21 = lerp(normalTex2, normalTex1, alpha21);
float3 normal23 = lerp(normal21, normalTex3, alpha23);
//o.Normal = normalize(normal23);
}
ENDCG
}
FallBack "Mobile/VertexLit"
}
And when I uncomment //o.normal side walls don’t work properly.
I would be happy if someone would fix this. I completely can’t understand shaders, and maybe shader graph could be better, but then I would need to change everything in project, and I don’t want to do it especially when I want to publish this on mobiles so I want to keep things simple.
