Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.80 KB | None | 0 0
  1. #version 420
  2. #extension GL_ARB_texture_gather : enable
  3. // shader bd8bba59e2149449
  4. // Contrasty + Adjustable Fog
  5. // Credit to bestminr for vibrance logic, and getdls
  6. // Credit to getdls for discovering this shader and adding adjustable Gamma, Saturation and Exporsure.
  7. // Credit to Jamie for main coding.
  8. // Credit to Kiri coding & Reshade logic.
  9. // Credit to Serfrost for preset values.
  10.  
  11. // Adjustable values:
  12.  
  13. const float fogfactor = 0.4; // [1.0 Default] Changes amount of fog
  14. const float brightness = 1.3; // [1.0 Default] Lighten or Darken Shadows
  15. const float Gamma = 2.0; // [1.0 Default] [2.0 Clarity]
  16. const float Saturation = 0.10; // [-1.0, 1.0] Saturates Colors
  17. const float Exposure = 0.00; // [-1.0, 1.0] Exposure Adjustment
  18. const float Defog = 0.12; // [0.0, 1.0] How much of the far distance fog to "remove."
  19.  
  20. //End of adjustable values
  21.  
  22.  
  23. uniform ivec4 uf_remappedPS[1];
  24. layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf46ac800 res 320x180x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x5) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1
  25. layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf5c7b800 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1
  26. layout(location = 0) in vec4 passParameterSem0;
  27. layout(location = 0) out vec4 passPixelColor0;
  28. uniform vec2 uf_fragCoordScale;
  29. int clampFI32(int v)
  30. {
  31. if( v == 0x7FFFFFFF )
  32. return floatBitsToInt(1.0);
  33. else if( v == 0xFFFFFFFF )
  34. return floatBitsToInt(0.0);
  35. return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
  36. }
  37. float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
  38. void main()
  39. {
  40. vec4 R0f = vec4(0.0);
  41. vec4 R1f = vec4(0.0);
  42. vec4 R123f = vec4(0.0);
  43. vec4 R125f = vec4(0.0);
  44. vec4 R126f = vec4(0.0);
  45. vec4 R127f = vec4(0.0);
  46. float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f;
  47. vec4 PV0f = vec4(0.0), PV1f = vec4(0.0);
  48. float PS0f = 0.0, PS1f = 0.0;
  49. vec4 tempf = vec4(0.0);
  50. float tempResultf;
  51. int tempResulti;
  52. ivec4 ARi = ivec4(0);
  53. bool predResult = true;
  54. vec3 cubeMapSTM;
  55. int cubeMapFaceId;
  56. R0f = passParameterSem0;
  57. R1f.xyz = (texture(textureUnitPS0, R0f.xy).xyz);
  58. R1f *= fogfactor;
  59. R0f.xyz = (texture(textureUnitPS1, R0f.xy).xyz);
  60. // 0
  61. R126f.x = R1f.x + R0f.x;
  62. PV0f.x = R126f.x;
  63. R127f.y = R1f.y + R0f.y;
  64. PV0f.y = R127f.y;
  65. R126f.z = R1f.z + R0f.z;
  66. PV0f.z = R126f.z;
  67. R125f.w = 1.0;
  68. // 1
  69. tempf.x = dot(vec4(PV0f.x,PV0f.y,PV0f.z,-0.0),vec4(intBitsToFloat(0x3e99096c),intBitsToFloat(0x3f162b6b),intBitsToFloat(0x3dea4a8c),0.0));
  70. PV1f.x = tempf.x;
  71. PV1f.y = tempf.x;
  72. PV1f.z = tempf.x;
  73. PV1f.w = tempf.x;
  74. // 2
  75. R127f.x = -(R127f.y) * intBitsToFloat(0x3fb8aa3b);
  76. PV0f.y = -(PV1f.x) * intBitsToFloat(0x3fb8aa3b);
  77. R127f.z = -(R126f.x) * intBitsToFloat(0x3fb8aa3b);
  78. R127f.w = -(R126f.z) * intBitsToFloat(0x3fb8aa3b);
  79. R126f.w = 1.0 / PV1f.x;
  80. PS0f = R126f.w;
  81. // 3
  82. PS1f = exp2(PV0f.y);
  83. // 4
  84. PV0f.x = -(PS1f) + 1.0;
  85. PS0f = exp2(R127f.x);
  86. // 5
  87. R127f.x = -(PS0f) + 1.0;
  88. R126f.y = mul_nonIEEE(PV0f.x, PV0f.x);
  89. PV1f.z = PV0f.x * R126f.w;
  90. PS1f = exp2(R127f.w);
  91. // 6
  92. backupReg0f = R126f.x;
  93. backupReg1f = R127f.z;
  94. R126f.x = mul_nonIEEE(backupReg0f, PV1f.z);
  95. PV0f.y = -(PS1f) + 1.0;
  96. R127f.z = mul_nonIEEE(R126f.z, PV1f.z);
  97. PV0f.z = R127f.z;
  98. R127f.w = mul_nonIEEE(R127f.y, PV1f.z);
  99. PV0f.w = R127f.w;
  100. PS0f = exp2(backupReg1f);
  101. // 7
  102. PV1f.x = R127f.x + -(PV0f.w);
  103. PV1f.y = PV0f.y + -(PV0f.z);
  104. PV1f.w = -(PS0f) + 1.0;
  105. // 8
  106. backupReg0f = R127f.z;
  107. R127f.x = (mul_nonIEEE(PV1f.x,R126f.y) + R127f.w);
  108. R127f.x = clamp(R127f.x, 0.0, 1.0);
  109. PV0f.x = R127f.x;
  110. PV0f.y = PV1f.w + -(R126f.x);
  111. R127f.z = (mul_nonIEEE(PV1f.y,R126f.y) + backupReg0f);
  112. R127f.z = clamp(R127f.z, 0.0, 1.0);
  113. PV0f.z = R127f.z;
  114. // 9
  115. backupReg0f = R126f.x;
  116. R126f.x = (mul_nonIEEE(PV0f.y,R126f.y) + backupReg0f);
  117. R126f.x = clamp(R126f.x, 0.0, 1.0);
  118. PV1f.x = R126f.x;
  119. R126f.y = max(PV0f.x, PV0f.z);
  120. PV1f.w = min(PV0f.x, PV0f.z);
  121. // 10
  122. tempf.x = dot(vec4(PV1f.x,R127f.x,R127f.z,R125f.w),vec4(intBitsToFloat(0x3f2aaaab),intBitsToFloat(0x3f2aaaab),intBitsToFloat(0x3f2aaaab),-(1.0)));
  123. PV0f.x = tempf.x;
  124. PV0f.y = tempf.x;
  125. PV0f.z = tempf.x;
  126. PV0f.w = tempf.x;
  127. R126f.z = min(PV1f.x, PV1f.w);
  128. PS0f = R126f.z;
  129. // 11
  130. backupReg0f = R127f.x;
  131. backupReg1f = R127f.z;
  132. R127f.x = max(R126f.x, R126f.y);
  133. PV1f.x = R127f.x;
  134. R123f.y = (mul_nonIEEE(-(PV0f.x),PV0f.x) + 1.0);
  135. PV1f.y = R123f.y;
  136. R127f.z = backupReg0f + -(PS0f);
  137. R125f.w = R126f.x + -(PS0f);
  138. R126f.y = backupReg1f + -(PS0f);
  139. PS1f = R126f.y;
  140. // 12
  141. R126f.x = (mul_nonIEEE(PV1f.y,intBitsToFloat(uf_remappedPS[0].y)) + intBitsToFloat(uf_remappedPS[0].x));
  142. PV0f.x = R126f.x;
  143. PV0f.y = -(R126f.z) + PV1f.x;
  144. // 13
  145. R123f.w = (mul_nonIEEE(-(PV0f.x),PV0f.y) + R127f.x);
  146. PV1f.w = R123f.w;
  147. // 14
  148. R0f.x = (mul_nonIEEE(R126f.x,R125f.w) + PV1f.w);
  149. R0f.y = (mul_nonIEEE(R126f.x,R127f.z) + PV1f.w);
  150. R0f.z = (mul_nonIEEE(R126f.x,R126f.y) + PV1f.w);
  151.  
  152. //Color Tweak
  153. vec3 fColour = (passPixelColor0.xyz);
  154. fColour = TonemapPass(fColour);
  155. fColour = pow(fColour, vec3(2.0 / brightness));
  156. vec3 gamma = vec3(1.0/2.2f, 1.0/2.2f, 1.0/2.2f);
  157. fColour = pow(fColour, gamma);
  158. float luminance = fColour.r*0.299 + fColour.g*0.587 + fColour.b*0.114; //default g*0.587
  159. vec3 colorContrasted = (fColour) * contrast;
  160. vec3 bright = colorContrasted + vec3(brightness,brightness,brightness);
  161. float mn = min(min(fColour.r, fColour.g), fColour.b);
  162. float mx = max(max(fColour.r, fColour.g), fColour.b);
  163. float sat = (1.0-(mx - mn)) * (1.0-mx) * luminance * 5.0;
  164. vec3 lightness = vec3((mn + mx)/2.0);
  165. const vec3 lightPos = vec3(0.5, 0.5, 5.0);
  166. const vec3 diffColour = vec3(1.0, 1.0, 1.0);
  167. const vec3 ambColour = vec3(0.2, 0.2, 0.2);
  168. fColour = (fColour.xyz - floor) * scale;
  169.  
  170. // export
  171. passPixelColor0 = vec4(fColour.x, fColour.y, fColour.z, R0f.w);
  172. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement