c1_unity/Assets/arts/shaders/models/PointLightInclude.cginc
2023-04-03 11:04:31 +08:00

18 lines
732 B
HLSL

#ifndef POINTLIGHT_INCLUDE
#define POINTLIGHT_INCLUDE
uniform half4 _pLightLocation;
uniform half4 _pLightColor;
uniform half _pLightRange;
//uniform half _pLightSoft;
uniform half _pLightBrightness;
inline half4 PointLight(fixed3 normalMap,fixed3 posWorld){
half pNdotL = saturate(dot(normalMap, normalize(_pLightLocation - posWorld)));
half pLightDistance = saturate(1 - distance(posWorld,_pLightLocation) / _pLightRange);
pLightDistance *= pLightDistance;
//pLightDistance = saturate(pow(pLightDistance,_pLightSoft));
half4 pLight = pLightDistance * _pLightColor * pNdotL * _pLightBrightness;
//pLight *= pLight;
return pLight;
}
#endif