Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Stated below is the code for my pixel shader which I am rendering after the vertex shader. I have set the wordViewProjection matrix in my program but I don't know to set the progress variable i.e in my pixel shader file which will make the image displayed by the help of a quad to give out transition effect. Here is the code for my pixel shader program:::

As my pixel shader is giving a static effect and now I want to use it to give some effect. So for this I have to add a progress variable in my pixel shader and initialize to the Constant table function i.e

constantTable.SetValue(D3DDevice,"progress",progress );

I am having the problem in using this function for progress in my program. Anybody know how to set this variable in my program.

And my new pixel shader code is

float progress : register(C0);
sampler2D implicitInput : register(s0);
sampler2D oldInput : register(s1);

struct VS_OUTPUT
{
    float4 Position  : POSITION;
    float4 Color     : COLOR0;
    float2 UV        : TEXCOORD 0;
};

float4 Blinds(float2 uv)
{               
    if(frac(uv.y * 5) < progress)
    {
        return tex2D(implicitInput, uv);
    }
    else
    {
        return tex2D(oldInput, uv);
    }
}

// Pixel Shader
{
    return Blinds(input.UV);
}
share|improve this question
    
The constant table will allow you to set the variable; whatever you're doing wrong, it's probably in code you have not shown. –  Josh Petrie Jun 29 '11 at 14:55
    
Thanks I did the same before your suggestion and got the desired results. –  Yashwinder Jul 1 '11 at 10:06
    
Not sure what you mean -- but if you've found an answer to your problem, you should post it here and mark it as the answer in case somebody else comes along with a similar question and could benefit from your experience. –  Josh Petrie Jul 19 '11 at 14:52
add comment

closed as unclear what you're asking by Josh Petrie Dec 16 '13 at 16:27

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.