Either I'm doing it
completely wrong, or the manual is wrong about how to use vecSkill1-4 in shader code.
according to the manual:
Quote:
float4 vecskill1; // shader code: define the vector
...
float fValue = vecSkill1.x; // fValue now contains 1.5
and here's one of my shader codes, done exactly the same way:
Code:
float4 vecSkill1;
float contrast= vecSkill1.x; //a tweakable
//YOU DON'T WANNA SCREW WITH THIS STUFF! ;)
float4 vecViewPort;
texture TargetMap;
sampler TargetSampler= sampler_state {texture= <TargetMap>;};
//the shader function
float4 Shader_PPS(float2 tex :TEXCOORD0):COLOR0
{
float4 color= float4(0.5,0.5,0.5,1.0);
color= tex2D(TargetSampler,tex.xy);
if(color.r < (contrast / 100)) //if the red value of each pixel is less than 65 / 100= 0.65...
color.r= 0.0; //nullify it.
if(color.g < (contrast / 100)) //same here with green
color.g= 0.0; //ditto
if(color.b < (contrast / 100)) //"
color.b= 0.0; //"
return color; //give the result; render it to the screen.
}
technique postprocess
{
pass p0
{
Lighting= False;
PixelShader= compile ps_2_0 Shader_PPS(); //compile the shader function using Shader Model 2.0.
}
}
When I try to run my program, however, I get an "Error in effect" message (about 3 times) saying that my float definitions (the ones with vecSkill1.x) have to be literals.
Am I doing this completely wrong?