Advertisement
Guest User

ssao1

a guest
Jul 21st, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.61 KB | None | 0 0
  1. ///////EFLC SERIES BY PORTAL2X2 BABY :D////////////////
  2. //////raigen,ice,Boris,dp3,AAA,fake,.........//
  3. /////HELPERS:DRON4ik194,Vlad_,OrangeBrains,AAA,dp3,gtf323,simple999,
  4. float DOFSizeMulti = 1; // Set this to 2 if you use SSAA
  5. float DOFAmount = 0.003;
  6. float ISaturation = 0.8;
  7. float IBrightness = 0.9;
  8.  
  9. float IContrast = 1.2;
  10.  
  11. float IWhiteAmount = 1;
  12. float BloomAmount = 0.035;
  13. float BloomAmountAdd = 0;
  14.  
  15. float BloomR = 1;
  16. float BloomG = 0.9;
  17. float BloomB = 0.8;
  18. float VignetteAmount = 0;
  19.  
  20. //////SSAO///////////////////////
  21. float Script : STANDARDSGLOBAL
  22. <
  23. string UIWidget = "none";
  24. string ScriptClass = "scene";
  25. string ScriptOrder = "postprocess";
  26. string ScriptOutput = "color";
  27. //string Script = "Technique=Main;";
  28. > = 0.8;
  29.  
  30. float2 ViewportSize : VIEWPORTPIXELSIZE
  31. <
  32. string UIName="Screen Size";
  33. string UIWidget="None";
  34. >;
  35.  
  36. // Standard full-screen imaging value
  37. float4 ClearColor
  38. <
  39. string UIWidget = "color";
  40. string UIName = "Clear (Bg) Color";
  41. > = {0,0,0,1.0};
  42.  
  43. float ClearDepth
  44. <
  45. string UIWidget = "None";
  46. > = 1.0;
  47.  
  48. float Near
  49. <
  50. string UIWidget = "slider";
  51. string UIName = "Near Plane";
  52. float UIMin = 0.0;
  53. float UIMax = 10.0;
  54. float UIStep = 0.00001;
  55. > = 1.0;
  56.  
  57. float Far
  58. <
  59. string UIWidget = "slider";
  60. string UIName = "Far Plane";
  61. float UIMin = 0.0;
  62. float UIMax = 100.0;
  63. float UIStep = 0.00001;
  64. > = 50.0;
  65.  
  66. float gTimer : TIME < string UIWidget = "None"; >;
  67.  
  68. ///////////////////////////////////////////////////////////
  69. ///////////////////////////// Render-to-Texture Targets ///
  70. ///////////////////////////////////////////////////////////
  71.  
  72. texture ScnMap : RENDERCOLORTARGET
  73. <
  74. float2 ViewPortRatio = {1.0,1.0};
  75. int MipLevels = 1;
  76. string Format = "X8R8G8B8" ;
  77. string UIWidget = "None";
  78. >;
  79.  
  80. sampler2D ScnSamp = sampler_state
  81. {
  82. Texture = <ScnMap>;
  83. MinFilter = LINEAR;//
  84. MagFilter = LINEAR;//
  85. MipFilter = NONE;//NONE;//LINEAR;
  86. AddressU = CLAMP;
  87. AddressV = CLAMP;
  88. SRGBTexture=FALSE;
  89. MaxMipLevel=0;
  90. MipMapLodBias=0;
  91. };
  92.  
  93. /*
  94. sampler2D ScnSamp = sampler_state
  95. {
  96. texture = <ScnMap>;
  97. //WrapS = ClampToEdge;
  98. //WrapT = ClampToEdge;
  99. MinFilter = ClampToEdge;//
  100. MagFilter = ClampToEdge;//
  101. MinFilter = linear;
  102. MagFilter = linear;
  103. };
  104. */
  105. texture DepthBuffer : RENDERDEPTHSTENCILTARGET
  106. <
  107. float2 ViewPortRatio = { 1.0, 1.0 };
  108. string Format = "D24S8";
  109. string UIWidget = "None";
  110. >;
  111.  
  112. sampler2D DepthSamp = sampler_state
  113. {
  114. Texture = <DepthBuffer>;
  115. MinFilter = LINEAR;//
  116. MagFilter = LINEAR;//
  117. MipFilter = NONE;//NONE;//LINEAR;
  118. AddressU = CLAMP;
  119. AddressV = CLAMP;
  120. SRGBTexture=FALSE;
  121. MaxMipLevel=0;
  122. MipMapLodBias=0;
  123. };
  124.  
  125. /*
  126. sampler2D DepthSamp = sampler_state
  127. {
  128. texture = <DepthBuffer>;
  129. //WrapS = ClampToEdge;
  130. //WrapT = ClampToEdge;
  131. MinFilter = ClampToEdge;//
  132. MagFilter = ClampToEdge;//
  133. MinFilter = linear;
  134. MagFilter = linear;
  135. };
  136. */
  137.  
  138. float readDepth( in float2 coord )
  139. {
  140. return( ( 2.0 * Near ) / ( Far + Near - tex2D( DepthSamp, coord ).x * ( Far - Near ) ) );
  141. }
  142.  
  143. // sampler2D AdapLumSampler;
  144. // sampler2D BloomSampler;
  145. // float4 ColorCorrect;
  146. // float4 ColorShift;
  147. // float Exposure;
  148. // sampler2D GBufferTextureSampler2;
  149. // sampler2D GBufferTextureSampler3;
  150. // sampler2D HDRSampler;
  151. // sampler2D JitterSampler;
  152. // float PLAYER_MASK;
  153. // sampler2D StencilCopySampler;
  154. // float4 TexelSize;
  155. // float4 ToneMapParams;
  156. // float4 deSatContrastGamma;
  157. // float4 dofBlur;
  158. // float4 dofDist;
  159. // float4 dofProj;
  160. // float gDirectionalMotionBlurLength;
  161. // float4 globalScreenSize;
  162. // row_major float4x4 motionBlurMatrix;
  163. //
  164. //
  165. // Registers:
  166. //
  167. // Name Reg Size
  168. // ---------------------------- ----- ----
  169. // globalScreenSize c44 1
  170. // Exposure c66 1
  171. // motionBlurMatrix c72 4
  172. // TexelSize c76 1
  173. // dofProj c77 1
  174. // dofDist c78 1
  175. // dofBlur c79 1
  176. // gDirectionalMotionBlurLength c80 1
  177. // ToneMapParams c81 1
  178. // deSatContrastGamma c82 1
  179. // ColorCorrect c83 1
  180. // ColorShift c84 1
  181. // PLAYER_MASK c85 1
  182. // GBufferTextureSampler2 s0 1
  183. // GBufferTextureSampler3 s1 1
  184. // HDRSampler s2 1
  185. // BloomSampler s3 1
  186. // AdapLumSampler s4 1
  187. // JitterSampler s5 1
  188. // StencilCopySampler s6 1
  189.  
  190. //quad
  191. struct VS_OUTPUT_POST
  192. {
  193. float4 vpos : POSITION;
  194. float2 txcoord0 : TEXCOORD0;
  195. };
  196. struct VS_INPUT_POST
  197. {
  198. float3 pos : POSITION;
  199. float2 txcoord0 : TEXCOORD0;
  200. };
  201.  
  202. //int4 _i0 : register(i0);
  203.  
  204. /*
  205. float4 _c0 : register(c0);
  206. float4 _c1 : register(c1);
  207. float4 _c2 : register(c2);
  208. float4 _c3 : register(c3);
  209. float4 _c4 : register(c4);
  210. float4 _c5 : register(c5);
  211. float4 _c6 : register(c6);
  212. */
  213. float4 _c44 : register(c44);
  214. float4 _c66 : register(c66);
  215. float4 _c72 : register(c72);
  216. float4 _c73 : register(c73);
  217. float4 _c74 : register(c74);
  218. float4 _c75 : register(c75);
  219. float4 _c76 : register(c76);
  220. float4 _c77 : register(c77);
  221. float4 _c78 : register(c78);
  222. float4 _c79 : register(c79);
  223. float4 _c80 : register(c80);
  224. float4 _c81 : register(c81);
  225. float4 _c82 : register(c82);
  226. float4 _c83 : register(c83);
  227. float4 _c84 : register(c84);
  228. float4 _c85 : register(c85);
  229. float maxi : register(c86);
  230. float temp : register(c87);
  231.  
  232. texture2D texs0 : register(s0);
  233. texture2D texs1 : register(s1);
  234. texture2D texs2 : register(s2);
  235. texture2D texs3 : register(s3);
  236. texture2D texs4 : register(s4);
  237. texture2D texs5 : register(s5);
  238. texture2D texs6 : register(s6);
  239. texture2D texs7 : register(s7);
  240. texture2D texs13 : register(s13);//palette
  241. texture2D texs15 : register(s15);
  242. //sampler2D s0=sampler_state { Texture=<texs0>; };
  243. //sampler2D s1=sampler_state { Texture=<texs1>; };
  244. sampler2D s2=sampler_state { Texture=<texs2>; };
  245. //sampler2D s3=sampler_state { Texture=<texs3>; };
  246. sampler2D s4=sampler_state { Texture=<texs4>; };
  247. sampler2D s5=sampler_state { Texture=<texs5>; };
  248. sampler2D s6=sampler_state { Texture=<texs6>; };
  249. sampler2D s7=sampler_state { Texture=<texs7>; };
  250. //sampler2D s13=sampler_state { Texture=<texs13>; };
  251. sampler2D s15=sampler_state { Texture=<texs15>; };
  252.  
  253. //next samplers states fixing problems on ATI cards
  254. sampler2D s0 = sampler_state
  255. {
  256. Texture = <texs0>;
  257. MinFilter = LINEAR;//
  258. MagFilter = LINEAR;//
  259. MipFilter = NONE;//NONE;//LINEAR;
  260. AddressU = CLAMP;
  261. AddressV = CLAMP;
  262. SRGBTexture=FALSE;
  263. MaxMipLevel=0;
  264. MipMapLodBias=0;
  265. };
  266.  
  267. sampler2D s1 = sampler_state
  268. {
  269. Texture = <texs1>;
  270. MinFilter = LINEAR;//
  271. MagFilter = LINEAR;//
  272. MipFilter = NONE;//NONE;//LINEAR;
  273. AddressU = CLAMP;
  274. AddressV = CLAMP;
  275. SRGBTexture=FALSE;
  276. MaxMipLevel=0;
  277. MipMapLodBias=0;
  278. };
  279.  
  280. sampler2D s3 = sampler_state
  281. {
  282. Texture = <texs3>;
  283. MinFilter = LINEAR;//
  284. MagFilter = LINEAR;//
  285. MipFilter = NONE;//NONE;//LINEAR;
  286. AddressU = CLAMP;
  287. AddressV = CLAMP;
  288. SRGBTexture=FALSE;
  289. MaxMipLevel=0;
  290. MipMapLodBias=0;
  291. };
  292.  
  293. sampler2D s13 = sampler_state
  294. {
  295. Texture = <texs13>;
  296. MinFilter = LINEAR;
  297. MagFilter = LINEAR;
  298. MipFilter = NONE;
  299. AddressU = CLAMP;
  300. AddressV = CLAMP;
  301. SRGBTexture=FALSE;
  302. MaxMipLevel=0;
  303. MipMapLodBias=0;
  304. };
  305.  
  306. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  307. //
  308. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  309.  
  310. float4 PS_C215BE6E(VS_OUTPUT_POST IN) : COLOR
  311. {
  312. float4 _oC0=0.0; //output
  313.  
  314. float4 _c0=float4(0, 0.212500006, 0.715399981, 0.0720999986);
  315. float4 _c1=float4(0.25, 1, 256, 0);
  316. float4 _c2=float4(0, 2, 4, 8);
  317. float4 _c3=float4(58.1640015, 47.1300011, 0, 0);
  318. float4 _c4=float4(-0.5, -1.5, 1.5, 0.5);
  319. float4 _c5=float4(2, -1, 0.125, 0);
  320. float4 _c6=float4(256, 2, 4, 8);
  321. //mine
  322. float4 _c7=float4(1.0, 0.1, 0.8, 1.0);
  323. float4 _c8=float4(0.0, 0.1, 0.8, 0.333);
  324. float4 _c9=float4(0.06, 0.1, 0.8, 0.1);
  325. float4 _c10=float4(0.01, 1.4, 0.0, 0.32);
  326. float4 _c11=float4(0.333333, 1.0, 0.0, 0.0);
  327. //float4 _c12=float4(0.27, 0.67, 0.06, 0.0);
  328. float4 _c12=float4(0.299, 0.587, 0.114, 0.0);
  329. float4 _c13=float4(0.0, 0.0, 0.0, 0.00001);
  330. float4 _c150=float4(0.55, 0.9, 0.85, 0.9);
  331. float4 _c195=float4(0.0, 0.0, 0.0, 0.07);//0.7
  332.  
  333.  
  334. float4 r0;
  335. float4 r1;
  336. float4 r2;
  337. float4 r3;
  338. float4 r4;
  339. float4 r5;
  340. float4 r6;
  341. float4 r7;
  342. float4 r8;
  343. float4 r9;
  344. float4 r10;
  345. float4 r11;
  346.  
  347.  
  348. float4 _v0=0.0;
  349. _v0.xy=IN.txcoord0.xy;
  350.  
  351.  
  352. r1=tex2D(s2, _v0.xy); //HDRSampler
  353. r2=tex2D(s3, _v0.xy); //BloomSampler
  354.  
  355. //********************
  356.  
  357. float2 center;
  358. float depth;
  359. float focus;
  360.  
  361.  
  362. r0=tex2D(s1, _v0.xy); //GBufferTextureSampler3
  363. r0.y=-_c77.x + _c77.y; //-dofProj.x + dofProj.y
  364. r0.y=1.0/r0.y;
  365. r0.z=r0.y * _c77.y; //dofProj.y
  366. r0.z=r0.z * -_c77.x; //dofProj.x
  367. r0.x=_c77.y * -r0.y + r0.x;
  368. r0.x=1.0/r0.x;
  369. r0.y=r0.z * r0.x;
  370.  
  371. r0.w=abs(_c79.w);
  372. r3=_c4; //-0.5, -1.5, 1.5, 0.5
  373.  
  374.  
  375. depth=r0.z * r0.x - _c78.w; //dofDist.w
  376. depth+=_c78.y * -r3.w; //dofDist.y
  377. depth+=148;//offset
  378. center.x=_v0.x-0.5;
  379. center.y=0.5-_v0.y;
  380.  
  381. float4 vDofParams = float4(0, 1.5, 1000, 1.0);
  382.  
  383. //********************
  384.  
  385. float2 FocusPoint = float2(0.5, 0.5);
  386. r4=tex2D(s1, FocusPoint); //GBufferTextureSampler3
  387. r4.y=-_c77.x + _c77.y; //-dofProj.x + dofProj.y
  388. r4.y=1/r4.y;
  389. r4.z=r4.y * _c77.y; //dofProj.y
  390. r4.z=r4.z * -_c77.x; //dofProj.x
  391. r4.x=_c77.y * -r4.y + r4.x;
  392. r4.x=1/r4.x;
  393. r4.y=r4.z * r4.x;
  394.  
  395. float cdepth;
  396.  
  397. cdepth=r4.z * r4.x - _c78.w; //dofDist.w
  398. cdepth+=_c78.y * -r3.w; //dofDist.y
  399. cdepth+=148;//offset
  400.  
  401.  
  402. r4.w = tex2D(s0, FocusPoint).w;
  403. if(r4.w > 0)
  404. {
  405. vDofParams.z = cdepth*2.0;
  406. vDofParams.y = cdepth;
  407. }
  408.  
  409. //********************
  410.  
  411. depth = max(depth, 0); //fix zoom bug
  412.  
  413. float dist;
  414.  
  415. if(depth < vDofParams.y)
  416. dist = (depth - vDofParams.y)/(vDofParams.y - vDofParams.x);
  417. else
  418. {
  419. dist = (depth - vDofParams.y)/(vDofParams.z - vDofParams.y);
  420. dist = clamp(dist, 0, vDofParams.w);
  421. }
  422.  
  423. dist = dist * 0.5 + 0.5;
  424.  
  425.  
  426. static float3 poisson[60] =
  427. {
  428. float3( 0.2165, 0.1250, 1.0000 ),
  429. float3( 0.0000, 0.2500, 1.0000 ),
  430. float3( -0.2165, 0.1250, 1.0000 ),
  431. float3( -0.2165, -0.1250, 1.0000 ),
  432. float3( -0.0000, -0.2500, 1.0000 ),
  433. float3( 0.2165, -0.1250, 1.0000 ),
  434. float3( 0.4330, 0.2500, 1.0000 ),
  435. float3( 0.0000, 0.5000, 1.0000 ),
  436. float3( -0.4330, 0.2500, 1.0000 ),
  437. float3( -0.4330, -0.2500, 1.0000 ),
  438. float3( -0.0000, -0.5000, 1.0000 ),
  439. float3( 0.4330, -0.2500, 1.0000 ),
  440. float3( 0.6495, 0.3750, 1.0000 ),
  441. float3( 0.0000, 0.7500, 1.0000 ),
  442. float3( -0.6495, 0.3750, 1.0000 ),
  443. float3( -0.6495, -0.3750, 1.0000 ),
  444. float3( -0.0000, -0.7500, 1.0000 ),
  445. float3( 0.6495, -0.3750, 1.0000 ),
  446. float3( 0.8660, 0.5000, 1.0000 ),
  447. float3( 0.0000, 1.0000, 1.0000 ),
  448. float3( -0.8660, 0.5000, 1.0000 ),
  449. float3( -0.8660, -0.5000, 1.0000 ),
  450. float3( -0.0000, -1.0000, 1.0000 ),
  451. float3( 0.8660, -0.5000, 1.0000 ),
  452. float3( 0.2163, 0.3754, 0.8670 ),
  453. float3( -0.2170, 0.3750, 0.8670 ),
  454. float3( -0.4333, -0.0004, 0.8670 ),
  455. float3( -0.2163, -0.3754, 0.8670 ),
  456. float3( 0.2170, -0.3750, 0.8670 ),
  457. float3( 0.4333, 0.0004, 0.8670 ),
  458. float3( 0.4328, 0.5004, 0.8847 ),
  459. float3( -0.2170, 0.6250, 0.8847 ),
  460. float3( -0.6498, 0.1246, 0.8847 ),
  461. float3( -0.4328, -0.5004, 0.8847 ),
  462. float3( 0.2170, -0.6250, 0.8847 ),
  463. float3( 0.6498, -0.1246, 0.8847 ),
  464. float3( 0.6493, 0.6254, 0.9065 ),
  465. float3( -0.2170, 0.8750, 0.9065 ),
  466. float3( -0.8663, 0.2496, 0.9065 ),
  467. float3( -0.6493, -0.6254, 0.9065 ),
  468. float3( 0.2170, -0.8750, 0.9065 ),
  469. float3( 0.8663, -0.2496, 0.9065 ),
  470. float3( 0.2160, 0.6259, 0.8851 ),
  471. float3( -0.4340, 0.5000, 0.8851 ),
  472. float3( -0.6500, -0.1259, 0.8851 ),
  473. float3( -0.2160, -0.6259, 0.8851 ),
  474. float3( 0.4340, -0.5000, 0.8851 ),
  475. float3( 0.6500, 0.1259, 0.8851 ),
  476. float3( 0.4325, 0.7509, 0.8670 ),
  477. float3( -0.4340, 0.7500, 0.8670 ),
  478. float3( -0.8665, -0.0009, 0.8670 ),
  479. float3( -0.4325, -0.7509, 0.8670 ),
  480. float3( 0.4340, -0.7500, 0.8670 ),
  481. float3( 0.8665, 0.0009, 0.8670 ),
  482. float3( 0.2158, 0.8763, 0.9070 ),
  483. float3( -0.6510, 0.6250, 0.9070 ),
  484. float3( -0.8668, -0.2513, 0.9070 ),
  485. float3( -0.2158, -0.8763, 0.9070 ),
  486. float3( 0.6510, -0.6250, 0.9070 ),
  487. float3( 0.8668, 0.2513, 0.9070 )
  488. };
  489.  
  490.  
  491. float2 pixelSizeHigh;
  492. float2 pixelSizeLow;
  493.  
  494.  
  495. pixelSizeHigh.x = 2.0 / _c44.x;
  496. pixelSizeHigh.y = 2.0 / _c44.y;
  497.  
  498. pixelSizeHigh.xy *= DOFSizeMulti;
  499.  
  500. pixelSizeLow.xy = pixelSizeHigh.xy;
  501.  
  502. float2 vMaxCoC = float2(5.0, 10.0);
  503.  
  504. float radiusScale = DOFAmount;
  505.  
  506. float discRadius;
  507. float discRadiusLow;
  508. float centerDepth;
  509. float4 tdepth;
  510.  
  511. float4 tapHigh;
  512. float4 tapLow;
  513.  
  514. centerDepth = dist;
  515.  
  516. discRadius = abs(centerDepth * vMaxCoC.y - vMaxCoC.x);
  517. discRadiusLow = discRadius * radiusScale;
  518.  
  519. r1 = 0.0;
  520.  
  521. for(int t = 0; t < 60; t++)
  522. {
  523. float2 coordLow = _v0.xy + (pixelSizeLow.xy * poisson[t].xy * discRadiusLow);
  524. float2 coordHigh = _v0.xy + (pixelSizeHigh.xy * poisson[t].xy * discRadius);
  525.  
  526. tapLow = tex2D(s2, coordLow.xy) * poisson[t].z;
  527. tapHigh = tex2D(s2, coordHigh.xy) * poisson[t].z;
  528.  
  529. tdepth = tex2D(s1, coordHigh.xy); //GBufferTextureSampler3
  530. tdepth.y = -_c77.x + _c77.y; //-dofProj.x + dofProj.y
  531. tdepth.y = 1.0 / tdepth.y;
  532. tdepth.z = tdepth.y * _c77.y; //dofProj.y
  533. tdepth.z = tdepth.z * -_c77.x; //dofProj.x
  534. tdepth.x = _c77.y * -tdepth.y + tdepth.x;
  535. tdepth.x = 1.0 / tdepth.x;
  536.  
  537. tdepth.w = tdepth.z * tdepth.x - _c78.w; //dofDist.w
  538. tdepth.w += _c78.y * -r3.w; //dofDist.y
  539. tdepth.w += 148;//offset
  540.  
  541. tdepth.w = max(tdepth.w, 0); //fix zoom bug
  542.  
  543. if(tdepth.w < vDofParams.y)
  544. tapHigh.w = (tdepth.w - vDofParams.y)/(vDofParams.y - vDofParams.x);
  545. else
  546. {
  547. tapHigh.w = (tdepth.w - vDofParams.y)/(vDofParams.z - vDofParams.y);
  548. tapHigh.w = clamp(tapHigh.w, 0, vDofParams.w);
  549. }
  550.  
  551. tapHigh.w = tapHigh.w * 0.5 + 0.5;
  552.  
  553. tapLow.w = tapHigh.w;
  554.  
  555. float tapBlur = abs(tapHigh.w * 2.0 - 1.0);
  556. float4 tap = lerp(tapHigh, tapLow, tapBlur);
  557.  
  558. if(tap.w >= centerDepth) tap.w = 1;
  559. else tap.w = abs(tap.w * 2.0 - 1.0);
  560.  
  561. r1.xyz += tap.xyz * tap.w;
  562. r1.w += tap.w;
  563.  
  564.  
  565. }
  566.  
  567. r1.xyz /= r1.w;
  568.  
  569. //float4 dofcolor = r1;
  570.  
  571. //dofcolor.w = r1.w / DoF_TAPS;
  572.  
  573. //********************
  574.  
  575. r1.w=dot(r1.xyz, r1.xyz); //dp3
  576. r1.w=1.0/r1.w;
  577.  
  578. //if (-r1.w<0.0) r3 = r1;
  579. //else r3 = _c0.x;
  580.  
  581. r3 = lerp(_c0.x, r1, saturate(r1.w * 10000));
  582.  
  583. r4 = r3;
  584. r5 = r3;
  585. r6 = r3;
  586. r7 = r3;
  587.  
  588. r0.x=r0.z * r0.x - _c78.w; //dofDist.w
  589. r0.x=_c78.y * -r3.w + r0.x; //dofDist.y
  590. r1.w=max(r0.x, _c0.x); //0.0
  591. r0.x=1.0/_c78.z; //dofDist.z
  592. r0.x=r1.w * r0.x;
  593. r1.w=lerp(_c79.y, _c79.z, r0.x);//dofBlur
  594. r0.x=min(_c79.z, r1.w); //dofBlur.z
  595.  
  596. r0.z=dot(r7.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  597. r8.x=dot(r3.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  598. r8.y=dot(r4.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  599. r8.z=dot(r5.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  600. r8.w=dot(r6.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  601. r1.w=dot(r8, _c1.xxxx); //0.25
  602.  
  603. r8=r8 - r1.w;
  604. r2.w=dot(r8, r8);
  605. r0.z=r0.z - r1.w;
  606. r0.z=r0.z * r0.z - r2.w;
  607. r0.x=r0.x*r0.x;
  608. if (r0.z<0.0)
  609. {
  610. r0.x=r0.x;
  611. } else r0.x=_c1.y; //1.0
  612.  
  613.  
  614. r8=tex2D(s0, _v0.xy); //GBufferTextureSampler2
  615.  
  616.  
  617.  
  618. r8.yz=_c1.yz; // 1.0, 256.0
  619. r9=r8.w * -r8.z + _c2; //0, 2, 4, 8
  620. if (r9.w<0.0) //r9<0.0
  621. {
  622. r9=_c1.w; //0.0
  623. } else r9=_c1.y; //1.0
  624. //r9 is filtered sky mask
  625.  
  626. //r10=r8.w + tempc6;//c6.yzwx; //256, 2, 4, 8
  627. r10=r8.w * -_c6.x + _c6.yzwx; //256, 2, 4, 8
  628.  
  629.  
  630.  
  631. if (r10.x<0.0)
  632. {
  633. r10.x=-_c1.w; //0.0
  634. } else r10.x=-_c1.y; //1.0
  635.  
  636. if (r10.y<0.0)
  637. {
  638. r10.y=-_c1.w; //0.0
  639. } else r10.y=-_c1.y; //1.0
  640.  
  641. if (r10.z<0.0)
  642. {
  643. r10.z=-_c1.w; //0.0
  644. } else r10.z=-_c1.y; //1.0
  645.  
  646. if (r10.w<0.0)
  647. {
  648. r10.w=-_c1.w; //0.0
  649. } else r10.w=-_c1.y; //1.0
  650.  
  651.  
  652. r9=r9 + r10;
  653. r9=r9 * _c4.x; //-0.5
  654.  
  655.  
  656. r0.z=dot(r9, _c1.yyyy); //1.0
  657. r0.z=r0.z + _c4.w; //0.5
  658. r0.z=1.0/r0.z;
  659. r8.xzw=r3.xyz * r9.x;
  660.  
  661.  
  662. r7.xyz=r7 * _c4.w + r8.xzw; //0.5
  663. r7.xyz=r4 * r9.y + r7;
  664. r7.xyz=r5 * r9.z + r7;
  665. r7.xyz=r6 * r9.w + r7;
  666. r7.xyz=r0.z * r7;
  667. r0.z=-r0.x + _c1.y; //1.0
  668. r1.w=r0.x * _c1.x; //0.25
  669.  
  670.  
  671. r3.xyz=r3 * r1.w;
  672. r3.xyz=r7 * r0.z + r3;
  673. r3.xyz=r4 * r1.w + r3;
  674. r3.xyz=r5 * r1.w + r3;
  675. r3.xyz=r6 * r1.w + r3;
  676.  
  677.  
  678. //r4.xyz=_v0.yxy * _c5.x + _c5.y; //2, -1
  679. r4.x=_v0.y * _c5.x + _c5.y;
  680. r4.y=_v0.x * _c5.x + _c5.y;
  681. r4.z=_v0.y * _c5.x + _c5.y;
  682.  
  683. r0.z=r4.y * _c77.z; //dofProj.z
  684. r0.z=r0.y * r0.z;
  685. r1.w=-r4.x * _c77.w; //dofProj.w
  686. r1.w=r0.y * r1.w;
  687. r5.xyz=r1.w * _c73; //motionBlurMatrix.2
  688. r5.xyz=r0.z * _c72 + r5; //motionBlurMatrix.1
  689. r5.xyz=-r0.y * _c74 + r5; //motionBlurMatrix.3
  690. r5.xyz=r5 + _c75; //motionBlurMatrix.4
  691.  
  692. r0.y=-r5.z * _c77.z; //dofProj.z
  693. r0.y=1/r0.y;
  694. r6.x=r5.x * r0.y;
  695. r0.y=r5.z * _c77.w; //dofProj.w
  696. r0.y=1/r0.y;
  697. r6.y=r5.y * r0.y;
  698. //r0.yz=-r4 + r6.xxyw;
  699. r0.yz=-r4.yz + r6.xy;
  700.  
  701. //r0.yz=r0 * _c80.x; //gDirectionalMotionBlurLength.x
  702. r0.y=r0.y * _c80.x;
  703. r0.z=r0.z * _c80.x;
  704. r4.xy=r0.yz * _c5.z; //0.125
  705. r5=tex2D(s6, _v0.xy); //StencilCopySampler
  706. r1.w=r5.x - _c85.x; //PLAYER_MASK.x
  707. r4.zw=r3.xy * _c2.w; //8.0
  708. r4.zw=_v0.xy * _c3.xy + r4.zw; //58.1640015, 47.1300011
  709. r5=tex2D(s5, r4.zw); //JitterSampler
  710. //r2.w=r5.x - 0.5; //-0.5
  711. r4.zw=r4.xy * (r5.x - 4) + _v0.xy; //0.082 fixed
  712. r5.xyz=r3.xyz;
  713. r2.w=_c1.y; //1.0
  714. r3.w=_c1.y; //1.0
  715.  
  716. for (int iii=0; iii<8; iii++)
  717. {
  718. r6.x=r4.x * r3.w + r4.z;
  719. r6.y=r4.y * r3.w + r4.w;
  720. r7=tex2D(s6, r6.xy);
  721. r5.w=r7.x - _c85.x;
  722. if (r5.w<-0.3)
  723. {
  724. r5.w=_c1.y; //1.0
  725. } else r5.w=_c1.w; //0.0
  726. r6=tex2D(s2, r6.xy);
  727. r5.xyz=r6.xyz * r5.w + r5.xyz;
  728. r2.w=r2.w + r5.w;
  729. r3.w=r3.w + _c1.y; //1.0
  730. }
  731.  
  732.  
  733. r2.w=1.0/r2.w;
  734.  
  735. //r0.yz=r0 * _c44.xxyw; //globalScreenSize
  736. r0.y=r0.y * _c44.x; //globalScreenSize
  737. r0.z=r0.z * _c44.y; //globalScreenSize
  738.  
  739. r0.y=dot(r0.yz, r0.yz)+_c0.x;//dp2
  740.  
  741. //r0.y=sqrt(r0.y);
  742. //r0.y=1.0/r0.y;
  743. r0.y=pow(r0.y, _c4.w); //0.5
  744.  
  745. r0.y=r0.y * _c4.w; //0.5
  746. r0.x=r0.x + _c1.y; //1.0
  747. r0.x=1.0/r0.x;
  748. //r0.y is wrong
  749. r0.x=saturate(r0.y * r0.x);
  750. r4.xyz=r5 * r2.w - r3;
  751. r0.xyz=r0.x * r4 + r3;
  752.  
  753. //_oC0.xyz=0.5*r0.xyz;
  754.  
  755. if (-r1.w<0.0) r0.xyz=r3.xyz;
  756. if (-r0.w<0.0) r0.xyz=r1.xyz;
  757.  
  758.  
  759.  
  760. //for future use
  761. r11=r0;
  762.  
  763.  
  764. r1=tex2D(s4, _c0.x); //AdapLumSampler , 0.0
  765. r0.w=1.0/r1.x;
  766. r0.w=r0.w * _c81.y; //ToneMapParams.y
  767. r1.x=1.0/r0.w;
  768. r1.x=r1.x * _c81.x; //ToneMapParams.x
  769. r1.xyz=r2 * _c66.x - r1.x; //Exposure.x
  770. r2.xyz=max(r1, _c0.x); //0.0
  771. r1.xyz=r2 * _c81.z; //ToneMapParams.z
  772. r1.xyz=r1 * _c1.x; //0.25
  773. r0.xyz=r0 * _c66.x + r1; //Exposure.x
  774. r1.xyz=r0.w * r0;
  775. r1.x=dot(r1.xyz, _c0.yzw); //0.2125, 0.7154, 0.0721
  776. r0.xyz=r0 * r0.w - r1.x;
  777. r0.xyz=_c82.x * r0 + r1.x; //deSatContrastGamma.x
  778. r0.w=r1.x * _c84.w; //ColorShift.w
  779. r1.yzw=r0.w * _c84.xxyz; //ColorShift
  780.  
  781. //darken as DarkeningAmount, but keeps colors
  782. r2.x=saturate(r0.w);
  783. r0.xyz=r0.xyz - _c84.xyz * r0.w; //ColorShift
  784. r0.xyz=r2.x * r0.xyz + r1.yzww;
  785.  
  786. //coloring (green, brown, ...)
  787. r0.xyz=2.0 * r0.xyz * _c83.xyz; //ColorCorrect
  788.  
  789. //keeps colors, changes luma
  790. r1.x=saturate(r1.x);//luma
  791. r0.w=_c82.z - _c1.y; //deSatContrastGamma.z - 1.0
  792. r2.x=pow(r1.x, r0.w);
  793.  
  794. _oC0.xyz=r0.xyz * r2.x; //orig
  795. _oC0.w=_c1.y; //1.0
  796.  
  797. //********************
  798.  
  799. float4 color;
  800. //r0=tex2D(s2, _v0.xy);//hdr color
  801. color= r11;
  802.  
  803. float4 origcolor = tex2D(s2, _v0.xy);
  804.  
  805.  
  806. float4 colorbloom=tex2D(s3, _v0.xy);
  807.  
  808. colorbloom.r*=lerp(0.4, 1.3, saturate(pow(depth/300, 0.5)));
  809. colorbloom.g*=lerp(0.4, 1.3, saturate(pow(depth/300, 0.5)));
  810. colorbloom.b*=lerp(0.4, 1.3, saturate(pow(depth/300, 0.5)));
  811.  
  812. colorbloom.r*=BloomR;
  813. colorbloom.g*=BloomG;
  814. colorbloom.b*=BloomB;
  815.  
  816. color=colorbloom * BloomAmount + color;
  817.  
  818. float cgray=dot(color.xyz, 0.333);//luma
  819. float3 poweredcolor=pow(color.xyz, ISaturation);
  820. float newgray=dot(poweredcolor.xyz, 0.333);
  821. color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  822.  
  823.  
  824. r10.x=dot(color.xyz, _c12.xyz);
  825. r10.x*=IBrightness;
  826. color*=r10.x;
  827.  
  828. color.xyz=lerp(color.xyz, pow(color.xyz*2, IContrast), IWhiteAmount);
  829.  
  830. r5=tex2D(s4, _c0.x);
  831. //r5=1.0;
  832.  
  833. //adaptation
  834. r5.w=r5.x;
  835. r5.w=0.725/r5.w;
  836. color.xyz=color.xyz * r5.w;
  837. r3.xy=_c10.xwxw;
  838. r3.xy=r3.xy * r5.w;
  839.  
  840.  
  841. color=color * _c7.y; //pre multiply
  842. r1=color * _c7.z; //e multiply
  843. r1=r1 + _c7.w;
  844.  
  845.  
  846. color=color / r1;
  847.  
  848. color=BloomAmountAdd*colorbloom * r3.x + color;
  849.  
  850. color.xyz=lerp(color.xyz, 1 - pow(2.0, -color.xyz), 0.5);
  851.  
  852. float middlegray=dot(color.xyz, 0.3333);
  853. float3 diffcolor=color.rgb-middlegray;
  854. color.rgb+=diffcolor*1.0;
  855. color.xyz=saturate(color.xyz);
  856. color.xyz=lerp(color.xyz, sin(color.xyz*1.57079), 0.4);
  857.  
  858. //********************
  859.  
  860. #ifdef APPLYGAMECOLORCORRECTION
  861.  
  862. //apply original corrections (((
  863. r0.w=1.0;//_c81.y/r5.x;//r5 is AdapLumSampler
  864.  
  865.  
  866. luma=0.5*color.r + 0.5*color.g + 0.5*color.b;
  867. color.xyz=color.xyz * r0.w - luma;
  868. color.xyz=_c82.x * color.xyz + luma; //deSatContrastGamma.x
  869. r0.w=luma * _c84.w; //ColorShift.w
  870. r1.xyz=r0.w * _c84.xyz; //ColorShift
  871.  
  872. //darken as DarkeningAmount, but keeps colors
  873. color.xyz=color.xyz - _c84.xyz * r0.w; //ColorShift
  874. color.xyz=saturate(r0.w) * color.xyz + r1.xyz;
  875.  
  876. //coloring (green, brown, ...)
  877. color.xyz=2.0 * color.xyz * _c83.xyz; //ColorCorrect
  878.  
  879. //desaturating
  880. luma=saturate(luma);
  881. r0.w=_c82.z - _c1.y; //deSatContrastGamma.z - 1.0
  882. color.xyz=color.xyz * pow(luma, r0.w);
  883.  
  884. #endif //APPLYGAMECOLORCORRECTION
  885.  
  886. //********************
  887.  
  888. //pallete texture (0.082 version feature)
  889. //#ifdef E_CC_PALETTE
  890. color.rgb=saturate(color.rgb);
  891. float3 brightness=0.001;//tex2D(s4, _c0.x);//adaptation luminance
  892. // brightness=brightness/(brightness+1.0);
  893. float3 palette;
  894. float4 uvsrc=0.0;
  895. uvsrc.y=brightness.r;
  896. uvsrc.x=color.r;
  897. palette.r=tex2Dlod(s13, uvsrc).r;
  898. uvsrc.x=color.g;
  899. uvsrc.y=brightness.g;
  900. palette.g=tex2Dlod(s13, uvsrc).g;
  901. uvsrc.x=color.b;
  902. uvsrc.y=brightness.b;
  903. palette.b=tex2Dlod(s13, uvsrc).b;
  904. color.rgb=palette.rgb;
  905. //#endif //E_CC_PALETTE
  906.  
  907. //********************
  908.  
  909. focus=length(center.xy)*1.41421;
  910. focus=pow(focus, 5);
  911.  
  912. color.xyz-=focus*VignetteAmount;
  913. color.xyz = saturate(color.xyz);
  914. ////////////////////SSAO///////////////////////////
  915. tdepth = readDepth( _c78.w );
  916. float d;
  917.  
  918. float pw = 1.0 / ViewportSize.x;
  919. float ph = 1.0 / ViewportSize.y;
  920.  
  921. float aoCap = 10.0;
  922.  
  923. float ao = 0.0;
  924.  
  925. float aoMultiplier=1000.0;
  926.  
  927. float depthTolerance = 0.0001;
  928.  
  929. d=readDepth( float2(_c78.x+pw,_c78.y+ph));
  930. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  931.  
  932. d=readDepth( float2(_c78.x-pw,_c78.y+ph));
  933. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  934.  
  935. d=readDepth( float2(_c78.x+pw,_c78.y-ph));
  936. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  937.  
  938. d=readDepth( float2(_c78.x-pw,_c78.y-ph));
  939. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  940.  
  941. pw*=2.0;
  942. ph*=2.0;
  943. aoMultiplier/=2.0;
  944.  
  945. d=readDepth( float2(_c78.x+pw,_c78.y+ph));
  946. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  947.  
  948. d=readDepth( float2(_c78.x-pw,_c78.y+ph));
  949. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  950.  
  951. d=readDepth( float2(_c78.x+pw,_c78.y-ph));
  952. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  953.  
  954. d=readDepth( float2(_c78.x-pw,_c78.y-ph));
  955. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  956.  
  957. pw*=2.0;
  958. ph*=2.0;
  959. aoMultiplier/=2.0;
  960.  
  961. d=readDepth( float2(_c78.x+pw,_c78.y+ph));
  962. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  963.  
  964. d=readDepth( float2(_c78.x-pw,_c78.y+ph));
  965. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  966.  
  967. d=readDepth( float2(_c78.x+pw,_c78.y-ph));
  968. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  969.  
  970. d=readDepth( float2(_c78.x-pw,_c78.y-ph));
  971. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  972.  
  973. pw*=2.0;
  974. ph*=2.0;
  975. aoMultiplier/=2.0;
  976.  
  977. d=readDepth( float2(_c78.x+pw,_c78.y+ph));
  978. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  979.  
  980. d=readDepth( float2(_c78.x-pw,_c78.y+ph));
  981. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  982.  
  983. d=readDepth( float2(_c78.x+pw,_c78.y-ph));
  984. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  985.  
  986. d=readDepth( float2(_c78.x-pw,_c78.y-ph));
  987. ao+=min(aoCap,max(0.0,tdepth-d-depthTolerance) * aoMultiplier);
  988.  
  989. ao/=16.0;
  990. //////////////////
  991.  
  992. //********************
  993.  
  994. _oC0.xyz=color.xyz;
  995.  
  996. //_oC0.w=1.0;
  997. return _oC0+( 1.0 - ao )*( float4( tex2D( ScnSamp, IN.txcoord0 ).xyz * float3( uvsrc.rgb ), 1.0 ) );
  998. }
  999.  
  1000. //mine temporary post process
  1001. technique Shader_C215BE6E
  1002. {
  1003. pass p0
  1004. {
  1005. PixelShader = compile ps_3_0 PS_C215BE6E();
  1006. }
  1007. }
  1008.  
  1009.  
  1010.  
  1011.  
  1012. //original shader of post processing
  1013. technique Shader_ORIGINALPOSTPROCESS
  1014. {
  1015. pass p0
  1016. {
  1017.  
  1018. PixelShader=
  1019. asm
  1020. {
  1021. //
  1022. // Generated by Microsoft (R) HLSL Shader Compiler 9.23.949.2378
  1023. //
  1024. // Parameters:
  1025. //
  1026. // sampler2D AdapLumSampler;
  1027. // sampler2D BloomSampler;
  1028. // float4 ColorCorrect;
  1029. // float4 ColorShift;
  1030. // float Exposure;
  1031. // sampler2D GBufferTextureSampler2;
  1032. // sampler2D GBufferTextureSampler3;
  1033. // sampler2D HDRSampler;
  1034. // sampler2D JitterSampler;
  1035. // float PLAYER_MASK;
  1036. // sampler2D StencilCopySampler;
  1037. // float4 TexelSize;
  1038. // float4 ToneMapParams;
  1039. // float4 deSatContrastGamma;
  1040. // float4 dofBlur;
  1041. // float4 dofDist;
  1042. // float4 dofProj;
  1043. // float gDirectionalMotionBlurLength;
  1044. // float4 globalScreenSize;
  1045. // row_major float4x4 motionBlurMatrix;
  1046. //
  1047. //
  1048. // Registers:
  1049. //
  1050. // Name Reg Size
  1051. // ---------------------------- ----- ----
  1052. // globalScreenSize c44 1
  1053. // Exposure c66 1
  1054. // motionBlurMatrix c72 4
  1055. // TexelSize c76 1
  1056. // dofProj c77 1
  1057. // dofDist c78 1
  1058. // dofBlur c79 1
  1059. // gDirectionalMotionBlurLength c80 1
  1060. // ToneMapParams c81 1
  1061. // deSatContrastGamma c82 1
  1062. // ColorCorrect c83 1
  1063. // ColorShift c84 1
  1064. // PLAYER_MASK c85 1
  1065. // GBufferTextureSampler2 s0 1
  1066. // GBufferTextureSampler3 s1 1
  1067. // HDRSampler s2 1
  1068. // BloomSampler s3 1
  1069. // AdapLumSampler s4 1
  1070. // JitterSampler s5 1
  1071. // StencilCopySampler s6 1
  1072. //
  1073.  
  1074. ps_3_0
  1075. def c0, 0, 0.212500006, 0.715399981, 0.0720999986
  1076. def c1, 0.25, 1, 256, 0
  1077. def c2, 0, 2, 4, 8
  1078. def c3, 58.1640015, 47.1300011, 0, 0
  1079. def c4, -0.5, -1.5, 1.5, 0.5
  1080. def c5, 2, -1, 0.125, 0
  1081. def c6, 256, 2, 4, 8
  1082. def c180, 0.0, 0.0, 0.0, 100.5
  1083. def c181, 1.0, 0.0, 0.0, 20.01
  1084. def c183, 800.0, 600.0, 0.0, 100.5
  1085. defi i0, 7, 0, 0, 0
  1086. dcl_texcoord v0.xy
  1087. dcl_2d s0
  1088. dcl_2d s1
  1089. dcl_2d s2
  1090. dcl_2d s3
  1091. dcl_2d s4
  1092. dcl_2d s5
  1093. dcl_2d s6
  1094. texld r0, v0, s1
  1095. add r0.y, -c77.x, c77.y
  1096. rcp r0.y, r0.y
  1097. mul r0.z, r0.y, c77.y
  1098. mul r0.z, r0.z, -c77.x
  1099. mad r0.x, c77.y, -r0.y, r0.x
  1100. rcp r0.x, r0.x
  1101. mul r0.y, r0.z, r0.x
  1102. texld r1, v0, s2
  1103. texld r2, v0, s3
  1104. abs r0.w, c79.w
  1105. mov r3, c4
  1106. mad r4.xy, c76, r3, v0
  1107. texld r4, r4, s2
  1108. mad r5.xy, c76, r3.zxzw, v0
  1109. texld r5, r5, s2
  1110. mad r3.xz, c76.xyyw, r3.wyzw, v0.xyyw
  1111. texld r6, r3.xzzw, s2
  1112. mad r3.xy, c76, r3.ywzw, v0
  1113. texld r7, r3, s2
  1114. dp3 r1.w, r4, r4
  1115. rcp r1.w, r1.w
  1116. cmp r3.xyz, -r1.w, c0.x, r4
  1117. dp3 r1.w, r5, r5
  1118. rcp r1.w, r1.w
  1119. cmp r4.xyz, -r1.w, c0.x, r5
  1120. dp3 r1.w, r6, r6
  1121. rcp r1.w, r1.w
  1122. cmp r5.xyz, -r1.w, c0.x, r6
  1123. dp3 r1.w, r7, r7
  1124. rcp r1.w, r1.w
  1125. cmp r6.xyz, -r1.w, c0.x, r7
  1126. dp3 r1.w, r1, r1
  1127. rcp r1.w, r1.w
  1128. cmp r7.xyz, -r1.w, c0.x, r1
  1129. mad r0.x, r0.z, r0.x, -c78.w
  1130. mad r0.x, c78.y, -r3.w, r0.x
  1131. max r1.w, r0.x, c0.x
  1132. rcp r0.x, c78.z
  1133. mul r0.x, r1.w, r0.x
  1134. lrp r1.w, r0.x, c79.z, c79.y
  1135. min r0.x, c79.z, r1.w
  1136. dp3 r0.z, r7, c0.yzww
  1137. dp3 r8.x, r3, c0.yzww
  1138. dp3 r8.y, r4, c0.yzww
  1139. dp3 r8.z, r5, c0.yzww
  1140. dp3 r8.w, r6, c0.yzww
  1141. dp4 r1.w, r8, c1.x
  1142. add r8, r8, -r1.w
  1143. dp4 r2.w, r8, r8
  1144. add r0.z, r0.z, -r1.w
  1145. mad r0.z, r0.z, r0.z, -r2.w
  1146. mul r0.x, r0.x, r0.x
  1147. cmp r0.x, r0.z, c1.y, r0.x
  1148. texld r8, v0, s0
  1149. mov r8.yz, c1
  1150. mad r9, r8.w, -r8.z, c2
  1151. cmp r9, r9, c1.y, c1.w
  1152. mad r10, r8.w, -c6.x, c6.yzwx
  1153. cmp r10, r10, -c1.y, -c1.w
  1154. add r9, r9, r10
  1155. mul r9, r9, c4.x
  1156. dp4 r0.z, r9, c1.y
  1157. add r0.z, r0.z, c4.w
  1158. rcp r0.z, r0.z
  1159. mul r8.xzw, r3.xyyz, r9.x
  1160. mad r7.xyz, r7, c4.w, r8.xzww
  1161. mad r7.xyz, r4, r9.y, r7
  1162. mad r7.xyz, r5, r9.z, r7
  1163. mad r7.xyz, r6, r9.w, r7
  1164. mul r7.xyz, r0.z, r7
  1165. add r0.z, -r0.x, c1.y
  1166. mul r1.w, r0.x, c1.x
  1167. mul r3.xyz, r3, r1.w
  1168. mad r3.xyz, r7, r0.z, r3
  1169. mad r3.xyz, r4, r1.w, r3
  1170. mad r3.xyz, r5, r1.w, r3
  1171. mad r3.xyz, r6, r1.w, r3
  1172. mad r4.xyz, v0.yxyw, c5.x, c5.y
  1173. mul r0.z, r4.y, c77.z
  1174. mul r0.z, r0.y, r0.z
  1175. mul r1.w, -r4.x, c77.w
  1176. mul r1.w, r0.y, r1.w
  1177. mul r5.xyz, r1.w, c73
  1178. mad r5.xyz, r0.z, c72, r5
  1179. mad r5.xyz, -r0.y, c74, r5
  1180. add r5.xyz, r5, c75
  1181. mul r0.y, -r5.z, c77.z
  1182. rcp r0.y, r0.y
  1183. mul r6.x, r5.x, r0.y
  1184. mul r0.y, r5.z, c77.w
  1185. rcp r0.y, r0.y
  1186. mul r6.y, r5.y, r0.y
  1187. add r0.yz, -r4, r6.xxyw
  1188. mul r0.yz, r0, c80.x
  1189. mul r4.xy, r0.yzzw, c5.z
  1190. texld r5, v0, s6
  1191. add r1.w, r5.x, -c85.x
  1192. mul r4.zw, r3.xyxy, c2.w
  1193. mad r4.zw, v0.xyxy, c3.xyxy, r4
  1194. texld r5, r4.zwzw, s5
  1195. add r2.w, r5.x, c4.x
  1196. mad r4.zw, r4.xyxy, r2.w, v0.xyxy
  1197. mov r5.xyz, r3
  1198. mov r2.w, c1.y
  1199. mov r3.w, c1.y
  1200.  
  1201. rep i0
  1202. mad r6.xy, r4, r3.w, r4.zwzw
  1203. texld r7, r6, s6
  1204. add r5.w, r7.x, -c85.x
  1205. cmp r5.w, r5.w, c1.w, c1.y
  1206. texld r6, r6, s2
  1207. mad r5.xyz, r6, r5.w, r5
  1208. add r2.w, r2.w, r5.w
  1209. add r3.w, r3.w, c1.y
  1210. endrep
  1211.  
  1212. rcp r2.w, r2.w
  1213. mul r0.yz, r0, c183.xxyw//c44.xxyw
  1214. dp2add r0.y, r0.yzzw, r0.yzzw, c0.x
  1215. rsq r0.y, r0.y
  1216. rcp r0.y, r0.y
  1217. mul r0.y, r0.y, c4.w
  1218. add r0.x, r0.x, c1.y
  1219. rcp r0.x, r0.x
  1220. mul_sat r0.x, r0.y, r0.x
  1221. mad r4.xyz, r5, r2.w, -r3
  1222. mad r0.xyz, r0.x, r4, r3
  1223. cmp r0.xyz, r1.w, r3, r0
  1224. cmp r0.xyz, -r0.w, r0, r1
  1225.  
  1226. texld r1, c0.x, s4
  1227. rcp r0.w, r1.x
  1228. mul r0.w, r0.w, c81.y
  1229. rcp r1.x, r0.w
  1230. mul r1.x, r1.x, c81.x
  1231. mad r1.xyz, r2, c66.x, -r1.x
  1232. max r2.xyz, r1, c0.x
  1233. mul r1.xyz, r2, c81.z
  1234. mul r1.xyz, r1, c1.x
  1235. mad r0.xyz, r0, c66.x, r1
  1236. mul r1.xyz, r0.w, r0
  1237. dp3 r1.x, r1, c0.yzww
  1238. mad r0.xyz, r0, r0.w, -r1.x
  1239. mad r0.xyz, c82.x, r0, r1.x
  1240. mul r0.w, r1.x, c84.w
  1241. mul r1.yzw, r0.w, c84.xxyz
  1242. mov_sat r2.x, r0.w
  1243. mad r0.xyz, c84, -r0.w, r0
  1244. mad r0.xyz, r2.x, r0, r1.yzww
  1245. mul r0.xyz, r0, c83
  1246. add r0.xyz, r0, r0
  1247. mov_sat r1.x, r1.x
  1248. add r0.w, -r8.y, c82.z
  1249. pow r2.x, r1.x, r0.w
  1250. //mul r2.x, r2.x, c181.x
  1251. mul oC0.xyz, r0, r2.x
  1252. mov oC0.w, c1.y
  1253.  
  1254. //texld r1, v0, s2
  1255. //mul oC0.xyz, r1, c199.z
  1256. };
  1257. }
  1258. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement