Ember

Untitled

Aug 11th, 2011
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. // MATERIAL
  2.  
  3. vertex_program snowshader_VS cg
  4. {
  5. source snowshader.cg
  6. entry_point snowshader_vp
  7. profiles vs_1_1
  8.  
  9. default_params
  10. {
  11. param_named_auto worldViewProj worldviewproj_matrix
  12. param_named_auto eyePosition camera_position_object_space
  13. }
  14. }
  15.  
  16. fragment_program snowshader_PS cg
  17. {
  18. source snowshader.cg
  19. entry_point snowshader_fp
  20. profiles ps_1_1
  21.  
  22. default_params
  23. {
  24. param_named_auto scroll time_0_x 20
  25. param_named speed float 0.05
  26. }
  27. }
  28.  
  29. material particle_snowflakes_shader
  30. {
  31. receive_shadows off
  32.  
  33. technique
  34. {
  35. pass
  36. {
  37. scene_blend alpha_blend
  38. lighting off
  39. fog_override true
  40.  
  41. cull_hardware none
  42. cull_software none
  43.  
  44. depth_write off
  45.  
  46. vertex_program_ref snowshader_VS
  47. {
  48. }
  49.  
  50. fragment_program_ref snowshader_PS
  51. {
  52. }
  53.  
  54. texture_unit
  55. {
  56. texture particle_snowflakes3.png
  57. }
  58. }
  59. }
  60. }
  61.  
  62. material particle_snowflakes_basic
  63. {
  64. receive_shadows off
  65.  
  66. technique
  67. {
  68. pass
  69. {
  70. scene_blend alpha_blend
  71. lighting off
  72. fog_override true
  73.  
  74. cull_hardware none
  75. cull_software none
  76.  
  77. depth_write off
  78.  
  79. texture_unit
  80. {
  81. texture particle_snowflakes3.png
  82. scroll_anim 0.1 0.7
  83. }
  84. }
  85. }
  86. }
  87.  
  88. // CG
  89.  
  90. void snowshader_vp(
  91.  
  92. float4 in_POSITION : POSITION,
  93. float2 in_UV0 : TEXCOORD0,
  94. float3 in_COLOR : COLOR,
  95.  
  96. out float4 out_POSITION : POSITION,
  97. out float2 out_UV0 : TEXCOORD0,
  98. out float4 out_COLOR : COLOR,
  99.  
  100. uniform float4x4 worldViewProj,
  101. uniform float4 eyePosition
  102. )
  103.  
  104. {
  105. out_POSITION = mul(worldViewProj, in_POSITION);
  106. out_UV0 = in_UV0;
  107.  
  108. float A = max(0, 1-((distance(eyePosition, in_POSITION)-6000)/2000));
  109. out_COLOR = float4(in_COLOR, A);
  110. }
  111.  
  112. void snowshader_fp(
  113.  
  114. float2 fp_in_UV0 : TEXCOORD0,
  115. float4 fp_in_COLOR : COLOR,
  116.  
  117. out float4 fp_out_COLOR : COLOR,
  118.  
  119. float scroll,
  120. float speed,
  121. uniform sampler2D texture
  122. )
  123.  
  124. {
  125. fp_in_UV0.y += scroll * speed;
  126. fp_out_COLOR = tex2D(texture, fp_in_UV0);
  127. /* fp_out_COLOR.a = 1; fp_in_COLOR.a; */
  128. }
Advertisement
Add Comment
Please, Sign In to add comment