I relative new in 3D graphics programing and I am confused how to manage effects.
I want to give option to users that use my api to add their own effects. I mean effect as combination of vertex/geometry/pixel shader and render states.
My first (and absolutely wrong I think) idea was that I do a lot of "mega-über-shaders" that combine every possible combination of effects. For example "NormallMappingAmbientOcclusionDiffuseAndBumpMappi ng shader".
Of course it is crap because there are so many possible combinations (and I am not even talking about limited number of instructions in SM3). Further, users couldn't add their own effects because they would have to rewrite every possible combination for their new effect.
So, it's wrong.
So, my second idea that could leads to goal is:
One "normal" shader for one effect. In this case, I'd render scene several times with corresponding shaders.
However, in this case I'd render scene too many times, wouldn't I?
Suppose that I want to render scene that contains transparent and opaque objects with per-pixel lighting(normal mapping), diffuse texture and ambient occlusion.
So render would be something like:
1) render opaque objects with diffuse texture
2) same with transparent objects
3) normal mapping
4) ambient occlusion
So I'd render scene four times. It's too many because there could be more effects, isn't it?
How to manage this?
I'd be very very thankful for your advices.