Permalink
Browse files

party-version: too many hacks, too little time

  • Loading branch information...
1 parent b01b9bc commit 9b4cad4a0b1735232ebdc3d45f4b50c8706b12a4 @kusma committed Jul 18, 2012
View
@@ -0,0 +1,60 @@
+const float4 gauss[8];
+const int size;
+
+texture blur_tex;
+sampler tex = sampler_state {
+ Texture = (blur_tex);
+ MipFilter = POINT;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ sRGBTexture = FALSE;
+};
+
+struct VS_OUTPUT {
+ float4 pos : POSITION;
+ float2 tex : TEXCOORD0;
+};
+
+VS_OUTPUT vertex(float4 pos : POSITION, float2 tex : TEXCOORD0)
+{
+ VS_OUTPUT o;
+ o.pos = pos;
+ o.tex = tex;
+ return o;
+}
+
+float4 pixel(VS_OUTPUT In) : COLOR
+{
+ float4 c = tex2D(tex, In.tex) * gauss[0].z;
+ for (int i = 1; i < size; i++) {
+ c += tex2D(tex, In.tex + gauss[i].xy) * gauss[i].z;
+ c += tex2D(tex, In.tex - gauss[i].xy) * gauss[i].z;
+ }
+ return c;
+}
+
+technique blur {
+ pass P0 {
+ VertexShader = compile vs_2_0 vertex();
+ PixelShader = compile ps_2_0 pixel();
+ }
+}
+
+float3 rgbe_to_rgb(float4 rgbe)
+{
+ return rgbe.rgb * exp2(rgbe.a * 255 - 128);
+}
+
+float4 pixel2(VS_OUTPUT In) : COLOR
+{
+ return float4(rgbe_to_rgb(tex2D(tex, In.tex)), 1.0);
+}
+
+technique hack {
+ pass P0 {
+ VertexShader = compile vs_2_0 vertex();
+ PixelShader = compile ps_2_0 pixel2();
+ }
+}
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Diff not rendered.
View
Diff not rendered.
View
Diff not rendered.
View
@@ -15,15 +15,13 @@ sampler tex_samp = sampler_state {
sRGBTexture = FALSE;
};
-struct VS_INPUT
-{
+struct VS_INPUT {
float3 pos : POSITION;
float size : TEXCOORD0;
float2 uv : TEXCOORD1;
};
-struct VS_OUTPUT
-{
+struct VS_OUTPUT {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
float alpha : TEXCOORD1;
@@ -40,15 +38,34 @@ VS_OUTPUT vertex(VS_INPUT In)
return Out;
}
-float4 pixel(VS_OUTPUT In) : COLOR
+float4 black_pixel(VS_OUTPUT In) : COLOR
+{
+ return float4(0, 0, 0, tex2D(tex_samp, In.uv).a) * In.alpha * alpha;
+}
+
+float4 white_pixel(VS_OUTPUT In) : COLOR
{
- float4 col = tex2D(tex_samp, In.uv);
- return float4(col.rgb * In.alpha * alpha, col.a * In.alpha * alpha);
+ return float4(1, 1, 1, tex2D(tex_samp, In.uv).a) * In.alpha * alpha;
+}
+
+technique black {
+ pass P0 {
+ VertexShader = compile vs_3_0 vertex();
+ PixelShader = compile ps_3_0 black_pixel();
+ AlphaBlendEnable = True;
+ ZWriteEnable = False;
+ SrcBlend = SrcAlpha;
+ DestBlend = InvSrcAlpha;
+ }
}
-technique fx {
+technique white {
pass P0 {
- VertexShader = compile vs_2_0 vertex();
- PixelShader = compile ps_2_0 pixel();
+ VertexShader = compile vs_3_0 vertex();
+ PixelShader = compile ps_3_0 white_pixel();
+ AlphaBlendEnable = True;
+ ZWriteEnable = False;
+ SrcBlend = SrcAlpha;
+ DestBlend = One;
}
}
View
@@ -4,6 +4,7 @@ const float noise_amt;
const float dist_amt, dist_freq, dist_time;
const float2 viewport;
const float color_map_lerp;
+const float bloom_amt;
texture color_tex;
sampler color_samp = sampler_state {
@@ -16,6 +17,17 @@ sampler color_samp = sampler_state {
sRGBTexture = FALSE;
};
+texture bloom_tex;
+sampler bloom_samp = sampler_state {
+ Texture = (bloom_tex);
+ MipFilter = NONE;
+ MinFilter = LINEAR;
+ MagFilter = LINEAR;
+ AddressU = CLAMP;
+ AddressV = CLAMP;
+ sRGBTexture = FALSE;
+};
+
texture spectrum_tex;
sampler spectrum_samp = sampler_state {
Texture = (spectrum_tex);
@@ -124,6 +136,8 @@ float4 pixel(VS_OUTPUT In) : COLOR
float3 col = sqrt(sum);
#endif
+ col += tex2D(bloom_samp, In.uv) * bloom_amt;
+
float4 o = tex2D(overlay_samp, In.uv);
o.a *= overlay_alpha;
col *= 1 - o.a;
Oops, something went wrong.

0 comments on commit 9b4cad4

Please sign in to comment.