home *** CD-ROM | disk | FTP | other *** search
/ NVIDIA Tech Demo: DAWN / NVIDIA_demo.iso / Dawn.exe / Disk1 / data1.cab / Program_Executable_Files / shaders_ultra / finalSkin.fp30 < prev    next >
Encoding:
Text File  |  2003-02-11  |  4.1 KB  |  96 lines

  1. !!FP1.0
  2. # NV_fragment_program generated by NVIDIA Cg compiler
  3. # cgc version 1.5.0001, build date Oct 15 2002  01:04:08
  4. # command line args: -profile fp30
  5. #vendor NVIDIA Corporation
  6. #version 1.0.1
  7. #profile fp30
  8. #program main
  9. #semantic main.skinColor_frontSpec
  10. #semantic main.skin_norm_sideSpec
  11. #semantic main.g_specular_colorShift
  12. #semantic main.g_blood_texture
  13. #semantic main.g_transmission_terms
  14. #semantic main.g_diffuse_Cube
  15. #semantic main.g_specular_Cube
  16. #semantic main.g_nrmalize_Cube
  17. #semantic main.g_dappleProjection
  18. #semantic main.g_hilight_Cube
  19. #semantic main.g_oiliness
  20. #var float4 v2f.skinColor_frontSpec : $vin.TEXCOORD0 : TEXCOORD0 : 0 : 1
  21. #var float3 v2f.worldEyeDir       : $vin.TEXCOORD2 : TEXCOORD2 : 0 : 1
  22. #var float3 v2f.worldTanMatrixX        : $vin.TEXCOORD5 : TEXCOORD5 : 0 : 1
  23. #var float3 v2f.worldTanMatrixY        : $vin.TEXCOORD6 : TEXCOORD6 : 0 : 1
  24. #var float3 v2f.worldTanMatrixZ        : $vin.TEXCOORD7 : TEXCOORD7 : 0 : 1
  25. #var float4 v2f.SkinSilouetteVec    : $vin.TEXCOORD3 : TEXCOORD3 : 0 : 1
  26. #var samplerRECT skinColor_frontSpec :  : texunit 0 : 1 : 1
  27. #var samplerRECT skin_norm_sideSpec  :  : texunit 1 : 2 : 1
  28. #var samplerRECT g_specular_colorShift :  : texunit 2 : 3 : 1
  29. #var samplerRECT g_blood_texture          :  : texunit 3 : 4 : 1
  30. #var samplerRECT g_transmission_terms  :  : texunit 4 : 5 : 1
  31. #var samplerCUBE g_diffuse_Cube          :  : texunit 5 : 6 : 1
  32. #var samplerCUBE g_specular_Cube       :  : texunit 6 : 7 : 1
  33. #var samplerCUBE g_nrmalize_Cube       :  : texunit 7 : 8 : 1
  34. #var samplerRECT g_dappleProjection    :  : texunit 8 : 9 : 1
  35. #var samplerCUBE g_hilight_Cube        :  : texunit 9 : 10 : 1
  36. #var float2 g_oiliness :  :  : 11 : 1
  37. #var half4 COL : $vout.COLOR : COLOR : -1 : 1
  38.  
  39. DEFINE LUMINANCE = {0.299, 0.587, 0.114, 0.0};
  40. DECLARE g_oiliness;
  41.  
  42. ############################################################################################
  43. #  These two blocks slow code down 10%                                                     #
  44. ############################################################################################
  45. TEX H0, f[TEX0], TEX1, 2D;                  # store range-compressed normal (and side spec) in H1
  46. TEX H1, f[TEX0], TEX0, 2D;                  # store skin color in H3
  47.  
  48. MOVH H2.x, g_oiliness.y;
  49. MULX H0.xy, H0, H2.x;
  50. TEX H0, H0, TEX7, CUBE;
  51.  
  52. MOVH H3, f[TEX5];
  53. DP3X H2.x, H0, H3;
  54. MOVH H3, f[TEX6];
  55. DP3X H2.y, H0, H3;
  56. MOVH H3, f[TEX7];
  57. DP3X H2.z, H0, H3;                          # H2 now contains worldNormal - extinguish
  58.  
  59. MOVH H0.xyz, f[TEX2];                       # store v2f.world_V in H1
  60. DP3X H2.w, H0, H2;                          # H2.w = dot(Normal, View)
  61. MULX H2.xyz,-H2, -2;                        # twice the normal
  62. MADX H3.xyz, -H2, H2.w, H0;                 # H4 = -2*dot(H0, H2)*H2 + H0  = reflection vector.  Normal doesn't need to be fixed, because it's uniformly scaled
  63.  
  64. TEX H0.xyz, H2, TEX5, CUBE;                 # diffuse lighting
  65. TEX H2, H2, TEX6, CUBE;                     # side specular
  66. MULX H0.xyz, H0, H1;                        # skin diffuse*diffuse color
  67. #MULX H2, H2, H0.w;                         # side_spec*side_spec term (H0.w is the side_spec term)
  68. MULX H2, H2, H1.w;                          # side_spec*side_spec term (H0.w is the side_spec term)
  69.  
  70. MOVH H1.xyz, f[TEX3];                       # copy ndotv (H1.w is the spec map)
  71. MULX H0, H0, H1.x;
  72. MADX H0, H2, H1.y, H0;                      # diffuse + side_spec (H2 avail)
  73.  
  74. TEX H2, f[TEX2], TEX9, CUBE;                # fetch hilight
  75. TEX H3, H3, TEX6, CUBE;                     # fetch direct specular
  76. MULX H2.xyz, H2, H1.y;                      # hilight by facing ratio
  77. MULX H2.xyz, H2, H1.x;
  78. MULX H3, H3, H1.w;                          # spec*spec_map
  79. MULX H3, H3, 0.02;                          # scale specular
  80. MOVH H3.w, g_oiliness.x;
  81. MULH H3, H3, H3.w;                    # scale the oiliness
  82. MADX H2.xyz, H2, 0.7, H3;                   # 0.7*hilight + direct spec
  83.  
  84. ADDX H0, H2, H0;                            # diffuse specs and hilight
  85. #MADX o[COLH], H0, H1.x, H2.w;              # add haze
  86. ADDX o[COLH], H0, H2.w;                     # add haze
  87. END
  88.  
  89.  
  90. # End of program
  91.  
  92.  
  93.  
  94.  
  95.  
  96.