Is there some way to apply a shader, like say an HLSL shader as opposed to a .fx? Also, is there a way to apply it to only the screen's output and not to an individual object? I want to be able to do something like apply an HLSL shader to the screen and the whole screen and nothing but the screen.
Very much like the Night Eye shader on Oblivion, or more to the point, my thermal vision mod for the night eye shader, which really is just HLSL so it can be used anywhere that HLSL can.
Here's my shader. Feel free to use it if you want. You'll find the effect is quite convincing for most applications. It just kinda gets its colors backwards if you have some hot dark object like a cast iron pot in the middle of a snow field. But if you control the game's engine that should be easy to fix, just keep two sets of textures. One showing hotness by brightness and one that's the actual real colors.
sampler2D Texture0;
float4 hsv(float hue) : COLOR
{
hue *= 6;
float h = frac(hue);
float4 p =
{
0,
1 - h,
h,
1
};
float4 result = { 0, 0, 0, 0 };
if (hue < 1)
{
result.rgb = p.xzw;
}
else if (hue < 2)
{
result.rgb = p.xwy;
}
else if (hue < 3)
{
result.rgb = p.zwx;
}
else if (hue < 4)
{
result.rgb = p.wyx;
}
else if (hue < 5)
{
result.rgb = p.wxx;
}
else
{
result.rgb = p.wxx;
}
return result;
}
float4 blur(float2 texCoord: TEXCOORD0) : COLOR {
float2 samples[12] = {
-0.326212, -0.405805,
-0.840144, -0.073580,
-0.695914, 0.457137,
-0.203345, 0.620716,
0.962340, -0.194983,
0.473434, -0.480026,
0.519456, 0.767022,
0.185461, -0.893124,
0.507431, 0.064425,
0.896420, 0.412458,
-0.321940, -0.932615,
-0.791559, -0.597705,
};
float4 sum = tex2D(Texture0, texCoord);
for (int i = 0; i < 12; i++){
sum += tex2D(Texture0, texCoord + .005 * samples[i]);
}
return sum * .215;
}
float4 ps_main( float2 texCoord : TEXCOORD0 ) : COLOR
{
float4 color;
float fLuminance;
float gray;
color = blur(texCoord.xy);
gray = (color.r + color.g + color.b) / 3;
gray = smoothstep(0, 1.6, gray);
color = hsv(gray);
return color;
}