Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. float4 frag(vertexOutput i) : COLOR {
  2. float3 normalDirection = normalize( mul( float4( i.normalDir, 0.0 ), _World2Object ).xyz );
  3. float3 viewDirection = normalize(float3(float4(_WorldSpaceCameraPos.xyz,1.0) - i.posWorld.xyz)); //fill this in
  4. float3 lightDirection = normalize( _WorldSpaceLightPos0.xyz );
  5. float3 amb = _Color.rgb * float3(.1,.1,.1);
  6. float3 diffuseReflection = _LightColor0.xyz * _Color * dot(normalDirection, lightDirection);
  7. float3 r = reflect( -lightDirection,normalDirection);
  8. float3 specularReflection = _LightColor0.xyz * _Color * pow(max(0,dot(r,viewDirection)),_Shininess); //fill this in
  9. float3 lightFinal = amb + diffuseReflection + specularReflection;
  10.  
  11.  
  12. return float4(lightFinal,1.0);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement