Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
783 B

  1. ps.1.1
  2. ;------------------------------------------------------------------------------
  3. ; See the vertex shader for info
  4. ;
  5. ; This shader takes:
  6. ; t0 = normal map
  7. ; t1 = base texture
  8. ; v0 = directional light color
  9. ; t2 = directional light direction (biased into 0-1)
  10. ; c0 = percent of dirlight to add as ambient
  11. ;
  12. ; Output:
  13. ; (t0 dot t1) * v0
  14. ;------------------------------------------------------------------------------
  15. tex t0 ; Get the 3-vector from the normal map
  16. tex t1 ; Interpret tcoord t1 as color data.
  17. texcoord t2
  18. dp3 r1, t0_bx2, t2_bx2 ; r1 = normalMap dot dirLightDir
  19. add r0, r1, c0 ; + 0.5
  20. mul r1, v0, r0 ; scale the dot product by the dirlight's actual color
  21. mul r0.rgb, r1, t1 + ; scale by the texture color
  22. mul r0.a, t1.a, v0.a