- Home /
Combining BlinnPhong with WrapDiffuse
I'd like to combine the wrap diffuse lighting model with the BlinnPhong, so I can have wrap diffuse but with the Blinnphong specular.
Here is the code for the BlinnPhong. Ideally I'd also like to be able to control the wrap amount with a slider.
#pragma surface surf WrapBlinnPhong
fixed4 LightingWrapBlinnPhong (SurfaceOutput s, fixed3 lightDir, fixed3 viewDir, fixed atten) { fixed3 h = normalize (lightDir + viewDir);
fixed diff = max (0, dot (s.Normal, lightDir));
float nh = max (0, dot (s.Normal, h));
float spec = pow (nh, s.Specular*128.0) * s.Gloss;
fixed4 c;
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * (atten * 2);
c.a = s.Alpha + _LightColor0.a * _SpecColor.a * spec * atten;
return c;
Thanks.
Comment