GG - nope, no change.
I tried a similar approach but couldn't get the LM stage to 'map' correctly (see adapted Blend shader from DarkShader). If you're willing to help that would be great.
Presumeably you're suggesting one technique to blend normally and another to do the greyscale when required. Or two shaders and swop between them? (for info, it's a 'thermal camera' representation I am doing).
In the meantime, I've also explored loading a duplicate set of resources using the current shader, which are swopped (hidden & excluded) until required. Seems to work but not sure of wider implications yet.
string Description = "This shader takes two textures and blends them by the blend factor, then tints the output with a diffuse color";
string Thumbnail = "BlendShader.png";
float4x4 WorldViewProj : WorldViewProjection;
float4 diffuse
<
string SasUIControl = "color picker";
> = { 1.000000, 1.000000, 1.000000, 0.000000 };
float blend
<
string SasUIControl = "slider";
float SasUIMax = 1.0;
float SasUIMin = 0.0;
float SasUIStep = 0.01;
> = 0.500000;
texture Texture1
<
string ResourceName = "";
>;
sampler texture1 = sampler_state
{
Texture = <Texture1>;
MinFilter = Linear; MagFilter = Linear; MipFilter = Linear;
AddressU = Wrap; AddressV = Wrap;
};
texture Texture2
<
string ResourceName = "";
>;
sampler texture2 = sampler_state
{
Texture = <Texture2>;
MinFilter = Linear; MagFilter = Linear; MipFilter = Linear;
AddressU = Wrap; AddressV = Wrap;
};
struct app_in
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
struct vs_out
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
float2 uv1 : TEXCOORD1;
};
vs_out BlendVS( app_in IN )
{
vs_out OUT;
OUT.pos = mul( IN.pos, WorldViewProj );
OUT.uv = IN.uv;
OUT.uv1 = IN.uv;
return OUT;
}
float4 BlendPS( vs_out IN ) : COLOR
{
blend = saturate( blend );
float4 Color = diffuse * ( tex2D( texture1, IN.uv )*(1.0-blend) + tex2D( texture2, IN.uv1 )*blend );
Color.rgb = dot(Color.rgb, float3(0.3, 0.59, 0.11));
//return diffuse * ( tex2D( texture1, IN.uv )*(1.0-blend) + tex2D( texture2, IN.uv1 )*blend );
return Color;
}
technique MyShader
{
pass p0
{
VertexShader = compile vs_1_1 BlendVS( );
PixelShader = compile ps_1_1 BlendPS( );
}
}
Habits can get you into trouble sometimes (unless you are a nun....)