Original Post
So.... I'm one part confused, and one part looking for suggestions. I have a basic rendering engine that can do all kinds of wonderful multipass- material/effect-shader-offscreen-rendering type things, but it's not very robust yet, and I'm not sure what needs I should expect to meet with it. So, first question, if a graphics card has x texture units, does that become an actual limit to the number of textures you can read from in the shader, or can a card swap textures around so that you can read from say 8 textures on a card that only has 4 units. Second question, in todays typical setup were a renderer may have to render a model multiple times (say once for each light/shadow map, plus a number of fancy extra effects), what is the best way to set things up so that you don't end up writing special case shaders for everything, and so that you can take advantage of multiple texture units so that you can, say, do all of your lighting in one pass, and all of your effects in another pass. I hope the question isn't too general, but I'm not completly sure how much my system has to be prepared to support. I've just read posts were people mention rendering systems processing 20 lights on a model, or doing x number of shadowed lights, so I'm wondering what's a realistic target to shoot for. Let's take kind of a general case situation, though. There is a model, with three lights that are done with normal mapping, and shadow mapping, maybe some other type of effect like paralax mapping, and, just for fun, we'll throw in one more pass for a special effect, and possibly a simple vertex lighting pass for 5 or 6 less important lights. Does anyone have a good way to manage all these passes so that you take full advantage of the hardware's capabilities. Without having to write 100 different shaders? I've seen it mentioned before techniques that generate shaders on the fly, has anyone tried out something like that?