Advertisement
Guest User

Untitled

a guest
Jan 19th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. struct prev
  2. {
  3. uniform float2 video_size;
  4. uniform float2 texture_size;
  5. uniform sampler2D texture;
  6. float2 tex_coord;
  7. };
  8.  
  9. struct input
  10. {
  11. float2 video_size;
  12. float2 texture_size;
  13. };
  14.  
  15. struct VertexData
  16. {
  17. float2 tex;
  18. float2 prev;
  19. };
  20.  
  21. #define CRT_PASS PASSPREV4
  22.  
  23. void main_vertex
  24. (
  25. float4 position : POSITION,
  26. float2 texCoord : TEXCOORD0,
  27. prev CRT_PASS,
  28.  
  29. uniform float4x4 modelViewProj,
  30.  
  31. out float4 oPosition : POSITION,
  32. out VertexData vert
  33. )
  34. {
  35. oPosition = mul(modelViewProj, position);
  36.  
  37. vert.tex = texCoord;
  38. vert.prev = CRT_PASS.tex_coord;
  39. }
  40.  
  41. // For debugging
  42. #define BLOOM_ONLY 0
  43.  
  44. #pragma parameter BLOOM_STRENGTH "Glow Strength" 0.45 0.0 0.8 0.05
  45. #pragma parameter OUTPUT_GAMMA "Monitor Gamma" 3.0 1.8 2.6 0.02
  46. #ifdef PARAMETER_UNIFORM
  47. uniform float BLOOM_STRENGTH;
  48. uniform float OUTPUT_GAMMA;
  49. #else
  50. #define BLOOM_STRENGTH 0.45
  51. #define OUTPUT_GAMMA 3.0
  52. #endif
  53.  
  54. float4 main_fragment(in VertexData vert, uniform sampler2D s0 : TEXUNIT0, uniform input IN, prev CRT_PASS) : COLOR
  55. {
  56. #if BLOOM_ONLY
  57. float3 source = BLOOM_STRENGTH * tex2D(s0, vert.tex).rgb;
  58. #else
  59. float3 source = 1.15 * tex2D(CRT_PASS.texture, vert.prev).rgb;
  60. float3 bloom = tex2D(s0, vert.tex).rgb;
  61. source += BLOOM_STRENGTH * bloom;
  62. #endif
  63. return float4(pow(saturate(source), 1.0 / OUTPUT_GAMMA), 1.0);
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement