Jump to content
  • Advertisement
Sign in to follow this  
Quat

How do you manage your effects?

This topic is 3094 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'm trying to come up with a good system to manage shaders. I use the effects framework to generate different techniques of shaders where I pass parameters to choose different quality levels, etc. Right now I only have a handful of effects, but each effect spawns numerous techniques. Also, I make a wrapper class for each effect that provides methods for getting all the effect parameter handles, and setting effect parameters. I define global instances of these effect wrappers since only one effect instance ever needs to be created. The system has worked for me OK so far. I'm just wondering what others are doing. I find writing the effect wrapper class lame but I don't really see a way around it. Each effect has different parameters, and I like to group the effect and all of the D3DXHANDLEs in a class for organizational purposes. It doesn't seem like there is an efficient way for the application to not know about the specific shader being used since the application must supply information to the shader. Does this shader need the camera position? Does it use a normal map?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Quat
The system has worked for me OK so far. I'm just wondering what others are doing. I find writing the effect wrapper class lame but I don't really see a way around it. Each effect has different parameters, and I like to group the effect and all of the D3DXHANDLEs in a class for organizational purposes.


I've seen some people experiment with creating tools that can auto-generate wrapper classes from an effect. It's not super-hard since you can use reflection to get all of the information you need from a compiled and loaded effect. You can also stick the compiled effect code in your wrapper class as static data, which then lets you create instances of the effect without having to compile from source or even load compiled data from a file. I never got around to playing around this with this stuff, but it could be worthwhile.

Quote:
Original post by Quat
It doesn't seem like there is an efficient way for the application to not know about the specific shader being used since the application must supply information to the shader. Does this shader need the camera position? Does it use a normal map?


You can certainly use semantics combined with a standard set of annotations if you want. This is how DCC tools and RenderMonkey/FXComposer do it. But in general I find that this isn't really worth it, since your app code is always somewhat tied into your effect code.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!