Advertisement
Guest User

Untitled

a guest
Feb 19th, 2014
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. float sRes : RES = 0;
  2. float4 sNight : NIGHT;
  3.  
  4. #include "mta-helper.fx"
  5.  
  6. // Variable to fetch the texture from the script
  7. texture gTexture;
  8.  
  9. sampler Sampler0 = sampler_state
  10. {
  11.     Texture         = (gTexture0);
  12.     MinFilter       = Linear;
  13.     MagFilter       = Linear;
  14.     MipFilter       = Linear;
  15. };
  16.  
  17. struct PSInput
  18. {
  19.     float4 Position : POSITION0;
  20.     float4 Diffuse : COLOR0;
  21.     float2 TexCoord: TEXCOORD0;
  22. };
  23.  
  24. float4 PixelShaderFunction(PSInput PS) : COLOR0
  25. {
  26.     float2 uv = PS.TexCoord - fmod(PS.TexCoord, sRes);
  27.     float4 texel = tex2D(Sampler0, uv);
  28.  
  29.     float alpha = tex2D(Sampler0, PS.TexCoord).a;
  30.  
  31.     float4 finalColor = texel * PS.Diffuse * sNight;
  32.     finalColor.a = alpha * PS.Diffuse.a;
  33.  
  34.     return finalColor;
  35. };
  36.  
  37. technique night
  38. {
  39.     pass P0
  40.     {
  41.         DepthBias=-0.0002;
  42.         PixelShader  = compile ps_2_0 PixelShaderFunction();
  43.     }
  44.     pass P1
  45.     {
  46.         Texture[0] = gTexture;
  47.     }
  48. };
  49.  
  50. technique fallback
  51. {
  52.     pass P0
  53.     {
  54.         // Draw normally
  55.     }
  56. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement