I want to do the same. The only thing I haven't figured out yet is the formula for the warping, especially the 2 different types the unofficial build offers. I want to have it stay as true as possible to the original effect. But with a pixel (fragment) shader it should look much better. Although considering my past experiences with fragment shaders I somehow doubt there will any significant improvement in speed. Every time I used something more complex than a simple texel assignment the performance broke down measurably.
Even something simple like applying the invulnerability colormap
Code: Select all
struct pixel_in {
float4 color : COLOR;
float3 texcoord : TEXCOORD0;
};
struct pixel_out {
float4 color : COLOR;
};
pixel_out
main(pixel_in IN, uniform sampler2D texture : TEXUNIT0)
{
pixel_out OUT;
float4 color = tex2D(texture, IN.texcoord);
float gray = 1.0 - (color.r * 0.3 + color.g * 0.56 + color.b * 0.14);
OUT.color = float4(gray, gray, gray, IN.color.a * color.a);
return OUT;
}
was noticably slower than creating a texture duplicate and re-uploading every single texture.