Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float4 frag(vertexOutput i) : COLOR {
- float3 normalDirection = normalize( mul( float4( i.normalDir, 0.0 ), _World2Object ).xyz );
- float3 viewDirection = normalize(float3(float4(_WorldSpaceCameraPos.xyz,1.0) - i.posWorld.xyz)); //fill this in
- float3 lightDirection = normalize( _WorldSpaceLightPos0.xyz );
- float3 amb = _Color.rgb * float3(.1,.1,.1);
- float3 diffuseReflection = _LightColor0.xyz * _Color * dot(normalDirection, lightDirection);
- float3 r = reflect( -lightDirection,normalDirection);
- float3 specularReflection = _LightColor0.xyz * _Color * pow(max(0,dot(r,viewDirection)),_Shininess); //fill this in
- float3 lightFinal = amb + diffuseReflection + specularReflection;
- return float4(lightFinal,1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement