you could check out how Valve did it on Source? They had this _huge_ Powerpoint presentation about their shader technology.
It’s a PDF file called D3DTutorial10 half life 2 shading, dating from 22nd of March 2004. Very interesting, even for me who is only a beginner with shaders.
Hope this helps