Skip to content

Commit e5fc8c3

Browse files
author
Stephen Hodgson
authored
Merge pull request #468 from keveleigh/ShaderFix
HoloToolkitCommon fix
2 parents 8746354 + 710a8bd commit e5fc8c3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Assets/HoloToolkit/Utilities/Shaders/HoloToolkitCommon.cginc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,19 @@ float ComputeNearPlaneFadeLinear(float4 vertex)
1010
return saturate(mad(distToCamera, _NearPlaneFadeDistance.y, _NearPlaneFadeDistance.x));
1111
}
1212

13+
inline float3 HoloTKLightingLambertian(float3 normal, float3 lightDir, float3 lightCol)
14+
{
15+
float diff = max(0, dot(normal, lightDir));
16+
return lightCol * diff;
17+
}
18+
19+
inline float3 HoloTKLightingBlinnPhong(float3 normal, float3 lightDir, float lightCol, float3 viewDir, float specularAmount, float glossAmount, float3 specularColor)
20+
{
21+
float3 h = normalize(lightDir + viewDir);
22+
float nh = max(0, dot(normal, h));
23+
float spec = pow(nh, specularAmount*128.0) * glossAmount;
24+
25+
return lightCol * specularColor * spec;
26+
}
27+
1328
#endif //HOLOTOOLKIT_COMMON

0 commit comments

Comments
 (0)