Advertisement
Guest User

Kabloom! DNI seperation

a guest
Jan 23rd, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.39 KB | None | 0 0
  1. /**CC BY-SA 4.0 Kermles (Graham E. Hemsley) 06/17/14 14:15
  2. =======================================================================================================================
  3. ------------------------------------------------------------------------------------------------------------
  4. Kabloom! Kermles was here~! Thanks to prod80 for assistance and many others around enbdev and web for ideas!
  5. Find me on enbdev.com and nexusmods.com if you need help or want to let me know what you think!
  6. ------------------------------------------------------------------------------------------------------------
  7. Credits:
  8. Prod80
  9. Darel Rex Finley
  10. Boris Vorontsov
  11. ------------------------------------------------------------------------------------------------------------
  12. This file and its contents are licensed under Creative Commons Attribution-ShareAlike 4.0 International
  13. Usage, modification and redistribution of this file is permitted under the terms of this license
  14. http://creativecommons.org/licenses/by-sa/4.0/
  15. ------------------------------------------------------------------------------------------------------------
  16. =======================================================================================================================
  17. **/
  18. /*
  19. * Blend modes:
  20. * 0: Off
  21. * 1: Addition
  22. * 2: Opacity
  23. * 3: Lighten
  24. * 4: Lighten/opacity hybrid
  25. * 5: Luma-based
  26. * 6: Screen/add hybrid
  27. * 7: Screen/opacity hybrid
  28. * 8: Screen/lighten/opacity hybrid
  29. */
  30. /*
  31. =======================================================================================================================
  32. Globals
  33. =======================================================================================================================
  34. */
  35.  
  36. //===================================================================================================================//
  37. float InBlackD /* Any bloom darker than this will map to the minimum output value */
  38. <
  39. string UIName = "Kabloom levels: black input day" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  40. > = { 0.0f };
  41.  
  42. float InBlackN
  43. <
  44. string UIName = "Kabloom levels: black input night" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  45. > = { 0.0f };
  46.  
  47. float InBlackI
  48. <
  49. string UIName = "Kabloom levels: black input interior" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  50. > = { 0.0f };
  51. //===================================================================================================================//
  52. float InWhiteD /* Any bloom brighter than this will map to the maximum output value */
  53. <
  54. string UIName = "Kabloom levels: white input day" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  55. > = { 1.0f };
  56.  
  57. float InWhiteN
  58. <
  59. string UIName = "Kabloom levels: white input night" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  60. > = { 1.0f };
  61.  
  62. float InWhiteI
  63. <
  64. string UIName = "Kabloom levels: white input interior" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  65. > = { 1.0f };
  66. //===================================================================================================================//
  67. float InGammaD /* Preprocessing gamma curve */
  68. <
  69. string UIName = "Kabloom levels: input gamma day" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 10.0f;
  70. > = { 1.0f };
  71.  
  72. float InGammaN
  73. <
  74. string UIName = "Kabloom levels: input gamma night" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 10.0f;
  75. > = { 1.0f };
  76.  
  77. float InGammaI
  78. <
  79. string UIName = "Kabloom levels: input gamma interior" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 10.0f;
  80. > = { 1.0f };
  81. //===================================================================================================================//
  82. float OutBlackD /* Minimum preprocessing bloom output */
  83. <
  84. string UIName = "Kabloom levels: black output day" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  85. > = { 0.0f };
  86.  
  87. float OutBlackN
  88. <
  89. string UIName = "Kabloom levels: black output night" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  90. > = { 0.0f };
  91.  
  92. float OutBlackI
  93. <
  94. string UIName = "Kabloom levels: black output interior" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  95. > = { 0.0f };
  96. //===================================================================================================================//
  97. float OutWhiteD /* Maximum preprocessing bloom output */
  98. <
  99. string UIName = "Kabloom levels: white output day" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  100. > = { 1.0f };
  101.  
  102. float OutWhiteN
  103. <
  104. string UIName = "Kabloom levels: white output night" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  105. > = { 1.0f };
  106.  
  107. float OutWhiteI
  108. <
  109. string UIName = "Kabloom levels: white output interior" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 1.0f;
  110. > = { 1.0f };
  111. //===================================================================================================================//
  112. float BloomBrightnessD /* Controls bloom intensity before haze reduction */
  113. <
  114. string UIName = "Kabloom spread control: input intensity day" ; string UIWidget = "Spinner" ; float UIMin = -100.0f; float UIMax = 100.0f;
  115. > = { 0.0f };
  116.  
  117. float BloomBrightnessN
  118. <
  119. string UIName = "Kabloom spread control: input intensity night" ; string UIWidget = "Spinner" ; float UIMin = -100.0f; float UIMax = 100.0f;
  120. > = { 0.0f };
  121.  
  122. float BloomBrightnessI
  123. <
  124. string UIName = "Kabloom spread control: input intensity interior" ; string UIWidget = "Spinner" ; float UIMin = -100.0f; float UIMax = 100.0f;
  125. > = { 0.0f };
  126. //===================================================================================================================//
  127. float BloomSaturationD /* Determines how colorful bloom looks */
  128. <
  129. string UIName = "Kabloom spread control: saturation day" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 10.0f;
  130. > = { 1.0f };
  131.  
  132. float BloomSaturationN
  133. <
  134. string UIName = "Kabloom spread control: saturation night" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 10.0f;
  135. > = { 1.0f };
  136.  
  137. float BloomSaturationI
  138. <
  139. string UIName = "Kabloom spread control: saturation interior" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 10.0f;
  140. > = { 1.0f };
  141. //===================================================================================================================//
  142. float BloomContrastD /* Controls bloom contrast */
  143. <
  144. string UIName = "Kabloom spread control: contrast day" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 100.0f;
  145. > = { 1.0f };
  146.  
  147. float BloomContrastN
  148. <
  149. string UIName = "Kabloom spread control: contrast night" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 100.0f;
  150. > = { 1.0f };
  151.  
  152. float BloomContrastI
  153. <
  154. string UIName = "Kabloom spread control: contrast interior" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 100.0f;
  155. > = { 1.0f };
  156. //===================================================================================================================//
  157. float BloomSensitivityD /* Reduces haze based on brightness */
  158. <
  159. string UIName = "Kabloom spread control: sensitivity day" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 100.0f;
  160. > = { 1.0f };
  161.  
  162. float BloomSensitivityN
  163. <
  164. string UIName = "Kabloom spread control: sensitivity night" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 100.0f;
  165. > = { 1.0f };
  166.  
  167. float BloomSensitivityI
  168. <
  169. string UIName = "Kabloom spread control: sensitivity interior" ; string UIWidget = "Spinner" ; float UIMin = 0.0f; float UIMax = 100.0f;
  170. > = { 1.0f };
  171. //===================================================================================================================//
  172. float BloomIntensityD /* Controls bloom intensity after to haze reduction */
  173. <
  174. string UIName = "Kabloom spread control: output intensity day" ; string UIWidget = "Spinner" ; float UIMin = -100.0f; float UIMax = 100.0f;
  175. > = { 0.0f };
  176.  
  177. float BloomIntensityN
  178. <
  179. string UIName = "Kabloom spread control: output intensity night" ; string UIWidget = "Spinner" ; float UIMin = -100.0f; float UIMax = 100.0f;
  180. > = { 0.0f };
  181.  
  182. float BloomIntensityI
  183. <
  184. string UIName = "Kabloom spread control: output intensity interior" ; string UIWidget = "Spinner" ; float UIMin = -100.0f; float UIMax = 100.0f;
  185. > = { 0.0f };
  186. //===================================================================================================================//
  187. float3 RGBBalanceD /* Strength of rgb channels */
  188. <
  189. string UIName = "Kabloom color control: color balance day" ; string UIWidget = "Color" ; float UIMin = 0.0f; float UIMax = 1.0f;
  190. > = { float3(1.0f, 1.0f, 1.0f) };
  191.  
  192. float3 RGBBalanceN
  193. <
  194. string UIName = "Kabloom color control: color balance night" ; string UIWidget = "Color" ; float UIMin = 0.0f; float UIMax = 1.0f;
  195. > = { float3(1.0f, 1.0f, 1.0f) };
  196.  
  197. float3 RGBBalanceI
  198. <
  199. string UIName = "Kabloom color control: color balance interior" ; string UIWidget = "Color" ; float UIMin = 0.0f; float UIMax = 1.0f;
  200. > = { float3(1.0f, 1.0f, 1.0f) };
  201. //===================================================================================================================//
  202. float3 RGBWeightsD /* How much each colour in the scene will be bloomed */
  203. <
  204. string UIName = "Kabloom misc: bloom strength weights day" ; string UIWidget = "Color" ; float UIMin = 0.0f; float UIMax = 1.0f;
  205. > = { float3(0.0, 0.0f, 0.0f) };
  206.  
  207. float3 RGBWeightsN
  208. <
  209. string UIName = "Kabloom misc: bloom strength weights night" ; string UIWidget = "Color" ; float UIMin = 0.0f; float UIMax = 1.0f;
  210. > = { float3(0.0, 0.0f, 0.0f) };
  211.  
  212. float3 RGBWeightsI
  213. <
  214. string UIName = "Kabloom misc: bloom strength weights interior" ; string UIWidget = "Color" ; float UIMin = 0.0f; float UIMax = 1.0f;
  215. > = { float3(0.0, 0.0f, 0.0f) };
  216. //===================================================================================================================//
  217. int BlendMode /* Decides how the bloom gets added to the scene */
  218. <
  219. string UIName = "Kabloom blending: blend mode" ; string UIWidget = "Slider" ; float UIMin = 0; float UIMax = 8;
  220. > = { 1 };
  221. //===================================================================================================================//
  222. float BlendAmountD /* Controls opacity for certain blend modes */
  223. <
  224. string UIName = "Kabloom blending: blend amount day" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 100.0f;
  225. > = { 1.0f };
  226.  
  227. float BlendAmountN
  228. <
  229. string UIName = "Kabloom blending: blend amount night" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 100.0f;
  230. > = { 1.0f };
  231.  
  232. float BlendAmountI
  233. <
  234. string UIName = "Kabloom blending: blend amount interior" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 100.0f;
  235. > = { 1.0f };
  236. //===================================================================================================================//
  237. float BlendOpacityD /* Controls opacity for certain blend modes */
  238. <
  239. string UIName = "Kabloom blending: blend opacity day" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 100.0f;
  240. > = { 1.0f };
  241.  
  242. float BlendOpacityN
  243. <
  244. string UIName = "Kabloom blending: blend opacity night" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 100.0f;
  245. > = { 1.0f };
  246.  
  247. float BlendOpacityI
  248. <
  249. string UIName = "Kabloom blending: blend opacity interior" ; string UIWidget = "Slider" ; float UIMin = 0.0f; float UIMax = 100.0f;
  250. > = { 1.0f };
  251. //===================================================================================================================//
  252.  
  253. /*
  254. =======================================================================================================================
  255. Functions
  256. =======================================================================================================================
  257. */
  258.  
  259. /*
  260. =======================================================================================================================
  261. Takes a 3 component vector input and alters it so that the sum of its components will equal the specified sum value
  262. //thanks prod80
  263. =======================================================================================================================
  264. */
  265. float3 sumTo(in float3 weights, in float sumValue)
  266. {
  267. if(any(weights.rgb))
  268. {
  269. return weights.rgb / dot(weights.rgb, 1.0f / sumValue);
  270. }
  271. else
  272. {
  273. return sumValue.xxx / 3.0f;
  274. }
  275. }
  276. /*
  277. ===================================================================================================c====================
  278. Perceptually-weighted euclidean-distance luma calculation //thanks Darel Rex Finley
  279. =======================================================================================================================
  280. */
  281. float pLuma(in float3 color)
  282. {
  283. return sqrt(dot(pow(color.rgb, 2.0f), float3(0.299f, 0.587f, 0.114f)));
  284. }
  285. /*
  286. =======================================================================================================================
  287. Configurable luma calculation with perceptual weighting enforced for a vector of (0, 0, 0)
  288. =======================================================================================================================
  289. */
  290. float cLuma(in float3 color, in float3 lumaWeights)
  291. {
  292. if(any(lumaWeights.rgb))
  293. {
  294. lumaWeights.rgb = sumTo(lumaWeights.rgb, 1.0f);
  295. }
  296. else
  297. {
  298. lumaWeights.rgb = float3(0.299f, 0.587f, 0.114f);
  299. }
  300. return sqrt(dot(pow(color.rgb, 2.0f), lumaWeights.rgb));
  301. }
  302. /*
  303. =======================================================================================================================
  304. Saturation shader that maintains color ratios (thanks prod80) //TODO: Test saturation above 2.0
  305. =======================================================================================================================
  306. */
  307. float3 adjustSaturation(in float3 color, in float saturation)
  308. {
  309. /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  310. float grey = dot( color.rgb, float3(0.3333f, 0.3333f, 0.3333f));
  311. float3 desat = lerp(grey, color.rgb, saturation);
  312. float cmin = min(min(color.r, color.g), color.b);
  313. float cmax = max(max(color.r, color.g), color.b);
  314. float csaturation = cmax - cmin;
  315. float vibrance = saturation - 1.0f;
  316. float3 sat = lerp(grey, color.rgb, (1.0f + (vibrance * (1.0f - (sign(vibrance) * csaturation)))));
  317. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  318. if(saturation < 1.0f)
  319. {
  320. color.rgb = desat.rgb;
  321. }
  322. else
  323. {
  324. color.rgb = sat.rgb;
  325. }
  326. return color.rgb;
  327. }
  328. /*
  329. =======================================================================================================================
  330. Simple contrast adjustment //TODO: Try basic add/subtract/multiply version
  331. =======================================================================================================================
  332. */
  333. float3 adjustContrast(in float3 color, in float contrast )
  334. {
  335. color.rgb = max
  336. (
  337. 0.0f,
  338. pow(color.rgb, max(0.0f, contrast.xxx)) /
  339. (
  340. pow(saturate(color.rgb), max(0.0f, contrast.xxx)) + pow
  341. (
  342. 1.0f - saturate(color.rgb),
  343. max(0.0f, contrast.xxx)
  344. )
  345. )
  346. );
  347. return color.rgb;
  348. }
  349. /*
  350. =======================================================================================================================
  351. Photoshop-style levels adjustment with gamma control //thanks prod80
  352. =======================================================================================================================
  353. */
  354. float3 levelsAdjust
  355. (
  356. in float3 color,
  357. in float inBlack,
  358. in float inGamma,
  359. in float inWhite,
  360. in float outBlack,
  361. in float outWhite
  362. )
  363. {
  364. color = saturate(color.rgb);
  365. color.rgb = pow(max(color.rgb - inBlack, 0.0f)
  366. / max(inWhite - inBlack, 0.0001f), inGamma)
  367. * max(outWhite - outBlack, 0.0001f) + outBlack;
  368. return color.rgb;
  369. }
  370. /*
  371. =======================================================================================================================
  372. Main effect code //TODO: Add and get rid of some blend modes, feedback? :)
  373. =======================================================================================================================
  374. */
  375. float3 kaBloom
  376. (
  377. in sampler2D _s3,
  378. in float4 _v0,
  379. in float3 color,
  380. in float ENightDayFactor,
  381. in float EInteriorFactor,
  382. in float InBlackD,
  383. in float InBlackN,
  384. in float InBlackI,
  385. in float InWhiteD,
  386. in float InWhiteN,
  387. in float InWhiteI,
  388. in float InGammaD,
  389. in float InGammaN,
  390. in float InGammaI,
  391. in float OutBlackD,
  392. in float OutBlackN,
  393. in float OutBlackI,
  394. in float OutWhiteD,
  395. in float OutWhiteN,
  396. in float OutWhiteI,
  397. in float BloomBrightnessD,
  398. in float BloomBrightnessN,
  399. in float BloomBrightnessI,
  400. in float BloomContrastD,
  401. in float BloomContrastN,
  402. in float BloomContrastI,
  403. in float BloomSaturationD,
  404. in float BloomSaturationN,
  405. in float BloomSaturationI,
  406. in float BloomSensitivityD,
  407. in float BloomSensitivityN,
  408. in float BloomSensitivityI,
  409. in float BloomIntensityD,
  410. in float BloomIntensityN,
  411. in float BloomIntensityI,
  412. in float3 RGBBalanceD,
  413. in float3 RGBBalanceN,
  414. in float3 RGBBalanceI,
  415. in float3 RGBWeightsD,
  416. in float3 RGBWeightsN,
  417. in float3 RGBWeightsI,
  418. in int BlendMode,
  419. in float BlendAmountD,
  420. in float BlendAmountN,
  421. in float BlendAmountI,
  422. in float BlendOpacityD,
  423. in float BlendOpacityN,
  424. in float BlendOpacityI
  425. )
  426. {
  427. if(BlendMode)
  428. {
  429. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  430. /* Load bloom texture */
  431. float4 kabloom = tex2D(_s3, _v0.xy);
  432. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  433. /* Levels// */
  434. kabloom.rgb = levelsAdjust( kabloom.rgb,
  435. lerp( lerp( InBlackN, InBlackD, ENightDayFactor ), InBlackI, EInteriorFactor ),
  436. lerp( lerp( InGammaN, InGammaD, ENightDayFactor ), InGammaI, EInteriorFactor ),
  437. lerp( lerp( InWhiteN, InWhiteD, ENightDayFactor ), InWhiteI, EInteriorFactor ),
  438. lerp( lerp( OutBlackN, OutBlackD, ENightDayFactor ), OutBlackI, EInteriorFactor ),
  439. lerp( lerp( OutWhiteN, OutWhiteD, ENightDayFactor ), OutWhiteI, EInteriorFactor )
  440. );
  441. /* Color Balance// */
  442. kabloom.rgb *= sumTo( lerp( lerp( RGBBalanceN.rgb, RGBBalanceD, ENightDayFactor ), RGBBalanceI, EInteriorFactor ), 3);
  443. /* Input intensity// */
  444. kabloom.rgb *= pow(2.0f, lerp( lerp( BloomBrightnessN, BloomBrightnessD, ENightDayFactor ), BloomBrightnessI, EInteriorFactor ) );
  445. /* Contrast// */
  446. kabloom.rgb = adjustContrast( kabloom.rgb, lerp( lerp( BloomContrastN, BloomContrastD, ENightDayFactor ), BloomContrastI, EInteriorFactor ) );
  447. /* Saturation// */
  448. kabloom.rgb = adjustSaturation(kabloom.rgb, lerp( lerp( BloomSaturationN, BloomSaturationD, ENightDayFactor ), BloomSaturationI, EInteriorFactor ) );
  449. /* Sensitivity for haze reduction// */
  450. float3 RGBWeights = lerp( lerp( RGBWeightsN.rgb, RGBWeightsD, ENightDayFactor ), RGBWeightsI.rgb, EInteriorFactor );
  451. kabloom.rgb = max
  452. (
  453. 0.0f,
  454. pow
  455. (
  456. kabloom.rgb,
  457. max( 0.0f, ( 1.0f / max( 0.0001f, ( lerp( lerp( BloomSensitivityN, BloomSensitivityD, ENightDayFactor ), BloomSensitivityI, EInteriorFactor ) * cLuma( kabloom.rgb, RGBWeights.rgb ) ) ) ) )
  458. )
  459. );
  460. /* Output intensity// */
  461. kabloom.rgb *= pow(2.0f, lerp( lerp( BloomIntensityN, BloomIntensityD, ENightDayFactor ), BloomIntensityI, EInteriorFactor ) );
  462. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  463. float tempLuma = cLuma(kabloom.rgb, RGBWeights.rgb);
  464. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  465. /* Blend modes// */
  466.  
  467. float BlendAmount = lerp( lerp( BlendAmountN, BlendAmountD, ENightDayFactor ), BlendAmountI, EInteriorFactor );
  468. float BlendOpacity = lerp( lerp( BlendOpacityN, BlendOpacityD, ENightDayFactor ), BlendOpacityI, EInteriorFactor );
  469.  
  470. if(BlendMode == 2) /* Opacity */
  471. {
  472. color.rgb = lerp(color.rgb, kabloom.rgb * BlendAmount, BlendOpacity);
  473. }
  474. else if(BlendMode == 3) /* Lighten */
  475. {
  476. color.rgb = max(color.rgb, kabloom * BlendAmount);
  477. }
  478. else if(BlendMode == 4) /* Lighten/opacity */
  479. {
  480. color.rgb = max(color.rgb, lerp(color.rgb, kabloom.rgb * BlendAmount, BlendOpacity));
  481. }
  482. else if(BlendMode == 5) /* Brightness-dependent */
  483. {
  484. color.rgb = lerp(color.rgb, kabloom.rgb, saturate(pow(tempLuma, 1.0f / tempLuma) * BlendAmount));
  485. }
  486. else if(BlendMode == 6) /* Screen add */ //thanks prod80
  487. {
  488. color.rgb += 1.0f - (1.0f - saturate(kabloom.rgb)) * (1.0f - saturate(kabloom.rgb * BlendAmount));
  489. }
  490. else if(BlendMode == 7) /* Screen/opacity */
  491. {
  492. color.rgb = max
  493. (
  494. 0.0f,
  495. lerp
  496. (
  497. color.rgb,
  498. (1.0f - (1.0f - saturate(kabloom.rgb)) * (1.0f - saturate(kabloom.rgb * BlendAmount))),
  499. BlendOpacity
  500. )
  501. );
  502. }
  503. else if(BlendMode == 8) /* Screen/lighten/opacity */
  504. {
  505. color.rgb = max
  506. (
  507. 0.0f,
  508. max
  509. (
  510. color.rgb,
  511. lerp
  512. (
  513. color.rgb,
  514. (
  515. 1.0f - (1.0f - saturate(kabloom.rgb)) *
  516. (1.0f - saturate(kabloom.rgb * BlendAmount))
  517. ),
  518. BlendOpacity
  519. )
  520. )
  521. );
  522. }
  523. else /* Addition */
  524. {
  525. color.rgb += kabloom.rgb * BlendAmount;
  526. }
  527. }
  528. return color.rgb;
  529. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement