Sign in to follow this  
adder_noir

Hi I'm confused about Pixel Shaders & Effect files

Recommended Posts

adder_noir    275
Hi!

I'm ok getting a vertex shader to work using the effect file format. I just use the handy DX functions to load the effect file.

BUT!

I'm told a pixel shader can also be used with the effect file format!

Now as far as I know you can have or have to have a vertex shader and a pixel shader active simultaneously. That sounds ok. I'm getting confused though.

1)If you're using an effect file is the vertex shader and pixel shader combined into one .fx file?

2)If 1) is not the case do you need to call the Effect->BeginPass(int) for both the vertex shader and pixel shaders or can you combine both into one BeginPass call?

Pretty sorry state of affairs but I really need with this one :rolleyes:

Thanks so much for any clarity anyone can offer :)

Share this post


Link to post
Share on other sites
Waaayoff    952
[quote name='adder_noir' timestamp='1310640176' post='4835204']
1)If you're using an effect file is the vertex shader and pixel shader combined into one .fx file?
[/quote]
Yes

Share this post


Link to post
Share on other sites
mhagain    13430
Yup, a simple format might look like (with some stuff ommitted for clarity):[code]struct PSInput
{
...
};

struct VSInput
{
...
};

float4 MyPS (PSInput Input) : COLOR0
{
...
}

PSInput MyVS (VSInput Input)
{
...
}

technique t0
{
pass p0
{
VertexShader = compile vs_3_0 MyVS ();
PixelShader = compile ps_3_0 MyPS ();
}
}[/code]

Share this post


Link to post
Share on other sites
adder_noir    275
Great! I love straightforward replies!!! That's so good it means I can simplify the way light and materials are handled in the application now :D :cool:

Thanks so much - now back to learning for me :wub:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this