Advertisement
Guest User

iceshader.fx

a guest
Jun 28th, 2011
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.24 KB | None | 0 0
  1. //
  2. //iCEnhancer.
  3. //Codes & Shaders are made by ICELAGLACE & DPEASANT3 & DKT70 & GP65CJ04 & BORIS
  4. //You steal, you die.
  5. //Edited by H1Vltg3
  6. ///////////////////////////////////////////////////////////////////////
  7. // sampler2D AdapLumSampler;
  8. // sampler2D BloomSampler;
  9. // float4 ColorCorrect;
  10. // float4 ColorShift;
  11. // float Exposure;
  12. // sampler2D GBufferTextureSampler2;
  13. // sampler2D GBufferTextureSampler3;
  14. // sampler2D HDRSampler;
  15. // sampler2D JitterSampler;
  16. // float PLAYER_MASK;
  17. // sampler2D StencilCopySampler;
  18. // float4 TexelSize;
  19. // float4 ToneMapParams;
  20. // float4 deSatContrastGamma;
  21. // float4 dofBlur;
  22. // float4 dofDist;
  23. // float4 dofProj;
  24. // float gDirectionalMotionBlurLength;
  25. // float4 globalScreenSize;
  26. // row_major float4x4 motionBlurMatrix;
  27. //
  28. //
  29. // Registers:
  30. //
  31. // Name Reg Size
  32. // ---------------------------- ----- ----
  33. // globalScreenSize c44 1
  34. // Exposure c66 1
  35. // motionBlurMatrix c72 4
  36. // TexelSize c76 1
  37. // dofProj c77 1
  38. // dofDist c78 1
  39. // dofBlur c79 1
  40. // gDirectionalMotionBlurLength c80 1
  41. // ToneMapParams c81 1
  42. // deSatContrastGamma c82 1
  43. // ColorCorrect c83 1
  44. // ColorShift c84 1
  45. // PLAYER_MASK c85 1
  46. // GBufferTextureSampler2 s0 1
  47. // GBufferTextureSampler3 s1 1
  48. // HDRSampler s2 1
  49. // BloomSampler s3 1
  50. // AdapLumSampler s4 1
  51. // JitterSampler s5 1
  52. // StencilCopySampler s6 1
  53.  
  54. //quad
  55. struct VS_OUTPUT_POST
  56. {
  57. float4 vpos : POSITION;
  58. float2 txcoord0 : TEXCOORD0;
  59. };
  60. struct VS_INPUT_POST
  61. {
  62. float3 pos : POSITION;
  63. float2 txcoord0 : TEXCOORD0;
  64. };
  65.  
  66. //int4 _i0 : register(i0);
  67.  
  68. /*
  69. float4 _c0 : register(c0);
  70. float4 _c1 : register(c1);
  71. float4 _c2 : register(c2);
  72. float4 _c3 : register(c3);
  73. float4 _c4 : register(c4);
  74. float4 _c5 : register(c5);
  75. float4 _c6 : register(c6);
  76. */
  77. float4 _c44 : register(c44);
  78. float4 _c66 : register(c66);
  79. float4 _c72 : register(c72);
  80. float4 _c73 : register(c73);
  81. float4 _c74 : register(c74);
  82. float4 _c75 : register(c75);
  83. float4 _c76 : register(c76);
  84. float4 _c77 : register(c77);
  85. float4 _c78 : register(c78);
  86. float4 _c79 : register(c79);
  87. float4 _c80 : register(c80);
  88. float4 _c81 : register(c81);
  89. float4 _c82 : register(c82);
  90. float4 _c83 : register(c83);
  91. float4 _c84 : register(c84);
  92. float4 _c85 : register(c85);
  93.  
  94. texture2D texColor;
  95. texture2D texs0 : register(s0);
  96. texture2D texs1 : register(s1);
  97. texture2D texs2 : register(s2);
  98. texture2D texs3 : register(s3);
  99. texture2D texs4 : register(s4);
  100. texture2D texs5 : register(s5);
  101. texture2D texs6 : register(s6);
  102. texture2D texs7 : register(s7);
  103. texture2D texs13 : register(s13);//palette
  104. texture2D texs15 : register(s15);
  105. //sampler2D s0=sampler_state { Texture=<texs0>; };
  106. //sampler2D s1=sampler_state { Texture=<texs1>; };
  107. sampler2D s2=sampler_state { Texture=<texs2>; };
  108. //sampler2D s3=sampler_state { Texture=<texs3>; };
  109. sampler2D s4=sampler_state { Texture=<texs4>; };
  110. //sampler2D s5=sampler_state { Texture=<texs5>; };//fixed
  111. sampler2D s6=sampler_state { Texture=<texs6>; };
  112. sampler2D s7=sampler_state { Texture=<texs7>; };
  113. //sampler2D s13=sampler_state { Texture=<texs13>; };
  114. sampler2D s15=sampler_state { Texture=<texs15>; };
  115.  
  116. //next samplers states fixing problems on ATI cards
  117. sampler2D s0 = sampler_state
  118. {
  119. Texture = <texs0>;
  120. MinFilter = LINEAR;//
  121. MagFilter = LINEAR;//
  122. MipFilter = NONE;//NONE;//LINEAR;
  123. AddressU = Clamp;
  124. AddressV = Clamp;
  125. SRGBTexture=FALSE;
  126. MaxMipLevel=0;
  127. MipMapLodBias=0;
  128. };
  129.  
  130. sampler2D s1 = sampler_state
  131. {
  132. Texture = <texs1>;
  133. MinFilter = LINEAR;//
  134. MagFilter = LINEAR;//
  135. MipFilter = NONE;//NONE;//LINEAR;
  136. AddressU = Clamp;
  137. AddressV = Clamp;
  138. SRGBTexture=FALSE;
  139. MaxMipLevel=0;
  140. MipMapLodBias=0;
  141. };
  142.  
  143. sampler2D s3 = sampler_state
  144. {
  145. Texture = <texs3>;
  146. MinFilter = LINEAR;//
  147. MagFilter = LINEAR;//
  148. MipFilter = NONE;//NONE;//LINEAR;
  149. AddressU = Clamp;
  150. AddressV = Clamp;
  151. SRGBTexture=FALSE;
  152. MaxMipLevel=0;
  153. MipMapLodBias=0;
  154. };
  155.  
  156. sampler2D s5 = sampler_state //fixed
  157. {
  158. Texture = <texs5>;
  159. MinFilter = LINEAR;
  160. MagFilter = LINEAR;
  161. MipFilter = NONE;
  162. AddressU = Wrap;
  163. AddressV = Wrap;
  164. SRGBTexture=FALSE;
  165. MaxMipLevel=0;
  166. MipMapLodBias=0;
  167. };
  168.  
  169. sampler2D s13 = sampler_state
  170. {
  171. Texture = <texs13>;
  172. MinFilter = LINEAR;
  173. MagFilter = LINEAR;
  174. MipFilter = NONE;
  175. AddressU = Clamp;
  176. AddressV = Clamp;
  177. SRGBTexture=FALSE;
  178. MaxMipLevel=0;
  179. MipMapLodBias=0;
  180. };
  181. sampler2D SamplerColor = sampler_state
  182. {
  183. Texture = <texColor>;
  184. MinFilter = LINEAR;
  185. MagFilter = LINEAR;
  186. MipFilter = NONE;//NONE;
  187. AddressU = Clamp;
  188. AddressV = Clamp;
  189. SRGBTexture=FALSE;
  190. };
  191.  
  192. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  193. //
  194. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  195. float4 PS_C215BE6E(VS_OUTPUT_POST IN) : COLOR
  196. {
  197. float4 _oC0=0.0; //output
  198.  
  199. float4 _c0=float4(0, 0.212500006, 0.715399981, 0.0720999986);
  200. float4 _c1=float4(0.25, 1, 256, 0);
  201. float4 _c2=float4(0, 2, 4, 8);
  202. float4 _c3=float4(58.1640015, 47.1300011, 0, 0);
  203. float4 _c4=float4(-0.5, -1.5, 1.5, 0.5);
  204. float4 _c5=float4(2, -1, 0.125, 0);
  205. float4 _c6=float4(256, 2, 4, 8);
  206. float4 _c7=float4(1.0, 0.1, 0.8, 1.0);
  207. float4 _c8=float4(0.0, 0.1, 0.8, 0.333);
  208. float4 _c9=float4(0.06, 0.1, 0.8, 0.1);
  209. float4 _c10=float4(0.01, 1.4, 0.0, 0.32);
  210. float4 _c11=float4(0.333333, 1.0, 0.0, 0.0);
  211. float4 _c12=float4(0.27, 0.67, 0.06, 0.0);
  212. float4 _c13=float4(0.0, 0.0, 0.0, 0.00001);
  213. float4 _c150=float4(0.55, 0.9, 0.85, 0.9);
  214. float4 _c195=float4(0.0, 0.0, 0.0, 0.07);//0.7
  215.  
  216.  
  217. float4 r0;
  218. float4 r1;
  219. float4 r2;
  220. float4 r3;
  221. float4 r4;
  222. float4 r5;
  223. float4 r6;
  224. float4 r7;
  225. float4 r8;
  226. float4 r9;
  227. float4 r10;
  228. float4 r11;
  229.  
  230.  
  231. float4 _v0=0.0;
  232. _v0.xy=IN.txcoord0.xy;
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241. float stealers = 1.5;
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252. float hackers = 0.4;
  253.  
  254. float2 center;
  255. float distance;
  256. float focus;
  257. float boom;
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264. float genital;
  265. float puddi;
  266. float bugs;
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. float nyan;
  283.  
  284. float sampleradius = 0.05;
  285. float bastardradius = 10.0;
  286. float stupidradius = 10.0;
  287.  
  288. r3=_c4; //-0.5, -1.5, 1.5, 0.5
  289.  
  290. const float2 d_offset[25]=
  291. {
  292. float2(0.9659, 0.2588),
  293. float2(0.8660, 0.5000),
  294. float2(0.7071, 0.7071),
  295. float2(0.5000, 0.8660),
  296.  
  297.  
  298. float2(0.2588, 0.9659),
  299. float2(0.0, 1.0),
  300. float2(-0.2588, 0.9659),
  301. float2(-0.5000, 0.8660),
  302. float2(-0.7071, 0.7071),
  303.  
  304.  
  305. float2(-0.8660, 0.5000),
  306. float2(-0.9659, 0.2588),
  307. float2(-1.0, 0.0),
  308. float2(-0.9659, -0.2588),
  309. float2(-0.8660, -0.5000),
  310. float2(-0.7071, -0.7071),
  311. float2(-0.5000, -0.8660),
  312. float2(-0.2588, -0.9659),
  313. float2(0.0, -1.0),
  314. float2(0.2588, 0.9659),
  315. float2(0.5000, 0.8660),
  316. float2(0.7071, 0.7071),
  317. float2(0.8660, 0.5000),
  318. float2(0.9659, 0.2588),
  319.  
  320.  
  321. float2(1.0, 0.0),
  322. float2(0.0, 0.0)
  323. };
  324.  
  325.  
  326. float distsum = 0;
  327.  
  328. for(int i=0; i < 25; i++)
  329. {
  330. r0 = tex2D(s1, 0.5 + d_offset[i] * sampleradius);
  331. r0.y=-_c77.x + _c77.y; //-genitalProj.x + genitalProj.y
  332. r0.y=1.0/r0.y;
  333. r0.z=r0.y * _c77.y; //genitalProj.y
  334. r0.z=r0.z * -_c77.x; //genitalProj.x
  335. r0.x=_c77.y * -r0.y + r0.x;
  336. r0.x=1.0/r0.x;
  337.  
  338. distance=r0.z * r0.x - _c78.w; //genitalDist.w
  339. distance+=_c78.y * -r3.w; //genitalDist.y
  340. distance+=140;//offset
  341.  
  342. distsum += distance;
  343. }
  344.  
  345. puddi = distance;
  346.  
  347. distsum *= 0.04;
  348. bugs = abs(distsum - puddi);
  349.  
  350.  
  351. r0=tex2D(s1, _v0.xy); //GBufferTextureSampler3
  352. r0.y=-_c77.x + _c77.y; //-genitalProj.x + genitalProj.y
  353. r0.y=1.0/r0.y;
  354. r0.z=r0.y * _c77.y; //genitalProj.y
  355. r0.z=r0.z * -_c77.x; //genitalProj.x
  356. r0.x=_c77.y * -r0.y + r0.x;
  357. r0.x=1.0/r0.x;
  358. r0.y=r0.z * r0.x;
  359.  
  360. r0.w=abs(_c79.w);
  361.  
  362.  
  363. distance = r0.z * r0.x - _c78.w; //genitalDist.w
  364. distance += _c78.y * -r3.w; //genitalDist.y
  365. distance += 140;//offset
  366.  
  367. center.x = _v0.x-0.5;
  368. center.y = 0.5-_v0.y;
  369. focus = length(center.xy)*1.41421;
  370. focus = pow(focus,2);
  371. focus *= stealers;
  372.  
  373. boom = saturate((distance - 25)*0.0025) * 0.8;
  374.  
  375. if(distance < 25)
  376. {
  377. boom = 1.0;
  378. genital = hackers;
  379. }
  380. else genital = stealers;
  381.  
  382. stupidradius = 1 / stupidradius;
  383.  
  384. if(bugs < bastardradius)
  385. {
  386. genital = stealers;
  387. nyan = abs(distance - puddi);
  388. nyan = saturate(nyan * stupidradius);
  389. }
  390. else nyan = boom;
  391.  
  392. if(puddi > 50) nyan = boom;
  393.  
  394.  
  395. float2 off_c76 = _c76.xy * min(genital + focus, stealers);
  396.  
  397.  
  398. r1=tex2D(s2, _v0.xy); //HDRSampler
  399. r2=tex2D(s3, _v0.xy); //BloomSampler
  400.  
  401. r4.xy=off_c76.xy * r3.xy + _v0.xy; //TexelSize.xy
  402. r4=tex2D(s2, r4.xy); //HDRSampler
  403.  
  404. r5.xy=off_c76.xy * r3.zx + _v0.xy; //TexelSize.xy
  405. r5=tex2D(s2, r5.xy); //HDRSampler
  406.  
  407. r3.xz=off_c76.xy * r3.wz + _v0.xy; //TexelSize.xy
  408. r6=tex2D(s2, r3.xz); //HDRSampler
  409.  
  410. r3.xy=off_c76.xy * r3.yw + _v0; //TexelSize.xy
  411. r7=tex2D(s2, r3.xy); //HDRSampler
  412.  
  413.  
  414. r1.w=dot(r4.xyz, r4.xyz);
  415. r1.w=1.0/r1.w;
  416. if (-r1.w<0.0)
  417. {
  418. r3.xyz=r4.xyz;
  419. } else r3.xyz=_c0.x;
  420.  
  421. r1.w=dot(r5.xyz, r5.xyz); //dp3
  422. r1.w=1.0/r1.w;
  423. if (-r1.w<0.0)
  424. {
  425. r4.xyz=r5.xyz;
  426. } else r4.xyz=_c0.x;
  427.  
  428. r1.w=dot(r6.xyz, r6.xyz); //dp3
  429. r1.w=1.0/r1.w;
  430. if (-r1.w<0.0)
  431. {
  432. r5.xyz=r6.xyz;
  433. } else r5.xyz=_c0.x;
  434.  
  435. r1.w=dot(r7.xyz, r7.xyz); //dp3
  436. r1.w=1.0/r1.w;
  437. if (-r1.w<0.0)
  438. {
  439. r6.xyz=r7.xyz;
  440. } else r6.xyz=_c0.x;
  441.  
  442. r1.w=dot(r1.xyz, r1.xyz); //dp3
  443. r1.w=1.0/r1.w;
  444. if (-r1.w<0.0)
  445. {
  446. r7.xyz=r1.xyz;
  447. } else r7.xyz=_c0.x;
  448.  
  449. r0.x=r0.z * r0.x - _c78.w; //genitalDist.w
  450. r0.x=_c78.y * -r3.w + r0.x; //genitalDist.y
  451. r1.w=max(r0.x, _c0.x); //0.0
  452. r0.x=1.0/_c78.z; //genitalDist.z
  453. r0.x=r1.w * r0.x;
  454. r1.w=lerp(_c79.y, _c79.z, r0.x);//genitalBlur
  455. r0.x=min(_c79.z, r1.w); //genitalBlur.z
  456.  
  457. r0.z=dot(r7.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  458. r8.x=dot(r3.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  459. r8.y=dot(r4.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  460. r8.z=dot(r5.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  461. r8.w=dot(r6.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  462. r1.w=dot(r8, _c1.xxxx); //0.25
  463.  
  464. r8=r8 - r1.w;
  465. r2.w=dot(r8, r8);
  466. r0.z=r0.z - r1.w;
  467. r0.z=r0.z * r0.z - r2.w;
  468. r0.x=r0.x*r0.x;
  469. if (r0.z<0.0)
  470. {
  471. r0.x=r0.x;
  472. } else r0.x=_c1.y; //1.0
  473.  
  474.  
  475. r8=tex2D(s0, _v0.xy); //GBufferTextureSampler2
  476.  
  477.  
  478. r8.yz=_c1.yz; // 1.0, 256.0
  479. r9=r8.w * -r8.z + _c2; //0, 2, 4, 8
  480. if (r9.w<0.0) //r9<0.0
  481. {
  482. r9=_c1.w; //0.0
  483. } else r9=_c1.y; //1.0
  484. //r9 is filtered sky mask
  485. float sky = r9.x;
  486.  
  487. //r10=r8.w + tempc6;//c6.yzwx; //256, 2, 4, 8
  488. r10=r8.w * -_c6.x + _c6.yzwx; //256, 2, 4, 8
  489.  
  490.  
  491. if (r10.x<0.0)
  492. {
  493. r10.x=-_c1.w; //0.0
  494. } else r10.x=-_c1.y; //1.0
  495.  
  496. if (r10.y<0.0)
  497. {
  498. r10.y=-_c1.w; //0.0
  499. } else r10.y=-_c1.y; //1.0
  500.  
  501. if (r10.z<0.0)
  502. {
  503. r10.z=-_c1.w; //0.0
  504. } else r10.z=-_c1.y; //1.0
  505.  
  506. if (r10.w<0.0)
  507. {
  508. r10.w=-_c1.w; //0.0
  509. } else r10.w=-_c1.y; //1.0
  510.  
  511.  
  512. r9=r9 + r10;
  513. r9=r9 * _c4.x; //-0.5
  514.  
  515.  
  516. r0.z=dot(r9, _c1.yyyy); //1.0
  517. r0.z=r0.z + _c4.w; //0.5
  518. r0.z=1.0/r0.z;
  519. r8.xzw=r3.xyz * r9.x;
  520.  
  521.  
  522. r7.xyz=r7 * _c4.w + r8.xzw; //0.5
  523. r7.xyz=r4 * r9.y + r7;
  524. r7.xyz=r5 * r9.z + r7;
  525. r7.xyz=r6 * r9.w + r7;
  526. r7.xyz=r0.z * r7;
  527. r0.z=_c1.y - r0.x; //1.0
  528. r1.w=r0.x * _c1.x; //0.25
  529.  
  530.  
  531. r3.xyz=r3 * r1.w;
  532. r3.xyz=r7 * r0.z + r3;
  533. r3.xyz=r4 * r1.w + r3;
  534. r3.xyz=r5 * r1.w + r3;
  535. r3.xyz=r6 * r1.w + r3;
  536.  
  537.  
  538. r4.xyz=_v0.yxy * _c5.x + _c5.y; //2, -1
  539. // r4.x=_v0.y * _c5.x + _c5.y;
  540. // r4.y=_v0.x * _c5.x + _c5.y;
  541. // r4.z=_v0.y * _c5.x + _c5.y;
  542.  
  543. r0.z=r4.y * _c77.z; //genitalProj.z
  544. r0.z=r0.y * r0.z;
  545. r1.w=-r4.x * _c77.w; //genitalProj.w
  546. r1.w=r0.y * r1.w;
  547. r5.xyz=r1.w * _c73; //motionBlurMatrix.2
  548. r5.xyz=r0.z * _c72 + r5; //motionBlurMatrix.1
  549. r5.xyz=-r0.y * _c74 + r5; //motionBlurMatrix.3
  550. r5.xyz=r5 + _c75; //motionBlurMatrix.4
  551. r0.y=-r5.z * _c77.z; //genitalProj.z
  552. r6.x=r5.x / r0.y;
  553. r0.y=r5.z * _c77.w; //genitalProj.w
  554. r6.y=r5.y / r0.y;
  555. //r0.yz=-r4 + r6.xy;
  556. r0.yz=r6.xy - r4.yz;
  557.  
  558. //r0.yz=r0 * _c80.x; //gDirectionalMotionBlurLength.x
  559. r0.y=r0.y * _c80.x;
  560. r0.z=r0.z * _c80.x;
  561. r4.xy=r0.yz * _c5.z; //0.125
  562. r5=tex2D(s6, _v0.xy); //StencilCopySampler
  563. r1.w=r5.x - _c85.x; //PLAYER_MASK.x
  564. r4.zw=r3.xy * _c2.w; //8.0
  565. r4.zw=_v0.xy * _c3.xy + r4.zw; //58.1640015, 47.1300011
  566. r5=tex2D(s5, r4.zw); //JitterSampler
  567. r2.w=r5.x + _c4.x; //-0.5
  568. r4.zw=r4.xy * r2.w*2.0 + _v0.xy; //0.082 fixed
  569. r5.xyz=r3.xyz;
  570. r2.w=_c1.y; //1.0
  571. r3.w=_c1.y; //1.0
  572.  
  573. for (int iii=0; iii<7; iii++)
  574. {
  575. // r6.xy=r4 * r3.w + r4.zwzw; //v0
  576. r6.x=r4.x * r3.w + r4.z; //v2
  577. r6.y=r4.y * r3.w + r4.w; //v2
  578. r7=tex2D(s6, r6.xy);
  579. r5.w=r7.x - _c85.x;
  580. if (r5.w<0.0)
  581. {
  582. r5.w=_c1.y; //1.0
  583. } else r5.w=_c1.w; //0.0
  584. r6=tex2D(s2, r6.xy);
  585. r5.xyz=r6.xyz * r5.w + r5.xyz;
  586. r2.w=r2.w + r5.w;
  587. r3.w=r3.w + _c1.y; //1.0
  588. }
  589.  
  590.  
  591.  
  592. r2.w=1.0/r2.w;
  593.  
  594. //r0.yz=r0 * _c44.xxyw; //globalScreenSize
  595. r0.y=r0.y * _c44.x; //globalScreenSize
  596. r0.z=r0.z * _c44.y; //globalScreenSize
  597.  
  598. r0.y=dot(r0.yz, r0.yz)+_c0.x;//dp2
  599.  
  600. //r0.y=sqrt(r0.y);
  601. //r0.y=1.0/r0.y;
  602. r0.y=pow(r0.y, _c4.w); //0.5
  603.  
  604. r0.y=r0.y * _c4.w; //0.5
  605. r0.x=r0.x + _c1.y; //1.0
  606. r0.x=1.0/r0.x;
  607. //r0.y is wrong
  608. r0.x=saturate(r0.y * r0.x);
  609. r4.xyz=r5 * r2.w - r3;
  610. r0.xyz=r0.x * r4 + r3;
  611.  
  612. //_oC0.xyz=0.5*r0.xyz;
  613.  
  614. if (-r1.w<0.0) r0.xyz=r3.xyz;
  615. if (-r0.w<0.0) r0.xyz=r1.xyz;
  616.  
  617.  
  618. float4 origcolor = tex2D(s2, _v0.xy);
  619.  
  620. r0 = lerp(origcolor, r0, nyan);
  621.  
  622.  
  623. r11=r0;
  624.  
  625.  
  626. r1=tex2D(s4, _c0.x); //AdapLumSampler , 0.0
  627. r0.w=1.0/r1.x;
  628. r0.w=r0.w * _c81.y; //ToneMapParams.y
  629. r1.x=1.0/r0.w;
  630. r1.x=r1.x * _c81.x; //ToneMapParams.x
  631. r1.xyz=r2 * _c66.x - r1.x; //Exposure.x
  632. r2.xyz=max(r1, _c0.x); //0.0
  633. r1.xyz=r2 * _c81.z; //ToneMapParams.z
  634. r1.xyz=r1 * _c1.x; //0.25
  635. r0.xyz=r0 * _c66.x + r1; //Exposure.x
  636. r1.xyz=r0.w * r0;
  637. r1.x=dot(r1.xyz, _c0.yzw); //0.2125, 0.7154, 0.0721
  638. r0.xyz=r0 * r0.w - r1.x;
  639. r0.xyz=_c82.x * r0 + r1.x; //deSatContrastGamma.x
  640. r0.w=r1.x * _c84.w; //ColorShift.w
  641. r1.yzw=r0.w * _c84.xxyz; //ColorShift
  642.  
  643. //darken as DarkeningAmount, but keeps colors
  644. r2.x=saturate(r0.w);
  645. r0.xyz=r0.xyz - _c84.xyz * r0.w; //ColorShift
  646. r0.xyz=r2.x * r0.xyz + r1.yzww;
  647. r0.xyz=1.85 * r0.xyz * _c83.xyz; //ColorCorrect
  648. r1.x=saturate(r1.x);
  649. r0.w=_c82.z - r8.y; //deSatContrastGamma.z
  650. r2.x=pow(r1.x, r0.w);
  651.  
  652. _oC0.xyz=r0.xyz * r2.x; //orig
  653. _oC0.w=_c1.y; //1.0
  654. ///////////////////////////////////////////////
  655. //////////////////// Here starts Dpeasant3's code
  656. //////////////////// All credits goes to him
  657. ///////////////////////////////////////////////
  658. float EColorSaturation=1.12;
  659. float luma=dot(r0.xyz,_c12.xyz);
  660. float cgray=dot(r0.xyz, 0.333);//luma
  661. float3 poweredcolor=pow(r0.xyz, EColorSaturation);
  662. float newgray=dot(poweredcolor.xyz, 0.333);
  663. r0.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  664.  
  665. r5=tex2D(s4, _c0.x);
  666. r0=r11+r0*0.4;
  667. r5.w=r5.x;
  668. r5.w=1.0/r5.w;
  669. r0.xyz=r0 * r5.w;
  670. r3.xy=_c10.xwxw;
  671. r3.xy=r3.xy * r5.w;
  672. r7=tex2D(s3, _v0.xy);
  673.  
  674. EColorSaturation=1.0;
  675. luma=dot(r7.xyz,_c12.xyz);
  676. cgray=dot(r7.xyz, 0.333);//luma
  677. poweredcolor=pow(r7.xyz, EColorSaturation);
  678. newgray=dot(poweredcolor.xyz, 0.333);
  679. r7.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  680. r7*=1.5+clamp(distance*0.0006,0.0,0.4);
  681.  
  682. r10=dot(r0.xyz, _c12.xyz);
  683. r10=r10*0.4;
  684. r0=r0*r10;
  685. r0=(pow(r0*2,0.31))*0.3+r0*0.7;
  686. r0=r0 * _c7.y; //pre multiply
  687. r1=r0 * _c7.z; //e multiply
  688. r1=r1+_c7.w;
  689. r1.xyz=1.0/r1.xyz;
  690. r0=r0*r1;
  691. r0=0.4*r7 * r3.x + r0; //c10.x //bloomadditive
  692. r0=(1-pow(2.4,-r0))*0.5+r0*0.5+(pow(2,-r0*2))*0.043;
  693. float middlegray=(r0.r+r0.g+r0.b)*0.333; //dot(r0.xyz, 0.333); //dot(r0.xyz, float3(0.27, 0.67, 0.06));
  694. float3 diffcolor=r0.rgb-middlegray;
  695. r0.rgb+=diffcolor*0.6;//
  696. float3 correctedcolor=saturate((0.99-r0*0.15)*0.06);
  697. r0.rgb=saturate(r0.rgb-correctedcolor)*0.96;
  698. if(distance>2600)
  699. {
  700. r0.rgb=pow(r0.rgb,0.75)*1.07;
  701. }
  702. else r0.rgb=pow(r0.rgb,0.695)*1.07;
  703.  
  704. ///////////////////////////////////////////////
  705. ////////////////////Dpeasant3's HDR Tone mapping from DKT70 untouched , perfect like that.
  706. ////////////////////Credits for DKT70.
  707. ///////////////////////////////////////////////
  708.  
  709. float Defog=0.04;
  710. float4 FogColor={0.33, 0.3, 0.3, 0.0};
  711. float4 FogColor2={10.53, 0.3, 0.3, 0.0}; //
  712. float Exposure=-0.04;
  713. float Exposure2=100.04;
  714. float BlueShift=0.1;
  715.  
  716. r0.rgb = max(0, r0.rgb - Defog * FogColor.rgb);
  717. r0.rgb *= pow(2.0f, Exposure);
  718. float3 d = r0.rgb * float3(1.05f, 0.97f, 1.27f);
  719. r0.rgb = lerp(r0.rgb, d, BlueShift);
  720. r0.xyz=r0.xyz*0.6+sin(r0.xyz*3.14*0.5)*0.4;
  721.  
  722.  
  723. float saliva = 0.5;
  724. luma = dot(r0.xyz, _c12.xyz);
  725. float3 blend = luma.xxx;
  726. float L = min(1, max(0, 10*(luma - 0.45)));
  727. float3 result1 = 2.0 * r0.xyz * blend;
  728. float3 result2 = 1.0 - 2.0*(1.0 - blend)*(1.0 - r0.xyz);
  729. float3 newColor = lerp(result1.xyz, result2.xyz, L);
  730. float3 flows = saliva * newColor.xyz;
  731. flows += ((1.0f - saliva) * r0.xyz);
  732. r0.xyz = flows;
  733. focus = length(center.xy)*1.41421;
  734. focus = pow(focus, 4);
  735. r0.xyz -= focus*0.3;
  736. r0.xyz = saturate(r0.xyz);
  737. _oC0.xyz=r0.xyz;
  738. return _oC0;
  739. }
  740.  
  741. technique Shader_C215BE6E
  742. {
  743. pass p0
  744. {
  745. PixelShader = compile ps_3_0 PS_C215BE6E();
  746. }
  747. }
  748.  
  749.  
  750.  
  751.  
  752.  
  753. technique Shader_ORIGINALPOSTPROCESS
  754. {
  755. pass p0
  756. {
  757.  
  758. PixelShader=
  759. asm
  760. {
  761. //
  762. // Generated by Microsoft (R) HLSL Shader Compiler 9.23.949.2378
  763. //
  764. // Parameters:
  765. //
  766. // sampler2D AdapLumSampler;
  767. // sampler2D BloomSampler;
  768. // float4 ColorCorrect;
  769. // float4 ColorShift;
  770. // float Exposure;
  771. // sampler2D GBufferTextureSampler2;
  772. // sampler2D GBufferTextureSampler3;
  773. // sampler2D HDRSampler;
  774. // sampler2D JitterSampler;
  775. // float PLAYER_MASK;
  776. // sampler2D StencilCopySampler;
  777. // float4 TexelSize;
  778. // float4 ToneMapParams;
  779. // float4 deSatContrastGamma;
  780. // float4 dofBlur;
  781. // float4 dofDist;
  782. // float4 dofProj;
  783. // float gDirectionalMotionBlurLength;
  784. // float4 globalScreenSize;
  785. // row_major float4x4 motionBlurMatrix;
  786. //
  787. //
  788. // Registers:
  789. //
  790. // Name Reg Size
  791. // ---------------------------- ----- ----
  792. // globalScreenSize c44 1
  793. // Exposure c66 1
  794. // motionBlurMatrix c72 4
  795. // TexelSize c76 1
  796. // dofProj c77 1
  797. // dofDist c78 1
  798. // dofBlur c79 1
  799. // gDirectionalMotionBlurLength c80 1
  800. // ToneMapParams c81 1
  801. // deSatContrastGamma c82 1
  802. // ColorCorrect c83 1
  803. // ColorShift c84 1
  804. // PLAYER_MASK c85 1
  805. // GBufferTextureSampler2 s0 1
  806. // GBufferTextureSampler3 s1 1
  807. // HDRSampler s2 1
  808. // BloomSampler s3 1
  809. // AdapLumSampler s4 1
  810. // JitterSampler s5 1
  811. // StencilCopySampler s6 1
  812. //
  813.  
  814. ps_3_0
  815. def c0, 0, 0.212500006, 0.715399981, 0.0720999986
  816. def c1, 0.25, 1, 256, 0
  817. def c2, 0, 2, 4, 8
  818. def c3, 58.1640015, 47.1300011, 0, 0
  819. def c4, -0.5, -1.5, 1.5, 0.5
  820. def c5, 2, -1, 0.125, 0
  821. def c6, 256, 2, 4, 8
  822. def c180, 0.0, 0.0, 0.0, 100.5
  823. def c181, 1.0, 0.0, 0.0, 20.01
  824. def c183, 800.0, 600.0, 0.0, 100.5
  825. defi i0, 7, 0, 0, 0
  826. dcl_texcoord v0.xy
  827. dcl_2d s0
  828. dcl_2d s1
  829. dcl_2d s2
  830. dcl_2d s3
  831. dcl_2d s4
  832. dcl_2d s5
  833. dcl_2d s6
  834. texld r0, v0, s1
  835. add r0.y, -c77.x, c77.y
  836. rcp r0.y, r0.y
  837. mul r0.z, r0.y, c77.y
  838. mul r0.z, r0.z, -c77.x
  839. mad r0.x, c77.y, -r0.y, r0.x
  840. rcp r0.x, r0.x
  841. mul r0.y, r0.z, r0.x
  842. texld r1, v0, s2
  843. texld r2, v0, s3
  844. abs r0.w, c79.w
  845. mov r3, c4
  846. mad r4.xy, c76, r3, v0
  847. texld r4, r4, s2
  848. mad r5.xy, c76, r3.zxzw, v0
  849. texld r5, r5, s2
  850. mad r3.xz, c76.xyyw, r3.wyzw, v0.xyyw
  851. texld r6, r3.xzzw, s2
  852. mad r3.xy, c76, r3.ywzw, v0
  853. texld r7, r3, s2
  854. dp3 r1.w, r4, r4
  855. rcp r1.w, r1.w
  856. cmp r3.xyz, -r1.w, c0.x, r4
  857. dp3 r1.w, r5, r5
  858. rcp r1.w, r1.w
  859. cmp r4.xyz, -r1.w, c0.x, r5
  860. dp3 r1.w, r6, r6
  861. rcp r1.w, r1.w
  862. cmp r5.xyz, -r1.w, c0.x, r6
  863. dp3 r1.w, r7, r7
  864. rcp r1.w, r1.w
  865. cmp r6.xyz, -r1.w, c0.x, r7
  866. dp3 r1.w, r1, r1
  867. rcp r1.w, r1.w
  868. cmp r7.xyz, -r1.w, c0.x, r1
  869. mad r0.x, r0.z, r0.x, -c78.w
  870. mad r0.x, c78.y, -r3.w, r0.x
  871. max r1.w, r0.x, c0.x
  872. rcp r0.x, c78.z
  873. mul r0.x, r1.w, r0.x
  874. lrp r1.w, r0.x, c79.z, c79.y
  875. min r0.x, c79.z, r1.w
  876. dp3 r0.z, r7, c0.yzww
  877. dp3 r8.x, r3, c0.yzww
  878. dp3 r8.y, r4, c0.yzww
  879. dp3 r8.z, r5, c0.yzww
  880. dp3 r8.w, r6, c0.yzww
  881. dp4 r1.w, r8, c1.x
  882. add r8, r8, -r1.w
  883. dp4 r2.w, r8, r8
  884. add r0.z, r0.z, -r1.w
  885. mad r0.z, r0.z, r0.z, -r2.w
  886. mul r0.x, r0.x, r0.x
  887. cmp r0.x, r0.z, c1.y, r0.x
  888. texld r8, v0, s0
  889. mov r8.yz, c1
  890. mad r9, r8.w, -r8.z, c2
  891. cmp r9, r9, c1.y, c1.w
  892. mad r10, r8.w, -c6.x, c6.yzwx
  893. cmp r10, r10, -c1.y, -c1.w
  894. add r9, r9, r10
  895. mul r9, r9, c4.x
  896. dp4 r0.z, r9, c1.y
  897. add r0.z, r0.z, c4.w
  898. rcp r0.z, r0.z
  899. mul r8.xzw, r3.xyyz, r9.x
  900. mad r7.xyz, r7, c4.w, r8.xzww
  901. mad r7.xyz, r4, r9.y, r7
  902. mad r7.xyz, r5, r9.z, r7
  903. mad r7.xyz, r6, r9.w, r7
  904. mul r7.xyz, r0.z, r7
  905. add r0.z, -r0.x, c1.y
  906. mul r1.w, r0.x, c1.x
  907. mul r3.xyz, r3, r1.w
  908. mad r3.xyz, r7, r0.z, r3
  909. mad r3.xyz, r4, r1.w, r3
  910. mad r3.xyz, r5, r1.w, r3
  911. mad r3.xyz, r6, r1.w, r3
  912. mad r4.xyz, v0.yxyw, c5.x, c5.y
  913. mul r0.z, r4.y, c77.z
  914. mul r0.z, r0.y, r0.z
  915. mul r1.w, -r4.x, c77.w
  916. mul r1.w, r0.y, r1.w
  917. mul r5.xyz, r1.w, c73
  918. mad r5.xyz, r0.z, c72, r5
  919. mad r5.xyz, -r0.y, c74, r5
  920. add r5.xyz, r5, c75
  921. mul r0.y, -r5.z, c77.z
  922. rcp r0.y, r0.y
  923. mul r6.x, r5.x, r0.y
  924. mul r0.y, r5.z, c77.w
  925. rcp r0.y, r0.y
  926. mul r6.y, r5.y, r0.y
  927. add r0.yz, -r4, r6.xxyw
  928. mul r0.yz, r0, c80.x
  929. mul r4.xy, r0.yzzw, c5.z
  930. texld r5, v0, s6
  931. add r1.w, r5.x, -c85.x
  932. mul r4.zw, r3.xyxy, c2.w
  933. mad r4.zw, v0.xyxy, c3.xyxy, r4
  934. texld r5, r4.zwzw, s5
  935. add r2.w, r5.x, c4.x
  936. mad r4.zw, r4.xyxy, r2.w, v0.xyxy
  937. mov r5.xyz, r3
  938. mov r2.w, c1.y
  939. mov r3.w, c1.y
  940.  
  941. rep i0
  942. mad r6.xy, r4, r3.w, r4.zwzw
  943. texld r7, r6, s6
  944. add r5.w, r7.x, -c85.x
  945. cmp r5.w, r5.w, c1.w, c1.y
  946. texld r6, r6, s2
  947. mad r5.xyz, r6, r5.w, r5
  948. add r2.w, r2.w, r5.w
  949. add r3.w, r3.w, c1.y
  950. endrep
  951.  
  952. rcp r2.w, r2.w
  953. mul r0.yz, r0, c183.xxyw//c44.xxyw
  954. dp2add r0.y, r0.yzzw, r0.yzzw, c0.x
  955. rsq r0.y, r0.y
  956. rcp r0.y, r0.y
  957. mul r0.y, r0.y, c4.w
  958. add r0.x, r0.x, c1.y
  959. rcp r0.x, r0.x
  960. mul_sat r0.x, r0.y, r0.x
  961. mad r4.xyz, r5, r2.w, -r3
  962. mad r0.xyz, r0.x, r4, r3
  963. cmp r0.xyz, r1.w, r3, r0
  964. cmp r0.xyz, -r0.w, r0, r1
  965.  
  966. texld r1, c0.x, s4
  967. rcp r0.w, r1.x
  968. mul r0.w, r0.w, c81.y
  969. rcp r1.x, r0.w
  970. mul r1.x, r1.x, c81.x
  971. mad r1.xyz, r2, c66.x, -r1.x
  972. max r2.xyz, r1, c0.x
  973. mul r1.xyz, r2, c81.z
  974. mul r1.xyz, r1, c1.x
  975. mad r0.xyz, r0, c66.x, r1
  976. mul r1.xyz, r0.w, r0
  977. dp3 r1.x, r1, c0.yzww
  978. mad r0.xyz, r0, r0.w, -r1.x
  979. mad r0.xyz, c82.x, r0, r1.x
  980. mul r0.w, r1.x, c84.w
  981. mul r1.yzw, r0.w, c84.xxyz
  982. mov_sat r2.x, r0.w
  983. mad r0.xyz, c84, -r0.w, r0
  984. mad r0.xyz, r2.x, r0, r1.yzww
  985. mul r0.xyz, r0, c83
  986. add r0.xyz, r0, r0
  987. mov_sat r1.x, r1.x
  988. add r0.w, -r8.y, c82.z
  989. pow r2.x, r1.x, r0.w
  990. //mul r2.x, r2.x, c181.x
  991. mul oC0.xyz, r0, r2.x
  992. mov oC0.w, c1.y
  993.  
  994. //texld r1, v0, s2
  995. //mul oC0.xyz, r1, c199.z
  996. };
  997. }
  998. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement