Create a new user function and call it with the others in the getGameLoaded clause. If you don't mind, you send me the variable list and I'll post the modified plugin/script.
Oh, thanks. Obviously I have no idea what is getGameLoaded. But I got lucky with the new plugin. I inserted my variables by shorting the other shaders. They fit. So I didn't break anything in the end. Here:
http://www.4shared.com/file/254230067/84ea4b1f/varsgod.html
It is all set, but you can make a quick check.
I took my chance on creating color grading. It may look easy in photoshop but there are some serious stuff going on there.
3. Opacity. I have one code for that, but I am not sure if it right.
float3 blend = 1- Colorx;float3 final = orgi * blend;final = (1-blend) * orgi + final * 0.2;
0.2 is opacity. I might have mixed one of the '1-'s.
2. Color is using HLSL to RGB conversion. But I have found resources for that though.
1. Average blur. What is that really? Averaging all pixels, if I know right, that means going through all pixels, with texture lookups which is insane. We go things in parallel with shaders. But there was one neat trick I learned, and it worked almost.
I first scaled the image with something like this.
Color = tex2D( s0, float2(Tex.x*512,Tex.y*512)); //512x512, I can put rcpres there later.
then upscaled
Color = tex2D( s1, float2(Tex.x/512,Tex.y/512)/2);
But putting 512 didn't worked, I got 4 pixels. When I tried 1024, this time it wasn't correct at all. So I decided to put a 2 there, and it worked. It can be my
stupidity, but it may be a HLSL bug. So what I get was very close to photoshop blur-average. But not exact. I had to have an additional '/2' for that. I thought maybe it was about min mag mipmap filters. I tried some combinations there. But I am not sure.
texture thisframe;texture lastpass;sampler s0 = sampler_state { texture=; minfilter = none; magfilter = none; mipfilter = none; addressu=wrap; addressv = wrap;};sampler s1 = sampler_state { texture=; minfilter = none; magfilter = none; mipfilter = none; addressu=clamp; addressv = clamp;};float saturatex = 0.65;float2 rcpres;float opacity = 0.8;float HueToRGB(float f1, float f2, float hue){ if (hue < 0.0) hue += 1.0; else if (hue > 1.0) hue -= 1.0; float res; if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue; else if ((2.0 * hue) < 1.0) res = f2; else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0; else res = f1; return res;}float3 RGBToHSL(float3 color){ float3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part) float fmin = min(min(color.r, color.g), color.B); //Min. value of RGB float fmax = max(max(color.r, color.g), color.B); //Max. value of RGB float delta = fmax - fmin; //Delta RGB value hsl.z = (fmax + fmin) / 2.0; // Luminance if (delta == 0.0) //This is a gray, no chroma... { hsl.x = 0.0; // Hue hsl.y = 0.0; // Saturation } else //Chromatic data... { if (hsl.z < 0.5) hsl.y = delta / (fmax + fmin); // Saturation else hsl.y = delta / (2.0 - fmax - fmin); // Saturation float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta; float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta; float deltaB = (((fmax - color.B) / 6.0) + (delta / 2.0)) / delta; if (color.r == fmax ) hsl.x = deltaB - deltaG; // Hue else if (color.g == fmax) hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue else if (color.b == fmax) hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue if (hsl.x < 0.0) hsl.x += 1.0; // Hue else if (hsl.x > 1.0) hsl.x -= 1.0; // Hue } return hsl;}float3 HSLToRGB(float3 hsl){ float3 rgb; if (hsl.y == 0.0) rgb = float3(hsl.z, hsl.z, hsl.z); // Luminance else { float f2; if (hsl.z < 0.5) f2 = hsl.z * (1.0 + hsl.y); else f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z); float f1 = 2.0 * hsl.z - f2; rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0)); rgb.g = HueToRGB(f1, f2, hsl.x); rgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0)); } return rgb;}float3 BlendColor(float3 base, float3 blend){ float3 blendHSL = RGBToHSL(blend); return HSLToRGB(float3(blendHSL.r, blendHSL.g, RGBToHSL(base).B));}//code starts here actuallyfloat4 Average(float2 Tex: TEXCOORD0) : COLOR{ float4 Color; Color = tex2D( s0, float2(Tex.x*(1/rcpres.x),Tex.y*(1/rcpres.y))); return Color;}float4 ColorGrade(float2 Tex: TEXCOORD0) : COLOR{ float4 Color; float4 orgi = tex2D(s0,Tex); float3 base = orgi.rgb; Color = tex2D( s1, float2(Tex.x/(1/rcpres.x),Tex.y/(1/rcpres.y))/2)*0.5; float grey_s = ((Color.r * 0.3) + (Color.g * 0.59)) + (Color.b * 0.11); float3 Colorx = lerp(grey_s, Color.rgb, saturatex); //Colorx = BlendColor(base, Colorx); /*float3 blend = 1- Colorx; float3 final = orgi * blend; final = (1-blend) * orgi + final * 0.8;*/ //float3 final = mix(orgi, Colorx, 0.2); //float result=mix(float a,floatb,float strength) //result=a*strength+(1-strength)*b; //vec3 pass4 = mix(pass3, BlendLinearLight(pass3, color), 0.4); float3 final = orgi * opacity + (1-opacity)* BlendColor(orgi, Colorx); return float4(final,1);}technique t0{ pass p0 { PixelShader = compile ps_3_0 Average(); } pass p0 { PixelShader = compile ps_3_0 ColorGrade(); }}Now, I know what I should do for Godrays, Soft Light Blend Mode...