- Home /
Point light too bright in single-color shader within range of light
Hey! I was working on making a surface shader that takes separates the darks and brights of a scene into two solid colors. Unfortunately, this doesn't seem to work with point lights--the colors are getting all messed up.
I ran a test where I'm trying to just make everything just a single color with nothing else and I'm still noticing an odd problem. The color just isn't right and it corresponds to the range of the point light. If I lower the range, I get this:
There's a big color-deforming square around the light. The darker orange is what everything should look like. I stripped my shader down to almost nothing and I can't figure it out:
Shader ".MyBoys/TexShadowShader"
{
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
}
SubShader {
Lighting off
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Ramp
half4 _Color;
half4 LightingRamp (SurfaceOutput s, half3 lightDir, half atten) {
return _Color;
}
struct Input {
float2 uv_MainTex;
} ;
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
FallBack "Diffuse"
}
What is causing this bright square and is there a way to either stop it while still utilizing the point light or utilize that lighting information in the shader somewhere? When the range is big enough, the square covers everything, but then it just changes the color, which isn't what I want at all.
I should note that this doesn't happen with directional lights--those are fine.
Thanks!
Answer by Dr-Hazrd · Mar 12 at 07:04 PM
This still happens in 2022