Hello guys!
I’ve been writting my own shader for my game, this is how it looks:
Shader "Planet Generator/ShadowTest" {
Properties {
_Tex0 ("Tex 0", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
Pass {
Tags { "LightMode" = "ForwardBase" }
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#pragma target 3.0
#pragma multi_compile_fwdbase
#include "AutoLight.cginc"
sampler2D _Tex0;
uniform float4 _Tex0_ST;
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 col : COLOR;
LIGHTING_COORDS(1,2)
};
v2f vert (appdata_base vInput) {
v2f OUT;
OUT.pos = mul (UNITY_MATRIX_MVP, vInput.vertex);
OUT.uv = TRANSFORM_TEX(vInput.texcoord, _Tex0);
OUT.col = length(vInput.vertex);
TRANSFER_VERTEX_TO_FRAGMENT(OUT);
return OUT;
}
half4 frag (v2f fInput) : COLOR {
float attenuation = LIGHT_ATTENUATION(fInput);
half4 c0 = tex2D (_Tex0, fInput.uv);
return c0 * attenuation;
}
ENDCG
}
}
Fallback "VertexLit"
}
This is a simple vert frag shader which is supposed to be affected by lights, objects are casting lights but for some unknown reason I’m getting this issue:
Shaded areas are looking like that when directional light intensity is > 0 …
I would love to have some help! Thankyou!