sampler2D ImplicitInput : register(s0);
float4 main (float2 uv : TEXCOORD) : COLOR
{
float4 color;
color = tex2D( ImplicitInput, uv);
color.rgb = color.r*0.3 + color.g*0.59 + color.b*0.11;
return color;
}
Rouge * 0.3 + Vert * 0.59 + Bleu * 0.11
float3 nivGris = float3(0.30, 0.59, 0.11);
color.rgb = dot(tex2D( ImplicitInput, uv).rgb,nivGris);
color.a = tex2D( ImplicitInput, uv) ;
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.24.949.2307
// fxc /T ps_2_0 /E main /Fx MyEffect.txt MyEffect.fx
// Parameters:
// sampler2D ImplicitInput;
// Registers:
// Name Reg Size
// ------------- ----- ----
// ImplicitInput s0 1
ps_2_0
def c0, 0.589999974, 0.300000012, 0.109999999, 0
dcl t0.xy
dcl_2d s0
texld r0, t0, s0
mul r1.w, r0.y, c0.x
mad r1.x, r0.x, c0.y, r1.w
mad r0.xyz, r0.z, c0.z, r1.x
mov oC0, r0
// approximately 5 instruction slots used (1 texture, 4 arithmetic)
def c0, 0.300000012, 0.589999974, 0.109999999, 0
dp3 r1.z, r0, c0
mov r1.w, r0.x
mov r1.xyz, r1.z
mov oC0, r1
dp3 r0.xyz, r0, c0
// approximately 3 instruction slots used (1 texture, 2 arithmetic)
float4 nivGris = float4(0.30, 0.59, 0.11, 0);
color = dot(tex2D( ImplicitInput, uv),nivGris);
dp3 r0, r0, c0
float4 nivGris = float4(0.30, 0.59, 0.11, 0.001);
def c0, 0.300000012, 0.589999974, 0.109999999, 0.00100000005
dp4 r0, r0, c0
couleur corrigée = couleur + intensité
1 - exp(-x)
avec x = couleur * facteur
avec facteur >= 0
public class MyEffect : ShaderEffect
public MyEffect()
this.PixelShader = _pixelShader;
UpdateShaderValue(ImplicitInputProperty);
private static PixelShader _pixelShader = new PixelShader()
{ UriSource = new Uri(@"pack://application:,,,/MyEffect;component/MyEffect.ps") };
public static readonly DependencyProperty ImplicitInputProperty =
ShaderEffect.RegisterPixelShaderSamplerProperty("ImplicitInput", typeof(MyEffect), 0);
public Brush ImplicitInput
get { return (Brush)GetValue(ImplicitInputProperty); }
set { SetValue(ImplicitInputProperty, value); }
public static readonly DependencyProperty FacteurProperty = DependencyProperty.Register(
"Facteur", typeof(double), typeof(MyEffect),
new UIPropertyMetadata(0.0, PixelShaderConstantCallback(0))
);
public double Facteur
get { return (double)GetValue(FacteurProperty); }
set { SetValue(FacteurProperty, value); }
new UIPropertyMetadata(0.0, PixelShaderConstantCallback(0), CoerceFacteur)
private static object CoerceFacteur(DependencyObject dpdObj, object valeur)
MyEffect effect = dpdObj as MyEffect;
double facteur = 0;
if (effect != null && double.TryParse(valeur.ToString(), out facteur))
if (facteur < 0.0 || facteur > 10.0)
return effect.Facteur;
return facteur;
UpdateShaderValue(FacteurProperty);
float facteur : register(c0)
float4 coul;
coul = tex2D(implicitInput,uv);
coul.rgb = 1.0 - exp(-(coul.rgb * facteur));
return coul;
factor -= 1;