Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.26 KB | None | 0 0
  1. #include "shaders/datatypes.fx"
  2.  
  3. texture texture0 : TEXLAYER0;
  4. texture texture1 : TEXLAYER1;
  5. texture texture2 : TEXLAYER2;
  6. texture texture3 : TEXLAYER3;
  7. texture texture4 : TEXLAYER4;
  8. texture texture5 : TEXLAYER5;
  9. texture texture6 : TEXLAYER6;
  10.  
  11. scalar backbufferLerpbias : BACKBUFFERLERPBIAS;
  12. vec2 sampleoffset : SAMPLEOFFSET;
  13. vec2 fogStartAndEnd : FOGSTARTANDEND;
  14. vec3 fogColor : FOGCOLOR;
  15. float glowStrength : GLOWSTRENGTH;
  16.  
  17. float nightFilter_noise_strength : NIGHTFILTER_NOISE_STRENGTH;
  18. float nightFilter_noise : NIGHTFILTER_NOISE;
  19. float nightFilter_blur : NIGHTFILTER_BLUR;
  20. float nightFilter_mono : NIGHTFILTER_MONO;
  21.  
  22. float2 displacement : DISPLACEMENT;
  23.  
  24. float PI = 3.1415926535897932384626433832795;
  25.  
  26. // one pixel in screen texture units
  27. float deltaU : DELTAU;
  28. float deltaV : DELTAV;
  29.  
  30. sampler sampler0 = sampler_state { Texture = (texture0); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
  31. sampler sampler1 = sampler_state { Texture = (texture1); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
  32. sampler sampler2 = sampler_state { Texture = (texture2); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
  33. sampler sampler3 = sampler_state { Texture = (texture3); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
  34. sampler sampler4 = sampler_state { Texture = (texture4); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
  35. sampler sampler5 = sampler_state { Texture = (texture5); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
  36. sampler sampler6 = sampler_state { Texture = (texture6); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
  37.  
  38. sampler sampler0bilin = sampler_state { Texture = (texture0); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
  39. sampler sampler1bilin = sampler_state { Texture = (texture1); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
  40. sampler sampler2bilin = sampler_state { Texture = (texture2); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
  41. sampler sampler3bilin = sampler_state { Texture = (texture3); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
  42. sampler sampler4bilin = sampler_state { Texture = (texture4); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
  43. sampler sampler5bilin = sampler_state { Texture = (texture5); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
  44.  
  45. sampler sampler0bilinwrap = sampler_state { Texture = (texture0); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
  46. sampler sampler1bilinwrap = sampler_state { Texture = (texture1); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
  47. sampler sampler2bilinwrap = sampler_state { Texture = (texture2); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
  48. sampler sampler3bilinwrap = sampler_state { Texture = (texture3); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
  49. sampler sampler4bilinwrap = sampler_state { Texture = (texture4); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
  50. sampler sampler5bilinwrap = sampler_state { Texture = (texture5); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
  51.  
  52. scalar NPixels : NPIXLES = 1.0;
  53. float2 ScreenSize : VIEWPORTSIZE = {800,600};
  54. scalar Glowness : GLOWNESS = 3.0;
  55. scalar Cutoff : cutoff = 0.8;
  56.  
  57.  
  58. struct APP2VS_Quad
  59. {
  60. vec2 Pos : POSITION0;
  61. vec2 TexCoord0 : TEXCOORD0;
  62. };
  63.  
  64. struct VS2PS_Quad
  65. {
  66. vec4 Pos : POSITION;
  67. vec2 TexCoord0 : TEXCOORD0;
  68. };
  69.  
  70. struct VS2PS_Quad2
  71. {
  72. vec4 Pos : POSITION;
  73. vec2 TexCoord0 : TEXCOORD0;
  74. vec2 TexCoord1 : TEXCOORD1;
  75. };
  76.  
  77. struct VS2PS_Quad3
  78. {
  79. vec4 Pos : POSITION;
  80. vec2 TexCoord0 : TEXCOORD0;
  81. vec2 TexCoord1 : TEXCOORD1;
  82. vec2 TexCoord2 : TEXCOORD2;
  83. };
  84.  
  85. struct VS2PS_Quad4
  86. {
  87. vec4 Pos : POSITION;
  88. vec2 TexCoord0 : TEXCOORD0;
  89. vec2 TexCoord1 : TEXCOORD1;
  90. vec2 TexCoord2 : TEXCOORD2;
  91. vec2 TexCoord3 : TEXCOORD3;
  92. };
  93.  
  94. struct VS2PS_Quad5
  95. {
  96. vec4 Pos : POSITION;
  97. vec2 Color0 : COLOR0;
  98. vec2 TexCoord0 : TEXCOORD0;
  99. vec2 TexCoord1 : TEXCOORD1;
  100. };
  101.  
  102. struct PS2FB_Combine
  103. {
  104. vec4 Col0 : COLOR0;
  105. };
  106.  
  107. VS2PS_Quad vsDx9_OneTexcoord(APP2VS_Quad indata)
  108. {
  109. VS2PS_Quad outdata;
  110. outdata.Pos = vec4(indata.Pos.x, indata.Pos.y, 0, 1);
  111. outdata.TexCoord0 = indata.TexCoord0;
  112. return outdata;
  113. }
  114.  
  115. const float4 filterkernel[8] = {
  116. -1.0, 1.0, 0, 0.125,
  117. 0.0, 1.0, 0, 0.125,
  118. 1.0, 1.0, 0, 0.125,
  119. -1.0, 0.0, 0, 0.125,
  120. 1.0, 0.0, 0, 0.125,
  121. -1.0, -1.0, 0, 0.125,
  122. 0.0, -1.0, 0, 0.125,
  123. 1.0, -1.0, 0, 0.125,
  124. };
  125.  
  126. VS2PS_Quad2 vsDx9_Tinnitus(APP2VS_Quad indata)
  127. {
  128. VS2PS_Quad2 outdata;
  129. outdata.Pos = vec4(indata.Pos.x, indata.Pos.y, 0, 1);
  130. outdata.TexCoord0 = indata.TexCoord0;
  131. outdata.TexCoord1 = vec2(indata.TexCoord0.x - sampleoffset.x, indata.TexCoord0.y - sampleoffset.y);
  132. return outdata;
  133. }
  134.  
  135. PS2FB_Combine psDx9_Tinnitus(VS2PS_Quad2 indata)
  136. {
  137. PS2FB_Combine outdata;
  138. float4 blur = float4(0,0,0,0);
  139. for(int i=0;i<8;i++)
  140. blur += filterkernel[i].w * tex2D(sampler0bilin, float2(indata.TexCoord0.x + 0.02 * filterkernel[i].x, indata.TexCoord0.y + 0.02 * filterkernel[i].y));
  141. float4 color = tex2D(sampler0bilin, indata.TexCoord0);
  142. float2 tcxy = float2(indata.TexCoord0.x, indata.TexCoord0.y);
  143.  
  144. //parabolic function for x opacity to darken the edges, exponential function for yopacity to darken the lower part of the screen
  145. float darkness = max(4 * tcxy.x * tcxy.x - 4 * tcxy.x + 1, saturate((pow(2.5,tcxy.y) - tcxy.y/2 - 1)));
  146.  
  147. //weight the blurred version more heavily as you go lower on the screen
  148. float4 finalcolor = lerp(color, blur, saturate(2 * (pow(4,tcxy.y) - tcxy.y - 1)));
  149.  
  150. //darken the left, right, and bottom edges of the final product
  151. finalcolor = lerp(finalcolor, float4(0,0,0,1), darkness);
  152. float4 outcolor = float4(finalcolor.rgb,saturate(2*backbufferLerpbias));
  153. outdata.Col0 = outcolor;
  154. return outdata;
  155. }
  156.  
  157. technique Tinnitus
  158. {
  159. pass p0
  160. {
  161. ZEnable = TRUE;
  162. AlphaBlendEnable = TRUE;
  163. SrcBlend = SRCALPHA;
  164. DestBlend = INVSRCALPHA;
  165. StencilEnable = FALSE;
  166.  
  167. VertexShader = compile vs_1_1 vsDx9_Tinnitus();
  168. PixelShader = compile PS2_EXT psDx9_Tinnitus();
  169. }
  170. }
  171.  
  172. vec4 psDx9_Glow(VS2PS_Quad indata) : COLOR
  173. {
  174. return tex2D(sampler0bilin, indata.TexCoord0);
  175. }
  176.  
  177. vec4 psDx9_GlowMaterial(VS2PS_Quad indata) : COLOR
  178. {
  179. vec4 diffuse = tex2D(sampler0bilin, indata.TexCoord0);
  180. //return (1-diffuse.a);
  181. // temporary test, should be removed
  182. return glowStrength * /*diffuse + */vec4(diffuse.rgb*(1-diffuse.a),1);
  183. }
  184.  
  185. technique GlowMaterial
  186. {
  187. pass p0
  188. {
  189. ZEnable = FALSE;
  190. AlphaBlendEnable = FALSE;
  191. SrcBlend = SRCCOLOR;
  192. DestBlend = ONE;
  193.  
  194. StencilEnable = TRUE;
  195. StencilFunc = NOTEQUAL;
  196. StencilRef = 0x80;
  197. StencilMask = 0xFF;
  198. StencilFail = KEEP;
  199. StencilZFail = KEEP;
  200. StencilPass = KEEP;
  201.  
  202. VertexShader = compile vs_1_1 vsDx9_OneTexcoord();
  203. PixelShader = compile ps_1_1 psDx9_GlowMaterial();
  204. }
  205. }
  206.  
  207. technique Glow
  208. {
  209. pass p0
  210. {
  211. ZEnable = FALSE;
  212. AlphaBlendEnable = TRUE;
  213. SrcBlend = SRCCOLOR;
  214. DestBlend = ONE;
  215.  
  216. VertexShader = compile vs_1_1 vsDx9_OneTexcoord();
  217. PixelShader = compile ps_1_1 psDx9_Glow();
  218. }
  219. }
  220.  
  221. vec4 psDx9_Fog(VS2PS_Quad indata) : COLOR
  222. {
  223. vec3 wPos = tex2D(sampler0, indata.TexCoord0);
  224. scalar uvCoord = saturate((wPos.zzzz-fogStartAndEnd.r)/fogStartAndEnd.g);//fogColorAndViewDistance.a);
  225. return saturate(vec4(fogColor.rgb,uvCoord));
  226. //vec2 fogcoords = vec2(uvCoord, 0.0);
  227. return tex2D(sampler1, vec2(uvCoord, 0.0))*fogColor.rgbb;
  228. }
  229. /*
  230. technique Fog
  231. {
  232. pass p0
  233. {
  234. ZEnable = FALSE;
  235. AlphaBlendEnable = TRUE;
  236. //SrcBlend = SRCCOLOR;
  237. //DestBlend = ZERO;
  238. SrcBlend = SRCALPHA;
  239. DestBlend = INVSRCALPHA;
  240. //StencilEnable = FALSE;
  241.  
  242. StencilEnable = TRUE;
  243. StencilFunc = NOTEQUAL;
  244. StencilRef = 0x00;
  245. StencilMask = 0xFF;
  246. StencilFail = KEEP;
  247. StencilZFail = KEEP;
  248. StencilPass = KEEP;
  249.  
  250. VertexShader = compile vs_1_1 vsDx9_OneTexcoord();
  251. PixelShader = compile ps_2_0 psDx9_Fog();
  252. }
  253. }
  254. */
  255.  
  256. // TVEffect specific...
  257.  
  258. scalar time_0_X : FRACTIME;
  259. scalar time_0_X_256 : FRACTIME256;
  260. float sin_time_0_X : FRACSINE;
  261.  
  262. float interference : INTERFERENCE; // = 0.050000 || -0.015;
  263. float distortionRoll : DISTORTIONROLL; // = 0.100000;
  264. float distortionScale : DISTORTIONSCALE; // = 0.500000 || 0.2;
  265. float distortionFreq : DISTORTIONFREQ; //= 0.500000;
  266. float granularity : TVGRANULARITY; // = 3.5;
  267. float tvAmbient : TVAMBIENT; // = 0.15
  268.  
  269. vec3 tvColor : TVCOLOR;
  270.  
  271. VS2PS_Quad3 vs_TVEffect( APP2VS_Quad indata )
  272. {
  273. VS2PS_Quad3 output;
  274. indata.Pos.xy = sign(indata.Pos.xy);
  275. output.Pos = float4(indata.Pos.xy, 0, 1);
  276. output.TexCoord0 = indata.Pos.xy * granularity + displacement;
  277. output.TexCoord1 = float2(indata.Pos.x * 0.25 - 0.35 * sin_time_0_X, indata.Pos.y * 0.25 + 0.25 * sin_time_0_X);
  278. output.TexCoord2 = indata.TexCoord0;
  279. return output;
  280. }
  281.  
  282. PS2FB_Combine ps_TVEffect20(VS2PS_Quad3 indata)
  283. {
  284. PS2FB_Combine outdata;
  285. float2 img = indata.TexCoord2;
  286. float4 image = tex2D(sampler0bilin, img);
  287.  
  288. if (interference <= 1)
  289. {
  290. float2 pos = indata.TexCoord0;
  291. float rand = tex2D(sampler2bilinwrap, pos) - 0.2;
  292. if (interference < 0) // thermal imaging
  293. {
  294. float hblur = 0.001;
  295. float vblur = 0.0015;
  296. //float hblur = 0.00078125;
  297. //float vblur = 0.001171875;
  298. image *= 0.25;
  299. image += tex2D(sampler0bilin, img + vec2(hblur,vblur))*0.0625;
  300. image += tex2D(sampler0bilin, img - vec2(hblur,vblur))*0.0625;
  301. image += tex2D(sampler0bilin, img + vec2(-hblur,vblur))*0.0625;
  302. image += tex2D(sampler0bilin, img + vec2(hblur,-vblur))*0.0625;
  303. image += tex2D(sampler0bilin, img + vec2(hblur,0))*0.125;
  304. image += tex2D(sampler0bilin, img - vec2(hblur,0))*0.125;
  305. image += tex2D(sampler0bilin, img + vec2(0,vblur))*0.125;
  306. image += tex2D(sampler0bilin, img - vec2(0,vblur))*0.125;
  307. //outdata.Col0.r = lerp(lerp(lerp(0.43, 0.17, image.g), lerp(0.75f, 0.50f, image.b), image.b),image.r,image.r); // M
  308. outdata.Col0.r = lerp(0.43,0,image.g) + image.r; // terrain max light mod should be 0.608
  309. outdata.Col0.r -= interference * rand; // add -interference
  310. outdata.Col0 = vec4(tvColor * outdata.Col0.rrr,image.a);
  311. }
  312. else // normal tv effect
  313. {
  314. float noisy = tex2D(sampler1bilinwrap, indata.TexCoord1) - 0.5;
  315. float dst = frac(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
  316. dst *= (1 - dst);
  317. dst /= 1 + distortionScale * abs(pos.y);
  318. img.x += distortionScale * noisy * dst;
  319. image = dot(float3(0.3,0.59,0.11), image);
  320. outdata.Col0 = float4(tvColor,1) * (interference * rand + image * (1-tvAmbient) + tvAmbient);
  321. }
  322. }
  323. else outdata.Col0 = image;
  324. return outdata;
  325. }
  326.  
  327. PS2FB_Combine ps_TVEffect14(VS2PS_Quad3 indata)
  328. {
  329. PS2FB_Combine outdata;
  330. if ( interference >= 0 && interference <= 1 ) {
  331. float2 pos = indata.TexCoord0;
  332. float2 img = indata.TexCoord1;
  333. float rand = tex2D(sampler2bilinwrap, indata.TexCoord0) - 0.2;
  334. float noisy = tex2D(sampler1bilinwrap, indata.TexCoord1) - 0.5;
  335. float4 image = dot(float3(0.3,0.59,0.11), tex2D(sampler0bilin, indata.TexCoord2));
  336. outdata.Col0 = float4(tvColor,1) * (interference * rand + image);
  337. }
  338. else outdata.Col0 = tex2D(sampler0bilin, indata.TexCoord2);
  339. return outdata;
  340. }
  341.  
  342. //
  343. // TV Effect with usage of gradient texture
  344. //
  345.  
  346. PS2FB_Combine ps_TVEffect_Gradient_Tex(VS2PS_Quad3 indata)
  347. {
  348. PS2FB_Combine outdata;
  349. if ( interference >= 0 && interference <= 1 ) {
  350. float2 pos = indata.TexCoord0;
  351. float2 img = indata.TexCoord2;
  352. float rand = tex2D(sampler2bilinwrap, pos) - 0.2;
  353. float noisy = tex2D(sampler1bilinwrap, indata.TexCoord1) - 0.5;
  354. float dst = frac(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
  355. dst *= (1 - dst);
  356. dst /= 1 + distortionScale * abs(pos.y);
  357. img.x += distortionScale * noisy * dst;
  358. float4 image = dot(float3(0.3,0.59,0.11), tex2D(sampler0bilin, img));
  359. float4 intensity = (interference * rand + image * (1-tvAmbient) + tvAmbient);
  360. float4 gradient_col = tex2D(sampler3bilin, float2(intensity.r,0.f));
  361. outdata.Col0 = float4( gradient_col.rgb, intensity.a );
  362. }
  363. else outdata.Col0 = tex2D(sampler0bilin, indata.TexCoord2);
  364. return outdata;
  365. }
  366.  
  367. PS2FB_Combine ps_TVEffect13(VS2PS_Quad3 indata)
  368. {
  369. PS2FB_Combine outdata;
  370. if ( interference >= 0 && interference <= 1 ) {
  371. float rand = tex2D(sampler2bilinwrap, indata.TexCoord0) - 0.2;
  372. float4 image = dot(float3(0.3,0.59,0.11), tex2D(sampler0bilin, indata.TexCoord2));
  373. float4 intensity = (interference * rand + image);
  374. outdata.Col0 = intensity * float4(tvColor,1);
  375. }
  376. else outdata.Col0 = tex2D(sampler0bilin, indata.TexCoord2);
  377. return outdata;
  378. }
  379.  
  380. technique TVEffect
  381. {
  382. pass p0
  383. {
  384. ZEnable = FALSE;
  385. AlphaBlendEnable = FALSE;
  386. StencilEnable = FALSE;
  387.  
  388. VertexShader = compile vs_1_1 vs_TVEffect();
  389. #if !_FORCE_1_4_SHADERS_
  390. PixelShader = compile PS2_EXT ps_TVEffect20();
  391. #else
  392. PixelShader = compile LOWPSMODEL ps_TVEffect14();
  393. #endif
  394. }
  395. }
  396.  
  397. technique TVEffect_Gradient_Tex
  398. {
  399. pass p0
  400. {
  401. ZEnable = FALSE;
  402. AlphaBlendEnable = FALSE;
  403. StencilEnable = FALSE;
  404.  
  405. VertexShader = compile vs_1_1 vs_TVEffect();
  406. #if !_FORCE_1_4_SHADERS_
  407. PixelShader = compile ps_2_0 ps_TVEffect_Gradient_Tex();
  408. #else
  409. PixelShader = compile LOWPSMODEL ps_TVEffect14();
  410. #endif
  411. }
  412. }
  413.  
  414. //
  415. // Wave Distortion
  416. //
  417.  
  418. VS2PS_Quad2 vs_WaveDistortion( APP2VS_Quad indata )
  419. {
  420. VS2PS_Quad2 output;
  421.  
  422. output.Pos = float4(indata.Pos.xy, 0, 1);
  423. output.TexCoord0 = indata.TexCoord0;
  424.  
  425. output.TexCoord1 = indata.Pos.xy;
  426.  
  427. return output;
  428. }
  429.  
  430. const float4 filterkernelWD[8] = {
  431. -0.25, 0.25, 0, 0.125,
  432. 0.0, 0.25, 0, 0.125,
  433. 0.25, 0.25, 0, 0.125,
  434. -0.25, 0.0, 0, 0.125,
  435. 0,0.25, 0, 0.125,
  436. -0.25, -0.25, 0, 0.125,
  437. 0.0, -0.25, 0, 0.125,
  438. 0.25, -0.25, 0, 0.125,
  439. };
  440.  
  441. PS2FB_Combine ps_WaveDistortion(VS2PS_Quad2 indata)
  442. {
  443. PS2FB_Combine outdata;
  444.  
  445. float4 blur = float4(0,0,0,0);
  446. for(int i=0;i<8;i++)
  447. blur += filterkernelWD[i].w * tex2D(sampler0bilin, float2(indata.TexCoord0.x + 0.02 * filterkernelWD[i].x, indata.TexCoord0.y + 0.02 * filterkernelWD[i].y));
  448.  
  449. // float time = sin(time_0_X*2)/8+1.3;
  450. float2 tcxy = indata.TexCoord0;
  451. float2 xyopacity = float2(0.1*(4 * tcxy.x * tcxy.x - 4 * tcxy.x + 1.3),0.1*(4 * tcxy.y * tcxy.y - 4 * tcxy.y + 1.3));
  452. float opacity = (xyopacity.x/0.1 * xyopacity.y/0.1);
  453. opacity = clamp(opacity, 0.0, 1.0);
  454. float4 basecolor = tex2D(sampler0bilin, tcxy);
  455. float3 color = saturate(1.3*dot(float3(0.1,0.6,0.3),blur.rgb));
  456. color = 12*color - 6;
  457. color = 1/(1+pow(2.71828, -color));
  458. color = 12*color - 6;
  459. color = 1/(1+pow(2.71828, -color));
  460. float4 outcolor = float4(color.rgb, 1);
  461. outcolor = lerp(outcolor, basecolor, 0.25);
  462. outcolor = lerp(outcolor, float4(0,0,0,1), opacity);
  463.  
  464. outdata.Col0 = outcolor;
  465.  
  466. outdata.Col0.a = backbufferLerpbias;
  467. return outdata;
  468. }
  469.  
  470. technique WaveDistortion
  471. {
  472. pass p0
  473. {
  474. ZEnable = FALSE;
  475. AlphaBlendEnable = TRUE;
  476. AlphaTestEnable = FALSE;
  477. StencilEnable = FALSE;
  478. SrcBlend = SRCALPHA;
  479. DestBlend = INVSRCALPHA;
  480.  
  481. //PixelShaderConstant2[0] = <time_0_X>;
  482. //PixelShaderConstant1[1] = <deltaU>;
  483. //PixelShaderConstant1[2] = <deltaV>;
  484.  
  485. //TextureTransform[2] = <UpScaleTexBy8>;
  486.  
  487. VertexShader = compile vs_1_1 vs_WaveDistortion();
  488.  
  489.  
  490. PixelShader = compile PS2_EXT ps_WaveDistortion();
  491. }
  492. }
  493.  
  494. #if !_FORCE_1_3_SHADERS_
  495.  
  496. VS2PS_Quad2 vsDx9_Flashbang(APP2VS_Quad indata)
  497. {
  498. VS2PS_Quad2 outdata;
  499. outdata.Pos = vec4(indata.Pos.x, indata.Pos.y, 0, 1);
  500. outdata.TexCoord0 = indata.TexCoord0;
  501. outdata.TexCoord1 = indata.TexCoord0;
  502. return outdata;
  503. }
  504.  
  505. PS2FB_Combine psDx9_Flashbang(VS2PS_Quad2 indata)
  506. {
  507. PS2FB_Combine outdata;
  508. vec4 sample0 = tex2D(sampler0bilin, indata.TexCoord0);
  509. vec4 sample1 = tex2D(sampler1bilin, indata.TexCoord0);
  510. vec4 sample2 = tex2D(sampler2bilin, indata.TexCoord0);
  511. vec4 sample3 = tex2D(sampler3bilin, indata.TexCoord0);
  512.  
  513. vec4 acc = sample0 * 0.5;
  514. acc += sample1 * 0.25;
  515. acc += sample2 * 0.15;
  516. acc += sample3 * 0.10;
  517.  
  518. outdata.Col0 = acc;
  519. outdata.Col0.a = backbufferLerpbias;
  520. return outdata;
  521. }
  522.  
  523. #else
  524.  
  525. VS2PS_Quad4 vsDx9_Flashbang(APP2VS_Quad indata)
  526. {
  527. VS2PS_Quad4 outdata;
  528. outdata.Pos = vec4(indata.Pos.x, indata.Pos.y, 0, 1);
  529. outdata.TexCoord0 = indata.TexCoord0;
  530. outdata.TexCoord1 = indata.TexCoord0;
  531. outdata.TexCoord2 = indata.TexCoord0;
  532. outdata.TexCoord3 = indata.TexCoord0;
  533. return outdata;
  534. }
  535.  
  536. PS2FB_Combine psDx9_Flashbang(VS2PS_Quad4 indata)
  537. {
  538. PS2FB_Combine outdata;
  539. vec4 sample0 = tex2D(sampler0bilin, indata.TexCoord0);
  540. vec4 sample1 = tex2D(sampler1bilin, indata.TexCoord1);
  541. vec4 sample2 = tex2D(sampler2bilin, indata.TexCoord2);
  542. vec4 sample3 = tex2D(sampler3bilin, indata.TexCoord3);
  543.  
  544. vec4 acc = sample0 * 0.5;
  545. acc += sample1 * 0.25;
  546. acc += sample2 * 0.15;
  547. acc += sample3 * 0.10;
  548.  
  549. outdata.Col0 = acc;
  550. outdata.Col0.a = backbufferLerpbias;
  551. return outdata;
  552. }
  553. #endif
  554.  
  555. technique Flashbang
  556. {
  557. pass P0
  558. {
  559. ZEnable = FALSE;
  560. AlphaBlendEnable = TRUE;
  561. SrcBlend = SRCALPHA;
  562. DestBlend = INVSRCALPHA;
  563. StencilEnable = FALSE;
  564.  
  565. VertexShader = compile vs_1_1 vsDx9_Flashbang();
  566. PixelShader = compile LOWPSMODEL psDx9_Flashbang();
  567. }
  568. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement