Shaders and What They Do

Started by
3 comments, last by enigmatix 16 years, 9 months ago
So I've been working with MDX9 for the past 2 months now and I've gotten a pretty good feel for it. I think I'm ready to move onto Shaders, but before I do, I wanted to clear up a few things that were not covered or expanded on in the tutorials and articles that I've read. With that said, I'm working on an engine thats object oriented. I basically have a class for a light, camera, sphere, cube, etc... I know how the Shader fits into the pipeline, but I'm not quite sure how it handles things. For example, the shader handles texturing and lighting, but how does that fit into setting up lights or texturing with stages. I mean, right now i would use something like this to setup my light:
[SOURCE]

DXdevice.Lights[0].Type = LightType.Point;
DXdevice.Lights[0].Position = new Vector3(4, 4, -2);

[/SOURCE]
Or this to set my texture...
[SOURCE]

DXdevice.SetTexture(0, mytext);

[/SOURCE]
If i start using Shaders, does this all become redundant?
Advertisement
The entire light setting structure is completely ignored if you use the programmable pipeline.

As for texturing, calling Device::SetTexture still has an effect, but in general, you'd want to avoid using the device function, and would instead use Effect::SetTexture.

So, in short, if you use Effects correctly, you shouldn't be calling either of these two.

Hope this helps.
Sirob Yes.» - status: Work-O-Rama.
when you move to using your own shaders, you'll be responsible for all of the transformation and lighting yourself, and passing in lights as constants. this gives you a lot of flexibility in shading, and you'll get a good understanding of how the pipeline is working under you once you implement your own shaders.

directx lights suck anyway.

if you need basic shader help email me at programmer_tom@hotmail.com and i'll send you some simple startup stuff.

-programmer tom
If you want another link to introduction HLSL, please refer to MDXInfo<a/>.

I hope this helps.
Take care
Thanks guys. I've been busy for the past couple days but I'm gonna start working on this stuff now. :)

This topic is closed to new replies.

Advertisement