Guest User

ALPHA_P_S_2020

a guest
Jan 3rd, 2020
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.47 KB | None | 0 0
  1. /*================================================================================
  2.  
  3.  
  4. ALPHA Photography Suite 2020 [ v4 - January 2020 ]
  5.  
  6.  
  7.  
  8. This work is licensed under the Creative Commons
  9. Attribution-ShareAlike 4.0 International License.
  10. To view a copy of this license, visit
  11. http://creativecommons.org/licenses/by-sa/4.0/.
  12.  
  13.  
  14.  
  15. ALPHA Photography Suite 2020 - features:
  16. - Advanced Filmic Tonemapping [ Settings like Linear White Point Value, Exposure, Shoulder & Toe Strength, Linear Angle etc will be at your disposal // "A filmic curve has three parts, a linear section, a shoulder, and a toe. The short version is that a toe gives you crisper blacks, a shoulder gives you a softer transition to your overexposed highlights, and the linear section should look relatively unchanged." ]
  17.  
  18. - Non-uniform Random Organic Film Grain [ granularity ] Emulation, this analog film grain emulation includes many finetuning settings. [ Film grain or granularity is the random optical texture of processed photographic film due to the presence of small particles of a metallic silver, or dye clouds, developed from silver halide that have received enough photons. While film grain is a function of such particles [ or dye clouds ] it is not the same thing as such. It is an optical effect, the magnitude of which [ amount of grain ] depends on both the film stock and the definition at which it is observed. Digital photography does not exhibit film grain, since there is no film for any grain to exist within. ]
  19.  
  20. - Automatic adjustments to Film Grain depending on screen luminance [ Screen area whose average brightness triggers adaption. 1 to 7 // 1 = only the center of the image is used // 7 = the whole image is used ]
  21.  
  22. - Natural / organic looking film-grain with protection for the high & low levels [ the distribution of the naural-looking grain should be more prominent on the mid-tones and it should became lesser visible approaching white and black, but you can change this approach with the available finetuning settings ]
  23.  
  24. - Automatic exposure [ so no eye-burning / overexposed skies ]
  25.  
  26. - 15 presets with B/W Camera Film emulation [ like the beloved Kodak Tri-X ]
  27.  
  28. - Fast -Hue Brightness Contrast Saturation- control
  29.  
  30.  
  31.  
  32. Some background info:
  33. As an extra this "5 shaders into 1" is faster [ total performance impact hitting around 1 to 2 fps ] than the total of 5 single shaders being used / stacked.
  34.  
  35. First of all, I'm not a hlsl-code writer nor [ want to ] pretend to be, this "ALPHA Photography Suite 2020" shader is based upon 5 main shaders, a compilation of 5 main existing shaders, which through an extensive time of trial & error is modified & tweaked, layer after layer.
  36.  
  37. As an huge long-term photolover of classic b/w [ analog ] grainy photography & always in search of the perfect holy grain [ to be honest most times I truly dislike the defaults forced-looking grain in games & disable the defaults distracting grainy awfulness, most UE4-based games have it enabled by default though this can be changed by altering the file Engine.ini and with r.Tonemapper.Quality=3 [ 3 or lower for removing film grain; 5=max ] and r.Tonemapper.GrainQuantization=0.
  38.  
  39. I've put some serious love into building this suite, I had a great time doing it & hope you like it too & to be useful for your future endeavours for making some excellent screenshots.
  40.  
  41.  
  42. [ to see some examples of this shader suite in use: you can always visit https://flickr.com/people/alpha-neo-noir-v2/ ]
  43.  
  44.  
  45.  
  46. This "ALPHA Photography Suite 2020" for Reshade 4.x is based upon these shaders listed below [ tested on the latest Reshade Version 4.5.2 as well which was released on Dec 20th, 2019 ]:
  47. - Simple Grain v1.0.6 by Jacob Maximilian Fober
  48. - Code for grain depending on average screen luminance by brussell
  49. - Eye Adaption v2.3 by brussell
  50. - Monochrome v1.1 by CeeJay.dk
  51. - Reshade port of Uncharted tonemapping by Jace Regenbrecht
  52. - Base code sourced from John Hable's blog at http://filmicworlds.com/blog/filmic-tonemapping-operators/
  53. - Reshade port of Hue Brightness Contrast Saturation control
  54.  
  55. CREDITS to these excellent code writers:
  56. - Crosire for Reshade [ https://reshade.me/ ]
  57. - Jacob Maximilian Fober for Grain code
  58. - brussell for Eye Adaption
  59. - CeeJay for B/W Camera Film presets
  60. - Jace Regenbrecht for Uncharted tonemapping
  61. - John Hable @ filmicworlds for base code filmic-tonemapping
  62.  
  63.  
  64.  
  65. Modifications & tweaks:
  66. --> Added code from simple Grain v1.0.6 by Jacob Maximilian Fober [ Modified + some error & warning fixes ]
  67. --> Extra code for grain depending on average screen luminance [brussell]
  68. --> Extra options + code added from Eye Adaption v2.3 by brussell
  69. --> Added extra grain options
  70. --> Extra options + code added from Monochrome v1.1 by CeeJay.dk
  71. --> Extra options + code added from Reshade port of Uncharted 2 tonemap by Jace Regenbrecht [ Modified + some error & warning fixes ]
  72. --> Base code sourced from John Hable's blog at http://filmicworlds.com/blog/filmic-tonemapping-operators/
  73. --> Extra options + code added from Reshade port of H.B.C.S - Hue Brightness Contrast Saturation control [ Modified + some error & warning fixes ]
  74. --> Fine-tuned menu options + values
  75.  
  76.  
  77.  
  78. Extra:
  79. Informative reads:
  80. Filmic Tonemapping:
  81. http://filmicworlds.com/blog/filmic-tonemapping-operators/
  82. http://filmicworlds.com/blog/filmic-tonemapping-with-piecewise-power-curves/
  83.  
  84. Filmic Tonemapping and Color:
  85. http://duikerresearch.com/2015/09/filmic-tonemapping-ea-2006/
  86. https://mynameismjp.wordpress.com/2010/04/30/a-closer-look-at-tone-mapping/
  87.  
  88. Uncharted HDR Lighting:
  89. https://www.gdcvault.com/play/1012351/Uncharted-2-HDR
  90.  
  91. Examples of grain [ Grain Library - comparison ]:
  92. https://grubbasoftware.com/filmlibrary.html
  93.  
  94. Let’s improve grain:
  95. https://discuss.pixls.us/t/lets-improve-grain/2709
  96. https://blog.captureone.com/film-grains-photorealistic-right-way/
  97.  
  98. The Basics of Photography: G for Grain
  99. https://www.thephoblographer.com/2013/09/11/the-basics-of-photography-g-for-grain/
  100.  
  101. Kodak T-max vs. Kodak Tri-X (with sample photos):
  102. http://attemptsat35mm.com/kodak-t-max-vs-kodak-tri-x/
  103.  
  104. What is Panchromatic and Orthochromatic Film?:
  105. https://filmphotographyproject.com/content/howto/2018/07/panchromatic-orthochromatic-film/
  106.  
  107. Simulating Kodak Tri-X Black & White Film:
  108. https://www.nickbedford.com/blog/2017/7/simulating-kodak-tri-x-black-white-film
  109.  
  110. A brief history of Kodak:
  111. https://independent-photo.com/news/historic-brands-kodak/
  112.  
  113. Kodak Tri-X:
  114. https://en.wikipedia.org/wiki/Kodak_Tri-X
  115.  
  116. Kodak Tri-X: The Best Black-and-White Film Ever Made?:
  117. https://petapixel.com/2016/04/04/kodak-tri-x-best-black-white-film-ever-made/
  118. https://www.1843magazine.com/content/features/bryan-appleyard/tri-x-factor
  119. https://www.thephoblographer.com/2017/02/22/street-photography-kodak-tri-x-film-62-years-going-grain/
  120.  
  121.  
  122. ================================================================================*/
  123.  
  124. ////////////
  125. /// MENU ///
  126. ////////////
  127.  
  128. #include "ReShadeUI.fxh"
  129.  
  130. uniform float Intensity < __UNIFORM_SLIDER_FLOAT1
  131. ui_label = "Noise Intensity";
  132. ui_category = "Classic fine grain settings:";
  133. ui_min = 0.000; ui_max = 30.000; ui_step = 0.001;
  134. > = 7.000;
  135.  
  136. uniform int Framerate < __UNIFORM_SLIDER_INT1
  137. ui_label = "Noise Framerate";
  138. ui_category = "Classic fine grain settings:";
  139. ui_tooltip = "Zero will match in-game framerate";
  140. #if __RESHADE__ < 40000
  141. ui_step = 1;
  142. #endif
  143. ui_min = 0; ui_max = 120;
  144. > = 0;
  145.  
  146. uniform int Coefficient < __UNIFORM_RADIO_INT1
  147. ui_category = "Classic fine grain settings:";
  148. ui_tooltip = "For digital video signal (HDMI, DVI, Display Port) use BT.709,\n"
  149. "for analog (like VGA, S-Video) use BT.601";
  150. #if __RESHADE__ < 40000
  151. ui_label = "YUV coefficients";
  152. ui_items = "BT.709 (digital signal)\0BT.601 (analog signal))\0";
  153. #else
  154. ui_items = "BT.709 - digital\0BT.601 - analog\0";
  155. #endif
  156. > = 0;
  157.  
  158. uniform float fAdp_TriggerRadius <
  159. ui_label = "Adaption Trigger Radius";
  160. ui_tooltip = "For grain depending on average screen luminance. /Screen area whose average brightness triggers adaption.\n"
  161. "1 = only the center of the image is used\n"
  162. "7 = the whole image is used";
  163. ui_category = "Advanced settings / fine-tuning grain:";
  164. ui_type = "slider";
  165. ui_min = 1.0;
  166. ui_max = 7.0;
  167. ui_step = 0.1;
  168. > = 7.0;
  169.  
  170. uniform float Grain_Layer_Intensity <
  171. ui_label = "Grain Layer Intensity";
  172. ui_tooltip = "Grain Layer Intensity";
  173. ui_category = "Advanced settings / fine-tuning grain:";
  174. ui_type = "slider";
  175. ui_min = 0.000;
  176. ui_max = 0.300;
  177. ui_step = 0.001;
  178. > = 0.040;
  179.  
  180. uniform float Grain_UpperLevel_Intensity <
  181. ui_label = "Grain Upper Level Intensity";
  182. ui_tooltip = "Grain Upper Level Intensity in lighter areas like skies etc";
  183. ui_category = "Advanced settings / fine-tuning grain:";
  184. ui_type = "slider";
  185. ui_min = 0.000;
  186. ui_max = 1.300;
  187. ui_step = 0.001;
  188. > = 0.50;
  189.  
  190. uniform float Grain_LowerLevel_Intensity <
  191. ui_label = "Grain Lower Level Intensity";
  192. ui_tooltip = "Grain Lower Level Intensity in darker areas like shadows etc";
  193. ui_category = "Advanced settings / fine-tuning grain:";
  194. ui_type = "slider";
  195. ui_min = -3.000;
  196. ui_max = 3.000;
  197. ui_step = 0.001;
  198. > = 0.605;
  199.  
  200. uniform int Monochrome_preset <
  201. ui_type = "combo";
  202. ui_label = "B/W Camera Film Preset";
  203. ui_tooltip = "Choose a preset";
  204. ui_category = "Monochrome conversion settings:";
  205. ui_items = "Custom\0"
  206. "Monitor or modern TV\0"
  207. "Equal weight\0"
  208. "Agfa 200X\0"
  209. "Agfapan 25\0"
  210. "Agfapan 100\0"
  211. "Agfapan 400\0"
  212. "Ilford Delta 100\0"
  213. "Ilford Delta 400\0"
  214. "Ilford Delta 400 Pro & 3200\0"
  215. "Ilford FP4\0"
  216. "Ilford HP5\0"
  217. "Ilford Pan F\0"
  218. "Ilford SFX\0"
  219. "Ilford XP2 Super\0"
  220. "Kodak Tmax 100\0"
  221. "Kodak Tmax 400\0"
  222. "Kodak Tri-X\0";
  223. > = 0;
  224.  
  225. uniform float3 Monochrome_conversion_values <
  226. ui_type = "color";
  227. ui_category = "Monochrome conversion settings:";
  228. ui_label = "Custom Conversion Values";
  229. > = float3(0.21, 0.72, 0.07);
  230.  
  231. /*
  232. uniform bool Normalize <
  233. ui_label = "Normalize";
  234. ui_category = "Monochrome conversion settings:";
  235. ui_tooltip = "Normalize the coefficients?";
  236. > = false;
  237. */
  238.  
  239. uniform float Monochrome_color_saturation <
  240. ui_label = "Saturation";
  241. ui_category = "Monochrome conversion settings:";
  242. ui_type = "slider";
  243. ui_min = 0.0; ui_max = 1.0;
  244. > = 0.0;
  245.  
  246. uniform bool U2_Lum <
  247. ui_label = "Use Luminance";
  248. ui_category = "Advanced filmic-tonemapping settings:";
  249. ui_tooltip = "Calculate tone based off each pixel's luminance value vs the RGB value.";
  250. > = false;
  251.  
  252. uniform float U2_A <
  253. ui_type = "slider";
  254. ui_category = "Advanced filmic-tonemapping settings:";
  255. ui_min = 0.00; ui_max = 1.00;
  256. ui_step = 0.001;
  257. ui_label = "Shoulder Strength";
  258. > = 0.22;
  259.  
  260. uniform float U2_B <
  261. ui_type = "slider";
  262. ui_category = "Advanced filmic-tonemapping settings:";
  263. ui_min = 0.00; ui_max = 1.00;
  264. ui_step = 0.001;
  265. ui_label = "Linear Strength";
  266. > = 0.30;
  267.  
  268. uniform float U2_C <
  269. ui_type = "slider";
  270. ui_category = "Advanced filmic-tonemapping settings:";
  271. ui_min = 0.00; ui_max = 1.00;
  272. ui_step = 0.001;
  273. ui_label = "Linear Angle";
  274. > = 0.10;
  275.  
  276. uniform float U2_D <
  277. ui_type = "slider";
  278. ui_category = "Advanced filmic-tonemapping settings:";
  279. ui_min = 0.00; ui_max = 1.00;
  280. ui_step = 0.001;
  281. ui_label = "Toe Strength";
  282. > = 0.20;
  283.  
  284. uniform float U2_E <
  285. ui_type = "slider";
  286. ui_category = "Advanced filmic-tonemapping settings:";
  287. ui_min = 0.00; ui_max = 1.00;
  288. ui_step = 0.001;
  289. ui_label = "Toe Numerator";
  290. > = 0.01;
  291.  
  292. uniform float U2_F <
  293. ui_type = "slider";
  294. ui_category = "Advanced filmic-tonemapping settings:";
  295. ui_min = 0.00; ui_max = 1.00;
  296. ui_step = 0.001;
  297. ui_label = "Toe Denominator";
  298. > = 0.22;
  299.  
  300. uniform float U2_W <
  301. ui_type = "slider";
  302. ui_category = "Advanced filmic-tonemapping settings:";
  303. ui_min = 0.00; ui_max = 20.00;
  304. ui_step = 0.10;
  305. ui_label = "Linear White Point Value";
  306. > = 11.20;
  307.  
  308. uniform float U2_Exp <
  309. ui_type = "slider";
  310. ui_category = "Advanced filmic-tonemapping settings:";
  311. ui_min = -10.00; ui_max = 20.00;
  312. ui_step = 0.001;
  313. ui_label = "Exposure";
  314. > = 1.00;
  315.  
  316. uniform float U2_Gamma <
  317. ui_type = "slider";
  318. ui_category = "Advanced filmic-tonemapping settings:";
  319. ui_min = 1.00; ui_max = 3.00;
  320. ui_step = 0.1;
  321. ui_label = "Gamma Value";
  322. ui_tooltip = "Most monitors/images use a value of 2.2. Setting this to 1 disables the inital color space conversion from gamma to linear.";
  323. > = 2.20;
  324.  
  325. uniform float Hue <
  326. ui_type = "slider";
  327. ui_category = "H.B.C.S - Hue Brightness Contrast Saturation control:";
  328. ui_min = -180.0; ui_max = 180.0;
  329. ui_step = 0.005;
  330. ui_tooltip = "Hue";
  331. > = 0.00;
  332. uniform float Brightness <
  333. ui_type = "slider";
  334. ui_category = "H.B.C.S - Hue Brightness Contrast Saturation control:";
  335. ui_min = -1.0; ui_max = 1.0;
  336. ui_tooltip = "Brightness";
  337. > = 0.0;
  338. uniform float Contrast <
  339. ui_type = "slider";
  340. ui_category = "H.B.C.S - Hue Brightness Contrast Saturation control:";
  341. ui_min = -1.0; ui_max = 1.0;
  342. ui_tooltip = "Contrast";
  343. > = 0.0;
  344. uniform float Saturation <
  345. ui_type = "slider";
  346. ui_category = "H.B.C.S - Hue Brightness Contrast Saturation control:";
  347. ui_min = 0.0; ui_max = 2.0;
  348. ui_tooltip = "Saturation";
  349. > = 1.0;
  350.  
  351.  
  352. //////////////
  353. /// SHADER ///
  354. //////////////
  355.  
  356. uniform float Timer < source = "timer"; >;
  357. uniform int FrameCount < source = "framecount"; >;
  358.  
  359. // RGB to YUV709 luma
  360. static const float3 Luma709 = float3(0.2126, 0.7152, 0.0722);
  361. // RGB to YUV601 luma
  362. static const float3 Luma601 = float3(0.299, 0.587, 0.114);
  363.  
  364. // Overlay blending mode
  365. float Overlay(float LayerA, float LayerB)
  366. {
  367. float MinA = min(LayerA, 0.5);
  368. float MinB = min(LayerB, 0.5);
  369. float MaxA = max(LayerA, 0.5);
  370. float MaxB = max(LayerB, 0.5);
  371. return 2 * (MinA * MinB + MaxA + MaxB - MaxA * MaxB) - 1.5;
  372. }
  373.  
  374. // Noise generator
  375. float SimpleNoise(float p)
  376. { return frac(sin(dot(p, float2(12.9898, 78.233))) * 43758.5453); }
  377.  
  378. #include "ReShade.fxh"
  379.  
  380. // Shader pass
  381. texture2D texLuminance { Width = 256; Height = 256; Format = R8; MipLevels = 7; };
  382. sampler SamplerLuminance { Texture = texLuminance; };
  383.  
  384. float PS_Luminance(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
  385. {
  386. return dot(tex2D(ReShade::BackBuffer, texcoord.xy).xyz, 0.333);
  387. }
  388. void SimpleGrainPS(float4 vois : SV_Position, float2 TexCoord : TEXCOORD, out float3 Image : SV_Target)
  389. {
  390. // Choose luma coefficient, if False BT.709 luma, else BT.601 luma
  391. float3 LumaCoefficient = bool(Coefficient) ? Luma601 : Luma709;
  392.  
  393. // Sample image
  394. Image = tex2D(ReShade::BackBuffer, TexCoord).rgb;
  395. // Mask out bright pixels gamma: (sqrt(5)+1)/2
  396. const float GoldenAB = sqrt(5.0) * Grain_UpperLevel_Intensity + Grain_UpperLevel_Intensity;
  397. float Mask = pow(abs(1.0 - dot(Image.rgb, LumaCoefficient)), GoldenAB);
  398. // Calculate seed change
  399. float Seed = Framerate == 0 ? FrameCount : floor(Timer * 0.001 * Framerate);
  400. // Protect from enormous numbers
  401. Seed = frac(Seed * 0.0001) * 10000;
  402. // Generate noise * (sqrt(5) + 1) / 4 (to remain brightness)
  403. const float GoldenABh = sqrt(5.0) * 0.525 - Grain_LowerLevel_Intensity;
  404. float Noise = saturate(SimpleNoise(Seed * TexCoord.x * TexCoord.y) * GoldenABh);
  405. Noise = lerp(0.5, Noise, Intensity * Grain_Layer_Intensity * Mask);
  406. float avglum = tex2Dlod(SamplerLuminance, float4(0.5.xx, 0, fAdp_TriggerRadius)).x;
  407. Noise *= (1-avglum);
  408. // Blend noise with image
  409. Image.rgb = float3(
  410. Overlay(Image.r, Noise),
  411. Overlay(Image.g, Noise),
  412. Overlay(Image.b, Noise)
  413. );
  414. }
  415.  
  416. float3 MonochromePass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
  417. {
  418. const float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
  419.  
  420. float3 Coefficients = float3(0.21, 0.72, 0.07);
  421.  
  422. const float3 Coefficients_array[18] =
  423. {
  424. Monochrome_conversion_values, //Custom
  425. float3(0.21, 0.72, 0.07), //sRGB monitor
  426. float3(0.3333333, 0.3333334, 0.3333333), //Equal weight
  427. float3(0.18, 0.41, 0.41), //Agfa 200X
  428. float3(0.25, 0.39, 0.36), //Agfapan 25
  429. float3(0.21, 0.40, 0.39), //Agfapan 100
  430. float3(0.20, 0.41, 0.39), //Agfapan 400
  431. float3(0.21, 0.42, 0.37), //Ilford Delta 100
  432. float3(0.22, 0.42, 0.36), //Ilford Delta 400
  433. float3(0.31, 0.36, 0.33), //Ilford Delta 400 Pro & 3200
  434. float3(0.28, 0.41, 0.31), //Ilford FP4
  435. float3(0.23, 0.37, 0.40), //Ilford HP5
  436. float3(0.33, 0.36, 0.31), //Ilford Pan F
  437. float3(0.36, 0.31, 0.33), //Ilford SFX
  438. float3(0.21, 0.42, 0.37), //Ilford XP2 Super
  439. float3(0.24, 0.37, 0.39), //Kodak Tmax 100
  440. float3(0.27, 0.36, 0.37), //Kodak Tmax 400
  441. float3(0.25, 0.35, 0.40) //Kodak Tri-X
  442. };
  443.  
  444. Coefficients = Coefficients_array[Monochrome_preset];
  445.  
  446. // Calculate monochrome
  447. const float3 grey = dot(Coefficients, color);
  448.  
  449. // Adjust the remaining saturation & return the result
  450. return saturate(lerp(grey, color, Monochrome_color_saturation));
  451. }
  452.  
  453. float3 Uncharted2Tonemap(float3 x)
  454. {
  455. return ((x*(U2_A*x+U2_C*U2_B)+U2_D*U2_E)/(x*(U2_A*x+U2_B)+U2_D*U2_F))-U2_E/U2_F;
  456. }
  457.  
  458. float3 Uncharted_Tonemap_Main(float4 pos : SV_Position, float2 texcoord : TexCoord ) : COLOR
  459. {
  460. float3 texColor = tex2D(ReShade::BackBuffer, texcoord ).rgb;
  461.  
  462. // Do inital de-gamma of the game image to ensure we're operating in the correct colour range.
  463. if( U2_Gamma > 1.00 )
  464. texColor = pow(abs(texColor),U2_Gamma);
  465.  
  466. texColor *= U2_Exp; // Exposure Adjustment
  467.  
  468. float ExposureBias = 2.0f;
  469. float3 curr;
  470.  
  471. // Do tonemapping on RGB or Luminance
  472. if(!U2_Lum)
  473. curr = Uncharted2Tonemap(ExposureBias*texColor);
  474. else
  475. {
  476. float lum = 0.2126f * texColor[0] + 0.7152 * texColor[1] + 0.0722 * texColor[2];
  477. float3 newLum = Uncharted2Tonemap(ExposureBias*lum);
  478. float3 lumScale = newLum / lum;
  479. curr = texColor*lumScale;
  480. }
  481.  
  482. float3 whiteScale = 1.0f/Uncharted2Tonemap(U2_W);
  483. float3 color = curr*whiteScale;
  484.  
  485. // Do the post-tonemapping gamma correction
  486. if( U2_Gamma > 1.00 )
  487. color = pow(abs(color),1/U2_Gamma);
  488.  
  489. return color;
  490. }
  491.  
  492. float3x3 QuaternionToMatrix(float4 quat)
  493. {
  494. float3 cross = quat.yzx * quat.zxy;
  495. float3 square= quat.xyz * quat.xyz;
  496. float3 wimag = quat.w * quat.xyz;
  497.  
  498. square = square.xyz + square.yzx;
  499.  
  500. float3 diag = 0.5 - square;
  501. float3 a = (cross + wimag);
  502. float3 b = (cross - wimag);
  503.  
  504. return float3x3(
  505. 2.0 * float3(diag.x, b.z, a.y),
  506. 2.0 * float3(a.z, diag.y, b.x),
  507. 2.0 * float3(b.y, a.x, diag.z));
  508. }
  509.  
  510. float4 PS_ColorShift(float4 position : SV_Position, float2 texcoord : TexCoord) : SV_Target
  511. {
  512. float4 outputColor = tex2D(ReShade::BackBuffer, texcoord);
  513. float3 intensity;
  514. float3 root3 = float3(0.57735, 0.57735, 0.57735);
  515. float half_angle = 0.5 * radians(Hue);
  516. float4 rot_quat = float4( (root3 * sin(half_angle)), cos(half_angle));
  517. float3x3 rot_Matrix = QuaternionToMatrix(rot_quat);
  518. outputColor.rgb = mul(rot_Matrix, outputColor.rgb);
  519. outputColor.rgb = (outputColor.rgb - 0.5) *(Contrast + 1.0) + 0.5;
  520. outputColor.rgb = outputColor.rgb + Brightness;
  521. float3 lumCoeff = float3(0.2125, 0.7154, 0.0721);
  522. intensity = float(dot(outputColor.rgb, lumCoeff));
  523. outputColor.rgb = lerp(intensity, outputColor.rgb, Saturation);
  524.  
  525. return outputColor;
  526. }
  527.  
  528. //////////////
  529. /// OUTPUT ///
  530. //////////////
  531.  
  532. technique ALPHA_Photography_Suite_2020_V4 < ui_label = "ALPHA Photography Suite 2020 V4"; >
  533. {
  534. pass{VertexShader = PostProcessVS;PixelShader = PS_Luminance;RenderTarget = texLuminance;}
  535. pass{VertexShader = PostProcessVS;PixelShader = SimpleGrainPS;}
  536. pass{VertexShader = PostProcessVS;PixelShader = MonochromePass;}
  537. pass{VertexShader = PostProcessVS;PixelShader = Uncharted_Tonemap_Main;}
  538. pass{VertexShader = PostProcessVS;PixelShader = PS_ColorShift;}
  539. }
Advertisement
Add Comment
Please, Sign In to add comment