However since the lighting was added in, with arbitrary numbers of lights (5 shadow-mapped lights now being used), then engine has slowed down greatly. Time to revisit the render channels.
Ambient Lighting is an obvious task here. Currently, I draw the depth/normals map, create the ambient cube map, calculate SSDO, and then - using forward-pass geometry - draw the ambient lighting into the scene, looking up SSDO and the ambient cube map.
However the screen-space data is all there ready to be used - screen space normals and SSDO. Additionally, the screen-space fogging that fades the scene out to the ambient cube map is almost identical to what I want to do. So hell, let's do it!
Adding Screen-space Ambient
1. Add a new RenderChannel and generateSSAmbient() to CameraScene.py
2. Create data/screen_space_ambient.xml - copied from data/fog.xml as the effect is similar
3. Create shaders2/post/ssambient.vs3 and .ps3
NOT SURE WHY : can't blend in the SSDO results in texture stage 3. Just cant seem to be able to read the texture map
4. Remove old ambient lighting path
Difference==========old way : 3098 / 34134 draw commands 99.1msecnew way : 2564 / 31921 draw commands 89.9msec
Apart from the issue mentioned above, the new screen-space ambient lighting looks exactly like the old forward-render ambient lighting, except the number of draw-calls drops by about 20% and the render time drops by 10%. And there are many more instances of this kind of rendering optimisation just waiting to be done..