enbeffect.fx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. // M I D H R A S T I C E N B F O R F A L L O U T 3
  2. //++++++++++++++++++++++++++++++++++++++++++++
  3. // ENBSeries effect file
  4. // visit http://enbdev.com for updates
  5. // Copyright (c) 2007-2011 Boris Vorontsov
  6. // Edited By dpeasant. Thanks to:...
  7. //++++++++++++++++++++++++++++++++++++++++++++
  8. // Use #define to activate, and #undef to deactivate. Alternatively, place // before the '#define's.
  9. //post processing mode. Change value (could be 1, 2, 3, 4). Every mode have own internal parameters, look below
  10. #ifndef POSTPROCESS
  11. #define POSTPROCESS 3
  12. #endif
  13. //use original game processing first, then mine
  14. //#define APPLYGAMECOLORCORRECTION
  15. //use original game processing only, with vanilla bloom
  16. //#define ENB_FLIPTECHNIQUE
  17. // Whether to use the values defined below for a colour filter.
  18. //#undef ColourFilter
  19. //+++++++++++++++++++++++++++++
  20. //internal parameters, can be modified
  21. //+++++++++++++++++++++++++++++
  22. float3 EColorFilter=float3(1.0, 1, 1);
  23. //modify these values to tweak various color processing
  24. //POSTPROCESS 1
  25. float EAdaptationMinV1=0.01;
  26. float EAdaptationMaxV1=0.07;
  27. float EContrastV1=0.95;
  28. float EColorSaturationV1=1.0;
  29. float EToneMappingCurveV1=6.0;
  30. //POSTPROCESS 2
  31. //float EBrightnessV2=2.5;
  32. float EAdaptationMinV2=0.05;
  33. float EAdaptationMaxV2=0.05;//0.125;
  34. float EToneMappingCurveV2=8.0;
  35. float EIntensityContrastV2=1.0;
  36. float EToneMappingOversaturationV2=180.0;
  37. float EColorSaturationV2=2.0;
  38. //POSTPROCESS 3
  39. float EAdaptationMinV3=0.10;
  40. float EAdaptationMaxV3=0.115;
  41. float EToneMappingCurveV3=3.5;
  42. float EToneMappingOversaturationV3=50.0;
  43. //POSTPROCESS 4
  44. float EAdaptationMinV4=0.1920;
  45. float EAdaptationMaxV4=0.20;
  46. float EBrightnessCurveV4=1.3;
  47. float EBrightnessMultiplierV4=1.2;
  48. float EBrightnessToneMappingCurveV4=2.6;
  49. //+++++++++++++++++++++++++++++
  50. //external parameters, do not modify
  51. //+++++++++++++++++++++++++++++
  52. //keyboard controlled temporary variables (in some versions exists in the config file). Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. By default all set to 1.0
  53. float4 tempF1; //0,1,2,3
  54. float4 tempF2; //5,6,7,8
  55. float4 tempF3; //9,0
  56. //x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
  57. float4 Timer;
  58. //x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
  59. float4 ScreenSize;
  60. //changes in range 0..1, 0 means that night time, 1 - day time
  61. float ENightDayFactor;
  62. //enb version of bloom applied, ignored if original post processing used
  63. float EBloomAmount;
  64. texture2D texs0;//color
  65. texture2D texs1;//bloom skyrim
  66. texture2D texs2;//adaptation skyrim
  67. texture2D texs3;//bloom enb
  68. texture2D texs4;//adaptation enb
  69. texture2D texs7;//palette enb
  70. sampler2D _s0 = sampler_state
  71. {
  72. Texture = <texs0>;
  73. MinFilter = POINT;//
  74. MagFilter = POINT;//
  75. MipFilter = NONE;//LINEAR;
  76. AddressU = Clamp;
  77. AddressV = Clamp;
  78. SRGBTexture=FALSE;
  79. MaxMipLevel=0;
  80. MipMapLodBias=0;
  81. };
  82. sampler2D _s1 = sampler_state
  83. {
  84. Texture = <texs1>;
  85. MinFilter = LINEAR;//
  86. MagFilter = LINEAR;//
  87. MipFilter = NONE;//LINEAR;
  88. AddressU = Clamp;
  89. AddressV = Clamp;
  90. SRGBTexture=FALSE;
  91. MaxMipLevel=0;
  92. MipMapLodBias=0;
  93. };
  94. sampler2D _s2 = sampler_state
  95. {
  96. Texture = <texs2>;
  97. MinFilter = LINEAR;//
  98. MagFilter = LINEAR;//
  99. MipFilter = NONE;//LINEAR;
  100. AddressU = Clamp;
  101. AddressV = Clamp;
  102. SRGBTexture=FALSE;
  103. MaxMipLevel=0;
  104. MipMapLodBias=0;
  105. };
  106. sampler2D _s3 = sampler_state
  107. {
  108. Texture = <texs3>;
  109. MinFilter = LINEAR;//
  110. MagFilter = LINEAR;//
  111. MipFilter = NONE;//LINEAR;
  112. AddressU = Clamp;
  113. AddressV = Clamp;
  114. SRGBTexture=FALSE;
  115. MaxMipLevel=0;
  116. MipMapLodBias=0;
  117. };
  118. sampler2D _s4 = sampler_state
  119. {
  120. Texture = <texs4>;
  121. MinFilter = LINEAR;//
  122. MagFilter = LINEAR;//
  123. MipFilter = NONE;//LINEAR;
  124. AddressU = Clamp;
  125. AddressV = Clamp;
  126. SRGBTexture=FALSE;
  127. MaxMipLevel=0;
  128. MipMapLodBias=0;
  129. };
  130. sampler2D _s7 = sampler_state
  131. {
  132. Texture = <texs7>;
  133. MinFilter = LINEAR;
  134. MagFilter = LINEAR;
  135. MipFilter = NONE;
  136. AddressU = Clamp;
  137. AddressV = Clamp;
  138. SRGBTexture=FALSE;
  139. MaxMipLevel=0;
  140. MipMapLodBias=0;
  141. };
  142. struct VS_OUTPUT_POST
  143. {
  144. float4 vpos : POSITION;
  145. float2 txcoord0 : TEXCOORD0;
  146. };
  147. struct VS_INPUT_POST
  148. {
  149. float3 pos : POSITION;
  150. float2 txcoord0 : TEXCOORD0;
  151. };
  152. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  153. //
  154. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  155. VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
  156. {
  157. VS_OUTPUT_POST OUT;
  158. OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  159. OUT.txcoord0.xy=IN.txcoord0.xy;
  160. return OUT;
  161. }
  162. //skyrim shader specific externals, do not modify
  163. float4 _c1 : register(c1);
  164. float4 _c2 : register(c2);
  165. float4 _c3 : register(c3);
  166. float4 _c4 : register(c4);
  167. float4 _c5 : register(c5);
  168. float4 PS_D6EC7DD1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
  169. {
  170. float4 _oC0=0.0; //output
  171. float4 _c6=float4(0, 0, 0, 0);
  172. float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
  173. float4 r0;
  174. float4 r1;
  175. float4 r2;
  176. float4 r3;
  177. float4 r4;
  178. float4 r5;
  179. float4 r6;
  180. float4 r7;
  181. float4 r8;
  182. float4 r9;
  183. float4 r10;
  184. float4 r11;
  185. float4 _v0=0.0;
  186. _v0.xy=IN.txcoord0.xy;
  187. r1=tex2D(_s0, _v0.xy); //color
  188. r11=r1; //my bypass
  189. _oC0.xyz=r1.xyz; //for future use without game color corrections
  190. #ifdef APPLYGAMECOLORCORRECTION
  191. //apply original
  192. r0.x=1.0/_c2.y;
  193. r1=tex2D(_s4, _v0);
  194. r0.yz=r1.xy * _c1.y;
  195. r0.w=1.0/r0.y;
  196. r0.z=r0.w * r0.z;
  197. r1=tex2D(_s0, _v0);
  198. r1.xyz=r1 * _c1.y;
  199. r0.w=dot(_c7.xyz, r1.xyz);
  200. r1.w=r0.w * r0.z;
  201. r0.z=r0.z * r0.w + _c7.w;
  202. r0.z=1.0/r0.z;
  203. r0.x=r1.w * r0.x + _c7.w;
  204. r0.x=r0.x * r1.w;
  205. r0.x=r0.z * r0.x;
  206. if (r0.w<0) r0.x=_c6.x;
  207. r0.z=1.0/r0.w;
  208. r0.z=r0.z * r0.x;
  209. r0.x=saturate(-r0.x + _c2.x);
  210. r2=tex2D(_s3, _v0);//enb bloom
  211. // r2=tex2D(_s1, _v0);//skyrim bloom
  212. r2.xyz=r2 * _c1.y;
  213. r2.xyz=r0.x * r2;
  214. r1.xyz=r1 * r0.z + r2;
  215. r0.x=dot(r1.xyz, _c7.xyz);
  216. r1.w=_c7.w;
  217. r2=lerp(r0.x, r1, _c3.x);
  218. r1=r0.x * _c4 - r2;
  219. r1=_c4.w * r1 + r2;
  220. r1=_c3.w * r1 - r0.y;
  221. r0=_c3.z * r1 + r0.y;
  222. r1=-r0 + _c5;
  223. _oC0=_c5.w * r1 + r0;
  224. #endif //APPLYGAMECOLORCORRECTION
  225. float4 color=_oC0;
  226. //adaptation in time
  227. float4 Adaptation=tex2D(_s4, 0.5);
  228. float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
  229. // grayadaptation=1.0/grayadaptation;
  230. float4 xcolorbloom=tex2D(_s3, _v0.xy); //bloom
  231. float bchnd = 0.1;
  232. float hbs = 0.1;
  233. xcolorbloom=xcolorbloom*(1-pow(1.3,-xcolorbloom*35));
  234. // float maxb=max(xcolorbloom.x, max(xcolorbloom.y, xcolorbloom.z));
  235. // float violetamount=maxb/(maxb+EVioletShiftAmountInv);
  236. // xcolorbloom.xyz=lerp(xcolorbloom.xyz, xcolorbloom.xyz*EVioletShiftColor, violetamount*violetamount);
  237. //xcolorbloom=xcolorbloom*(1-pow(1.5,-xcolorbloom*1));
  238. //darkening if too bright screen
  239. float srcgray=max(color.x, max(color.y, color.z));
  240. //v1 not good for hdr, scaling required
  241. // color.xyz=color.xyz-(saturate(EAdaptationDarkeningAmount*grayadaptation) * color.xyz)*(1.0-saturate(srcgray*tempF2.y));
  242. //v2
  243. // color.xyz=color.xyz-(saturate(EAdaptationDarkeningAmount*grayadaptation) * color.xyz)*(1.0-saturate(srcgray/(srcgray+1.0*tempF2.y)));
  244. //v3
  245. //color.xyz=color.xyz-(saturate(1*grayadaptation) * color.xyz)*(1.0/(srcgray*0.7+1.0));//0.7 to modify!!!
  246. float Dpeasant3=1.05;
  247. float cgray=dot(xcolorbloom.xyz, 0.333);//luma
  248. float3 poweredcolor=pow(xcolorbloom.xyz, Dpeasant3);
  249. float newgray=dot(poweredcolor.xyz, 0.333);
  250. //xcolorbloom.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  251. float GlobalSaturationFactor=0.6;//todo modify this, negative or positive, you can move this at the beginning of shader file
  252. float middlegray=(xcolorbloom.r+xcolorbloom.g+xcolorbloom.b)*0.333;
  253. float3 diffcolor=xcolorbloom.rgb-middlegray;
  254. xcolorbloom.rgb+=diffcolor*GlobalSaturationFactor;
  255. xcolorbloom.rgb=max(xcolorbloom.rgb, 0.0); //output must be never negative, but "saturate" also work here and faster.
  256. //xcolorbloom.rgb *= pow(2.0f, 0.2);
  257. color.xyz+=xcolorbloom.xyz*EBloomAmount;
  258. //color=xcolorbloom*EBloomAmount + color;
  259. // color.xyz=color.xyz-((EAdaptationDarkeningAmount/(grayadaptation*2.0*tempF1.x+1.0)) * color.xyz)*(1.0/(srcgray*0.7+1.0));//0.7 to modify!!!
  260. //v4
  261. // color.xyz=color.xyz/(grayadaptation*EAdaptationAmount*tempF1.x+1.0);
  262. //color.xyz=color.xyz+(xcolorbloom.xyz);
  263. #ifdef ColourFilter
  264. //color.xyz*=EColorFilter;
  265. #endif
  266. #if (POSTPROCESS==1)
  267. grayadaptation=max(grayadaptation, 0.0);
  268. grayadaptation=min(grayadaptation, 50.0);
  269. //color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV1+EAdaptationMinV1);//*tempF1.x
  270. float cgray2=dot(color.xyz, float3(0.27, 0.67, 0.06));
  271. cgray2=pow(cgray2, EContrastV1);
  272. float3 poweredcolor2=pow(color.xyz, EColorSaturationV1);
  273. float newgray2=dot(poweredcolor2.xyz, float3(0.27, 0.67, 0.06));
  274. color.xyz=poweredcolor2.xyz*cgray2/(newgray2+0.0001);
  275. float3 luma=color.xyz;
  276. float lumamax=300.0;
  277. //color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
  278. #endif
  279. #if (POSTPROCESS==2)
  280. grayadaptation=max(grayadaptation, 0.0);
  281. grayadaptation=min(grayadaptation, 50.0);
  282. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV2+EAdaptationMinV2);//*tempF1.x
  283. //color.xyz*=EBrightnessV2;
  284. color.xyz+=0.000001;
  285. float3 xncol=normalize(color.xyz);
  286. float3 scl=color.xyz/xncol.xyz;
  287. scl=pow(scl, EIntensityContrastV2);
  288. xncol.xyz=pow(xncol.xyz, EColorSaturationV2);
  289. color.xyz=scl*xncol.xyz;
  290. float lumamax=EToneMappingOversaturationV2;
  291. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV2);
  292. #endif
  293. #if (POSTPROCESS==3)
  294. float EBrightnessV2=1.0;
  295. //color.xyz*=EBrightnessV2;
  296. float3 dnsatd = float3( 1.05, 1.05, 1.065 );
  297. //float bchnd = 0.1;
  298. //float hbs = 0.1;
  299. float3 oldcoln = color.xyz; // RGB controlled saturation
  300. // so sweet thx HD6!
  301. static const float LUMINANCE = float3(0.333,0.333,0.333);
  302. color.xyz *= dnsatd;
  303. //float3 greycn = float3(0.299, 0.587, 0.114);
  304. float3 greycn = LUMINANCE;//float3(0.333,0.333,0.333); // screw perception
  305. //float3 greycn = float3(0.811,0.523,0.996);
  306. color.xyz += (oldcoln.x-(oldcoln.x*dnsatd.x)) * greycn.x;
  307. color.xyz += (oldcoln.y-(oldcoln.y*dnsatd.y)) * greycn.y;
  308. color.xyz += (oldcoln.z-(oldcoln.z*dnsatd.z)) * greycn.z;
  309. float fRatio = 0.4; // blend ratio (0-1)
  310. //float fRatio = 0.425;
  311. float moodR = 0.735; // mood color red component
  312. float moodG = 0.62; // mood color green component
  313. float moodB = 0.5; // mood color blue component
  314. float4 colInput = color;
  315. float4 colMood = 1.0f;
  316. colMood.r = moodR;
  317. colMood.g = moodG;
  318. colMood.b = moodB;
  319. float fLum = ( colInput.r + colInput.g + colInput.b ) / 3;
  320. colMood = lerp(0, colMood, saturate(fLum * 2.0));
  321. colMood = lerp(colMood, 1, saturate(fLum - 0.5) * 2.0);
  322. float4 colOutput = lerp(colInput, colMood, saturate(fLum * fRatio));
  323. color.rgb=max(0, colOutput);
  324. float Contrast = 0.255;
  325. color.xyz = saturate(color.xyz);
  326. color.xyz = lerp(color.xyz, 0.5 * (1 + sin((color.xyz - 0.5)*3.1415926)), Contrast);
  327. grayadaptation=max(grayadaptation, 0.0);
  328. grayadaptation=min(grayadaptation, 50.0);
  329. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV3+EAdaptationMinV3);//*tempF1.x
  330. float lumamax=EToneMappingOversaturationV3;
  331. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
  332. float3 correctedcolor=saturate((1-color*1)*0.05);
  333. //color.rgb=saturate(color.rgb-correctedcolor);
  334. //color.rgb=pow(color.rgb,2.45)*0.895;
  335. float3 LUMINANCE2 = float3(0.2125, 0.7154, 0.0721); // cinematic perception of colors
  336. float BP_factor = 0.1;
  337. float luma2 = dot(color.xyz, LUMINANCE2);
  338. float3 blend = luma2.xxx;
  339. //float L = min(1, max(0, 10*(luma2 - 0.45)));
  340. float L=clamp((luma2 - 0.45) * 10, 0, 1);
  341. float3 result1 = 2.0 * color.xyz * blend;
  342. float3 result2 = 1.0 - 2.0*(1.0 - blend)*(1.0 - color.xyz);
  343. float3 newColor = lerp(result1.xyz, result2.xyz, L);
  344. float3 mixRGB = BP_factor * newColor.xyz;
  345. mixRGB += ((1.0f - BP_factor) * color.xyz);
  346. //color.xyz = mixRGB;
  347. float Exposure=0.45;
  348. color.rgb *= pow(2.0f, Exposure);
  349. #endif
  350. //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
  351. //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
  352. //color.xyz*=0.7;
  353. #if (POSTPROCESS==4)
  354. grayadaptation=max(grayadaptation, 0.0);
  355. grayadaptation=min(grayadaptation, 50.0);
  356. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV4+EAdaptationMinV4);
  357. float Y = dot(color.xyz, float3(0.299, 0.587, 0.101)); //0.299 * R + 0.587 * G + 0.114 * B;
  358. float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.43)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  359. float V = dot(color.xyz, float3(0.615, -0.51499, -0.092)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  360. Y=pow(Y, EBrightnessCurveV4);
  361. Y=Y*EBrightnessMultiplierV4;
  362. // Y=Y/(Y+EBrightnessToneMappingCurveV4);
  363. // float desaturatefact=saturate(Y*Y*Y*1.7);
  364. // U=lerp(U, 0.0, desaturatefact);
  365. // V=lerp(V, 0.0, desaturatefact);
  366. color.xyz=V * float3(1.11, -0.58, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  367. color.xyz=max(color.xyz, 0.0);
  368. color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
  369. float3 dnsatd = float3( 1.2, 1.1, 1.2 );
  370. float bchnd = 0.1;
  371. float hbs = 0.1;
  372. float3 oldcoln = color.xyz; // RGB controlled saturation
  373. // so sweet thx HD6!
  374. static const float LUMINANCE = float3(0.2125, 0.7154, 0.0721);
  375. color.xyz *= dnsatd;
  376. //float3 greycn = float3(0.299, 0.587, 0.114);
  377. float3 greycn = LUMINANCE;//float3(0.333,0.333,0.333); // screw perception
  378. //float3 greycn = float3(0.811,0.523,0.996);
  379. color.xyz += (oldcoln.x-(oldcoln.x*dnsatd.x)) * greycn.x;
  380. color.xyz += (oldcoln.y-(oldcoln.y*dnsatd.y)) * greycn.y;
  381. color.xyz += (oldcoln.z-(oldcoln.z*dnsatd.z)) * greycn.z;
  382. float Dpeasant3=1.1;
  383. float cgray=dot(color.xyz, 0.333);//luma
  384. float3 poweredcolor=pow(color.xyz, Dpeasant3);
  385. float newgray=dot(poweredcolor.xyz, 0.333);
  386. //color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  387. //color.rgb=pow(color.rgb,0.95)*1.15;
  388. float Contrast = 0.5;
  389. color.xyz = saturate(color.xyz);
  390. color.xyz = lerp(color.xyz, 0.5 * (1 + sin((color.xyz - 0.5)*3.1415926)), Contrast);
  391. #endif
  392. //pallete texture (0.082+ version feature)
  393. #ifdef E_CC_PALETTE
  394. color.rgb=saturate(color.rgb);
  395. float3 brightness=Adaptation.xyz;//tex2D(_s4, 0.5);//adaptation luminance
  396. // brightness=saturate(brightness);//old version from ldr games
  397. brightness=(brightness/(brightness+1.0));//new version
  398. brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
  399. float3 palette;
  400. float4 uvsrc=0.0;
  401. uvsrc.y=brightness.r;
  402. uvsrc.x=color.r;
  403. palette.r=tex2Dlod(_s7, uvsrc).r;
  404. uvsrc.x=color.g;
  405. uvsrc.y=brightness.g;
  406. palette.g=tex2Dlod(_s7, uvsrc).g;
  407. uvsrc.x=color.b;
  408. uvsrc.y=brightness.b;
  409. palette.b=tex2Dlod(_s7, uvsrc).b;
  410. color.rgb=palette.rgb;
  411. #endif //E_CC_PALETTE
  412. /*
  413. //temporary testing
  414. color.xyz=tex2D(_s0, _v0.xy);
  415. //color.xyz=xcolorbloom.xyz*tempF1.x;
  416. //color.xyz=pow(color.xyz, 0.5);
  417. color.xyz+=(xcolorbloom.xyz-color.xyz)*tempF1.y;
  418. //color.xyz=xcolorbloom.xyz*tempF1.y;
  419. color.xyz=color.xyz*tempF1.x;
  420. //color.xyz=color.xyz/(color.xyz +1.0*tempF1.z);
  421. color.xyz=(color.xyz * (1.0 + color.xyz/40))/(color.xyz + EToneMappingCurveV3);
  422. Adaptation=tex2D(_s4, 0.5);
  423. grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
  424. grayadaptation=max(grayadaptation, 0.0);
  425. grayadaptation=min(grayadaptation, 50.0);
  426. // color.xyz=Adaptation*2;//*tempF1.x
  427. //color.xyz=tex2D(_s0, _v0.xy)*1.3;
  428. */
  429. // color.xyz=tex2D(_s0, _v0.xy)*pow(tempF1.x,4);
  430. // color.xyz=max(xcolorbloom.xyz, tex2D(_s0, _v0.xy).xyz)*pow(tempF1.x,4)*0.7;
  431. _oC0.w=1.0;
  432. _oC0.xyz=color.xyz;
  433. return _oC0;
  434. }
  435. //switch between vanilla and mine post processing
  436. #ifndef ENB_FLIPTECHNIQUE
  437. technique Shader_D6EC7DD1
  438. #else
  439. technique Shader_ORIGINALPOSTPROCESS
  440. #endif
  441. {
  442. pass p0
  443. {
  444. VertexShader = compile vs_3_0 VS_Quad();
  445. PixelShader = compile ps_3_0 PS_D6EC7DD1();
  446. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  447. ZEnable=FALSE;
  448. ZWriteEnable=FALSE;
  449. CullMode=NONE;
  450. AlphaTestEnable=FALSE;
  451. AlphaBlendEnable=FALSE;
  452. SRGBWRITEENABLE=FALSE;
  453. }
  454. }
  455. //original shader of post processing
  456. #ifndef ENB_FLIPTECHNIQUE
  457. technique Shader_ORIGINALPOSTPROCESS
  458. #else
  459. technique Shader_D6EC7DD1
  460. #endif
  461. {
  462. pass p0
  463. {
  464. VertexShader = compile vs_3_0 VS_Quad();
  465. PixelShader=
  466. asm
  467. {
  468. // Parameters:
  469. // sampler2D Avg;
  470. // sampler2D Blend;
  471. // float4 Cinematic;
  472. // float4 ColorRange;
  473. // float4 Fade;
  474. // sampler2D Image;
  475. // float4 Param;
  476. // float4 Tint;
  477. // Registers:
  478. // Name Reg Size
  479. // ------------ ----- ----
  480. // ColorRange c1 1
  481. // Param c2 1
  482. // Cinematic c3 1
  483. // Tint c4 1
  484. // Fade c5 1
  485. // Image s0 1
  486. // Blend s1 1
  487. // Avg s2 1
  488. //s0 bloom result
  489. //s1 color
  490. //s2 is average color
  491. ps_3_0
  492. def c6, 0, 0, 0, 0
  493. //was c0 originally
  494. def c7, 0.212500006, 0.715399981, 0.0720999986, 1
  495. dcl_texcoord v0.xy
  496. dcl_2d s0
  497. dcl_2d s1
  498. dcl_2d s2
  499. rcp r0.x, c2.y
  500. texld r1, v0, s2
  501. mul r0.yz, r1.xxyw, c1.y
  502. rcp r0.w, r0.y
  503. mul r0.z, r0.w, r0.z
  504. texld r1, v0, s1
  505. mul r1.xyz, r1, c1.y
  506. dp3 r0.w, c7, r1
  507. mul r1.w, r0.w, r0.z
  508. mad r0.z, r0.z, r0.w, c7.w
  509. rcp r0.z, r0.z
  510. mad r0.x, r1.w, r0.x, c7.w
  511. mul r0.x, r0.x, r1.w
  512. mul r0.x, r0.z, r0.x
  513. cmp r0.x, -r0.w, c6.x, r0.x
  514. rcp r0.z, r0.w
  515. mul r0.z, r0.z, r0.x
  516. add_sat r0.x, -r0.x, c2.x
  517. texld r2, v0, s0
  518. mul r2.xyz, r2, c1.y
  519. mul r2.xyz, r0.x, r2
  520. mad r1.xyz, r1, r0.z, r2
  521. dp3 r0.x, r1, c7
  522. mov r1.w, c7.w
  523. lrp r2, c3.x, r1, r0.x
  524. mad r1, r0.x, c4, -r2
  525. mad r1, c4.w, r1, r2
  526. mad r1, c3.w, r1, -r0.y
  527. mad r0, c3.z, r1, r0.y
  528. add r1, -r0, c5
  529. mad oC0, c5.w, r1, r0
  530. };
  531. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  532. ZEnable=FALSE;
  533. ZWriteEnable=FALSE;
  534. CullMode=NONE;
  535. AlphaTestEnable=FALSE;
  536. AlphaBlendEnable=FALSE;
  537. SRGBWRITEENABLE=FALSE;
  538. }
  539. }