Advertisement
Guest User

Ultimate effect.txt

a guest
Jun 22nd, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.07 KB | None | 0 0
  1. //+++++++++++++++++++++++++++++++++++++++++++++
  2. // ENBSeries effect file
  3. // visit http://enbdev.com for updates
  4. // Copyright 2007-2012 (c) Boris Vorontsov
  5. // settings by Marty McFly
  6. //+++++++++++++++++++++++++++++++++++++++++++++
  7.  
  8. // Tonemapping, Sharpen, and Desaturation effects for SA - DKT70 - Feb 2011.
  9. //NEW: Filmiccurve, Technicolor, Cross Process, Skyrim Tonemap and Colormood.
  10.  
  11. // HDR Settings.
  12. float Defog=0.0; // Strength of FogColor, higher = more.
  13. float4 FogColor={0.5, 0.5, 0.0, 0.0}; // Lens-style color filters for Blue, Red, Yellow, White.
  14. float Exposure=1.0; // Contrast settings, higher = brighter, but also more white.
  15. float Gamma=1.0; // Gamma settings for darker or lighter shadows and dark areas, higher = darker.
  16. float BlueShift=0.012; // Shifts entire color spectrum towards blue, good for images too yellow, but this is global.
  17.  
  18. // Saturation Levels.
  19. float sat = 0.1; // Saturation levels, higher values = less saturation, 0 = off.
  20.  
  21. // Sharpen effect settings. For some good settings try using double your resolution in sxres and syres, and keep sharp strength double the offset.
  22. float sharps = 0.00; // Sharpen Strength.
  23. float offsetv = 0.00; // Offset value, higher = more offset from center.
  24. float sxres = 2880; // Horizontal Resolution setting.
  25. float syres = 1800; // Vertical Resolution setting.
  26. float aspect = 1.6; // Aspect Ratio.
  27.  
  28.  
  29. //#define Filmiccurve
  30. //Filmiccurve by icelaglace ported to SA by Marty McFly
  31. float A = 0.30; // Shoulder Strength
  32. float B = 0.15; // Linear Strength
  33. float C = 0.30; // Linear Angle
  34. float D = 0.20; // Toe Strength
  35. float E = 0.02; // Toe Numerator
  36. float F = 2.50; // Toe Denominator
  37. float W = 18.0; // White Scale
  38.  
  39.  
  40. //#define Technicolor
  41. float TechniPower = 5.0; // technicolor effect
  42. float TechniAmount = 0.4;
  43.  
  44. //#define SkyrimTonemap
  45. float EBrightnessCurveV4=0.7; //contrast and darken
  46. float EBrightnessMultiplierV4=180.0; //doesn't affect game appearance at all, only in real high values
  47. float EBrightnessToneMappingCurveV4=0.2; //makes brighter areas darker, limits the brightness level in a smooth way, better
  48.  
  49. //#define CrossProcess
  50. float CrossContrast =1.0;
  51. float CrossSaturation = 1.0;
  52. float CrossBrightness = -0.128;
  53. float CrossAmount =0.2;
  54. float2 crossMatrix [3] =
  55. {
  56. float2 (1.03, 0.04),
  57. float2 (1.09, 0.01),
  58. float2 (0.78, 0.13),
  59. };
  60.  
  61. //#define ColorMood
  62. float fRatio = 0.55; // blend ratio (0-1)
  63. float moodR = 1.0; // mood color red component
  64. float moodG = 1.1; // mood color green component
  65. float moodB = 0.7; // mood color blue component
  66. //--------------------------------------------------------------------------------------
  67. // Textures
  68. //--------------------------------------------------------------------------------------
  69. texture2D texColor;
  70.  
  71. //--------------------------------------------------------------------------------------
  72. // Sampler Inputs
  73. //--------------------------------------------------------------------------------------
  74.  
  75.  
  76. sampler2D InputSampler = sampler_state
  77. {
  78. Texture = (texColor);
  79. MinFilter = Point;
  80. MagFilter = Anisotropic;
  81. MipFilter = Point;
  82. AddressU = Clamp;
  83. AddressV = Clamp;
  84. SRGBTexture=FALSE;
  85. MaxMipLevel=0;
  86. MipMapLodBias=0;
  87. };
  88.  
  89.  
  90. struct VS_OUTPUT_POST {
  91. float4 vpos : POSITION;
  92. float2 txcoord : TEXCOORD0;
  93. };
  94.  
  95. struct VS_INPUT_POST {
  96. float3 pos : POSITION;
  97. float2 txcoord : TEXCOORD0;
  98. };
  99.  
  100. float pixelWidth;
  101. float pixelHeight;
  102.  
  103.  
  104. //--------------------------------------------------------------------------------------
  105. // Vertex Shader Input
  106. //--------------------------------------------------------------------------------------
  107.  
  108. VS_OUTPUT_POST VS_PostProcess(VS_INPUT_POST IN)
  109. {
  110. VS_OUTPUT_POST OUT;
  111.  
  112. float4 pos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  113.  
  114. OUT.vpos=pos;
  115. OUT.txcoord.xy=IN.txcoord.xy;
  116.  
  117. return OUT;
  118. }
  119.  
  120. //--------------------------------------------------------------------------------------
  121. // Pixel Shader
  122. //--------------------------------------------------------------------------------------
  123.  
  124. float4 main(float2 uv : TEXCOORD) : COLOR
  125. {
  126. float4 c = tex2D(InputSampler, uv);
  127.  
  128. c.rgb = max(0, c.rgb - Defog * FogColor.rgb);
  129. c.rgb *= pow(2.0f, Exposure);
  130. c.rgb = pow(c.rgb, Gamma);
  131.  
  132. float3 d = c.rgb * float3(1.05f, 0.97f, 1.27f);
  133. c.rgb = lerp(c.rgb, d, BlueShift);
  134.  
  135. #ifdef Filmiccurve
  136. float4 curr = ((c*(A*c+C*B)+D*E)/(c*(A*c+B)+D*F))-E/F;
  137. float4 whiteScale = ((W*(A*W+C*B)+D*E)/(W*(A*W+B)+D*F))-E/F;
  138. c = curr*whiteScale;
  139. #endif
  140.  
  141. #ifdef SkyrimTonemap
  142. float Y = dot(c.rgb, float3(0.299, 0.587, 0.114));
  143. float U = dot(c.rgb, float3(-0.14713, -0.28886, 0.436));
  144. float V = dot(c.rgb, float3(0.615, -0.51499, -0.10001));
  145. Y=pow(Y, EBrightnessCurveV4);
  146. Y=Y*EBrightnessMultiplierV4;
  147. c.rgb=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  148.  
  149. c.rgb=max(c.rgb, 0.0);
  150. c.rgb=c.rgb/(c.rgb+EBrightnessToneMappingCurveV4);
  151. #endif
  152.  
  153. #ifdef CrossProcess
  154. float4 image1 = c;
  155. float4 image2 = c;
  156.  
  157. float gray = dot(float3(0.3,0.59,0.1), image1);
  158. image1 = lerp (gray, image1,CrossSaturation);
  159.  
  160. image1 = lerp (0.5, image1,CrossContrast);
  161.  
  162. image1 +=CrossBrightness;
  163. // image1 *=1.2;
  164.  
  165. image2.r = image1.r * crossMatrix[0].x + crossMatrix[0].y;
  166. image2.g = image1.g * crossMatrix[1].x + crossMatrix[1].y;
  167. image2.b = image1.b * crossMatrix[2].x + crossMatrix[2].y;
  168.  
  169. c = lerp(image1, image2, CrossAmount);
  170.  
  171. #endif
  172.  
  173. #ifdef Technicolor
  174.  
  175. float4 redfilter = float4 (0.8, 1.0, 0.8, 1.00);
  176. float4 greenfilter = float4(0.30, 1.0, 0.0, 1.0);
  177. float4 bluefilter = float4(0.25, 1.0, 1.0, 1.0);
  178. float4 redorangefilter = float4(1.05, 0.620, 0.0, 1.0);
  179. float4 cyanfilter = float4(0.0, 1.30, 1.0, 1.0);
  180. float4 magentafilter = float4(1.0, 0.0, 1.05, 1.05);
  181. float4 yellowfilter = float4(1.6, 1.6, 0.05, 1.0);
  182. float redNegativeAmount = 0.52;
  183. float greenNegativeAmount = 0.55;
  184. float blueNegativeAmount = 0.52;
  185.  
  186. float4 tcol = c;
  187. float4 filtgreen = tcol * greenfilter;
  188. float4 filtblue = tcol * magentafilter;
  189. float4 filtred = tcol * redorangefilter;
  190. float4 rednegative = (filtred.r + filtred.g + filtred.b)/(redNegativeAmount * TechniPower);
  191. float4 greennegative = (filtgreen.r + filtgreen.g + filtgreen.b)/(greenNegativeAmount* TechniPower);
  192. float4 bluenegative = (filtblue.r+ filtblue.g + filtblue.b)/(blueNegativeAmount* TechniPower);
  193. float4 redoutput = rednegative + cyanfilter;
  194. float4 greenoutput = greennegative + magentafilter;
  195. float4 blueoutput = bluenegative + yellowfilter;
  196. float4 result = redoutput * greenoutput * blueoutput;
  197.  
  198. c = lerp(tcol, result, TechniAmount);
  199.  
  200. #endif
  201.  
  202. #ifdef ColorMood
  203.  
  204. float4 colMood = 2.0f;
  205.  
  206. colMood.r = moodR;
  207. colMood.g = moodG;
  208. colMood.b = moodB;
  209.  
  210. float fLum = dot(c, 1) / 3;
  211.  
  212. colMood = lerp(0, colMood, saturate(fLum * 2.0));
  213. colMood = lerp(colMood, 1, saturate(fLum - 0.5) * 2.0);
  214.  
  215. float4 colOutput = lerp(c, colMood, saturate(fLum * fRatio));
  216.  
  217. c.rgb=max(0, colOutput);
  218.  
  219. #endif
  220.  
  221. float2 InputSize = float2(sxres, syres/aspect);
  222. float Amount = sharps;
  223. float2 offset = offsetv / InputSize;
  224. float4 color;
  225. color = tex2D(InputSampler, uv);
  226. color += tex2D(InputSampler, uv - offset) * Amount;
  227. color -= tex2D(InputSampler, uv + offset) * Amount;
  228.  
  229. float middlegray=(c.r+c.g+c.b)*0.333;
  230. float3 diffcolor=c.rgb-middlegray;
  231. c.rgb+=diffcolor*-sat;
  232.  
  233. return c * color;
  234. }
  235.  
  236.  
  237.  
  238.  
  239. //--------------------------------------------------------------------------------------
  240. // Compiler
  241. //--------------------------------------------------------------------------------------
  242. technique PostProcess
  243. {
  244. pass P0
  245. {
  246. #ifdef E_SHADER_3_0
  247. VertexShader = compile vs_3_0 VS_PostProcess();
  248. PixelShader = compile ps_3_0 main();
  249. #else
  250. VertexShader = compile vs_2_0 VS_PostProcess();
  251. PixelShader = compile ps_2_0 main();
  252. #endif
  253.  
  254. ZEnable=FALSE;
  255. CullMode=NONE;
  256. ALPHATESTENABLE=FALSE;
  257. SEPARATEALPHABLENDENABLE=FALSE;
  258. AlphaBlendEnable=FALSE;
  259. FogEnable=FALSE;
  260. SRGBWRITEENABLE=FALSE;
  261. }
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement