A lot going on, both in this project and in real life, but managed to make some progress.
Found a really strange speed up.
When you draw something, you have to pass parameters to the shaders. The standard way to do that is to do this
shader.Parameters["parameter_name"].SetValue(parameter_value);
Doesn't look like there is much you can do to speed that up does it?
Well the parameter array on the shader is an array of EffectParameter , so I changed the code to cache these objects myself.
Instead of using the default Effect class I created a RenderEffect class which held the shader and a dictionary of all the EffectParameter in it
The actual code looks identical, I didn't need to change any of it, I just changed shader from Effect to RenderEffect
The result.
Extra 20 FPS
20 FPS
This is mad
In the other part of the code, I am still not happy with the plotting room scene above. Doesn't look good enough.
So I decided to go OTT on it
I am currently finishing off photon mapping for the scene
Photon mapping constructs a ray from every pixel on every object to every light, works out how many photons will strike this pixel and stores it.
Then it creates a reflected ray from the pixel into the world, and works out where that ray will strike in the scene.
It adds the photons reflected to that pixel , then repeats the reflection pass until no photons remain.
Hopefully it will make the lighting more realistic