   Multiple effects with material or mutliple materials with effect clones
  Hi,my question seems fairly simple, but you never know with these GPU´s. imagine the case that you want to render 20 objects with the same effect file, but with different effect settings. Which of the following solutions would be best:Clone the effect for each "material" and doeffect.Begin();effect.beginPass();drawObject();effect.endPass();effect.end();for each object, or do something likeeffect.begin();effect.BeginPAss();foreach(object){  effect.SetParameters(object);  drawObject();}effect.endPass();effect.end();Maybe this is a silly question, but it's been bumping my head ever since. The first one seems easier for coding but slower in code, however the second one seems more hard to code/track and might be slower cause of all the parameter switching all the time.Any advice?Jan   
  Hi,Just pass the parameters which are same for all objects you want to render. Then for every object, just pass other object parameters to your effect then render.For example; view, inverse view, projection matrices and global light parameters are always same for all objects. But world, inverse world transpose matrices and material props are different. First you must pass the common parameters, then before rendering objects, pass that object's other parameters.Hope this helps.   ;  Ok, so you are saying definatelly the second approach right (it was lazy psuedo code)? But as you are saying it, i would rather think about Shared parameters... for View and Projection for example.   ;  is there no one else that can give his opinion or whatever?   ;  You could let each material have a reference to an effect, and if it really is the same effect then it references to the same effect. That way you can still draw your objects individually if you want. When you render a bunch of them, you can check whether the effect you are going to use is the same as the one before and just call commitChanges() instead. It is similar to your second idea, I guess.Here is an example of what I mean:void EffectStateChangeSaver::useTechnique(const Effect *effect, const std::string &technique) {if (m_effect == effect && m_technique == technique) m_effect->commitChanges();else{flush();m_effect = effect;m_technique = technique;m_effect->setTechnique(m_technique.c_str());m_effect->begin();m_effect->beginPass();}}void EffectStateChangeSaver::flush(){if (m_effect){m_effect->endPass();m_effect->end();m_effect = 0;}}If you are rendering several objects with the same technique (that only has one pass), calling CommitChanges() every time will be cheaper than calling Begin(); BeginPass() every time.   ;  Aha thank you so much for your advice, it seems like I was totally wrong on this side. I thought cloning an effect and making sure it has it's own params set all the time was the best way to go, but I guess I was wrong :-)   