   Shader architecture question.
  Hey all.I decided that I needed a hobby programing project again ;)So I started reading up on shaders and was left with a question when it comes to multiple shaders.Say I have 2 materials Ma and Mb, now in my scene I want to have pp-lights as well as using Ma and Mb, (The light shader can be called ML)Do I need to just copy-paste the lightcode so that they both contains the same code + there unique characteristics. (Ma + ML)Or is there someway to link more shaders (and have them running) at the same time, or is it normal to have some kind of code generator that generate these shaders runtime so that they contain the light code as well?cheers   
  I know it's pretty common to build your shaders out of building blocks. Often a graphical editor is used to link the different shader modules together. Alternatively you can just use a naming convention and then compose modules with simply a list.I have not build my uber system yet, so i dont have much more advice. But this is something i've always wanted and arguably needed.   ;  If you want to combine 2 effects there are a few ways to do it:1 - you sit down and type2 - you do multipass rendering (first pass uses shader 1, second pass uses shader 2)3 - you have code to generate the complex shader you need   ;  There's also Cg interfaces, which let you combine shader "snippits" in an object oriented way at runtime.DX11 is introducing what looks to be basically the same thing to HLSL-SM5.   ;Quote:Original post by V-manIf you want to combine 2 effects there are a few ways to do it:3 - you have code to generate the complex shader you needI use this third method, and it works pretty well. However, I am working in Python, so string manipulations are a lot simpler than in C/C++.   