• Advertisement
Sign in to follow this  

DirectX 10 shader management

This topic is 3339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have my application setup so that I can easily use any shader for my entire scene however I want to be able to switch shaders at runtime and be able to set a custom shader for each object in my scene. I began writing a shader manager class, however when I try setting separate shaders for each of my objects, I get some strange rendering problems. I have found plenty of information on the net about setting up a shader in directx 10, however I can't seem to find anything pertaining to using multiple shaders and switching between them. Does anyone know of a good resource about efficiently managing shaders in directx10? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
What rendering problems did you face when you tried to switch shaders?

I think you need to ensure you have the correct input layouts for the various shader you wish to switch to. Furthermore you probably need to account for different shader constants usage.

For example, shader A may need a specular constant, while shader B don't. Hence when you switch from shader B to shader A, you need to now update the mesh specular constant too.

hope this helps

Share this post


Link to post
Share on other sites
My problems mostly had to do with the position of the objects. A few objects were being rendered in the wrong place, yet still visible, but a few objects were simply not drawn (I suspect they were being drawn outside of my far clip plane.
Thanks for the reply I will look into the input layouts and shader constants.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement