Skip to main content
gamedev.net
🔒 Locked

Shader Framework

Started by Ksingh30 Aug 8, 2007 at 12:03 PM 1 replies 2.2k views
Original Post
Ksingh30
Ksingh30
how would you do a framework for a set of shaders? Ok lets say you have multiple fx files. which you use for different objects in your scene, and you also have multiple lights in your scene. in which case you have to pass in your lights to each shader(which is in its own fx file) so the final pixel color can be determined. but my question is how do you do a framework such that you dont need to pass in each light to each shader, so all that info can be kept in a fx file for all the other shaders to use.
gunning
gunning
Have you checked out the Effect Pools Sample in the DirectX SDK?

Quote:
One of the downsides to using multiple effects in a single application is that many effect variables need to be set for each effect. It is often the case that many of these variables are common between effects. Without a method for sharing variables or shaders between effects, many rendundant set calls will need to be made setting data that is exactly the same for each effect. Effect pools are meant to solve this problem. Effect pools allow different effects to share variables, textures, and shaders between them. This means that for common variables, the data needs to be set only once per frame, rather than once per effect invocation.


Also, if you have a lot of shared code between effect files, the #include directive is helpful for extracting common functionality into a separate file.
....[size="1"]Brent Gunning
Ksingh30
Ksingh30
Effect Pools, Cool, just what i was looking for thank you.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.