Jump to content
  • Advertisement
Sign in to follow this  
mancubit

Shader effect system design

This topic is 2171 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 am currently working on the shader effect system for my rendering engine and i am not quite sure how to properly design it. A shader effect in my engine describes the shader pipeline configuration for a single rendering effect (this basically means setting the right shaders for each stage and setting the correct shader parameters). What i want to achieve is a system with high flexibility without making it overly complex and unmaintainable.

Having this said, I can't figure out a good way to handle shader parameters that exist in more than one shader but are different in its type. For instance lets say i have a single shader effect which combines a vertex shader which has an parameter "Color" as a vector3 and a pixel shader which also has a parameter "Color" but as a vector4.

The problem is, it would be nice to set the parameters by using a parameter name, but what should i do in case of the example above?

The solutions that came into my mind are the following:

  1. Do not allow a combination of shaders where shader parameters conflict (kind of unflexible)
  2. Ignore shader parameter conflicts and just set the bytes that fit into the parameter / are provided by the application (maybe results in hard to find errors)
  3. Set the parameters per shader and not for the whole shader effect (uncomfortable)


Personally I am not a big fan of any of these solutions, but i think (1) and (2) could be ok. Setting the parameters for every single shader (3) feels a little bit too tiring and uncomfortable.

I am interested in how you handled this problem in your code. Are there any good solutions i have not thought of?

Thanks for your help!

Share this post


Link to post
Share on other sites
Advertisement
I would do 2, but produce an annoying warning/error if there are parameters with matching names but differing types. Edited by JimC1664

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!