18 lines
732 B
HLSL
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 |