Hay, As some ppl may be interested.
Since playing STALKER Iv been trying to get deferred lighting going in DBP. Its very nifty if you have a goodish gfx card, In the demo there is 30 fully dynamic lights where I get 300-400fps when vsync is turned off on my 7800gtx.
In the traditional multi-passes rendering there is a to bigger hit on performance when you start to get just 5-6 dynamic lights going. Since most up coming games are now going to use deferred shading(crysis?, Bioshock?, offset?) for there real time lighting/shadows, I think DBP should have slice of the cake(or pie) too.
Basics on how it Works.
First, you need to Store a position texture. like so >
Next, Since DBPs floating point texture are 32 bit we need to create a second position texture that repeats its self base on the fist position texture. This is to get a more accurate world position for finer lighting, otherwise well get blocky per-pixel lighting on lager world.
Now we need to store the world normals data in to a texture.
Now we have all the date we need. We project all 3 texture on to spheres(much faster than using full screen quads) that will represent each light. Reconstruct position/normals so it represents the original 3d world. And draw the per pixel lighting as we normally would do. Then Store the multiple Lighting results we get in a FP texture and project it back on to the main scene with the diffuse texture. so we end up with >
So all in all, main geometry gets Drawn 4 times and the lighting spheres gets Drawn once. But you will need a very good gfx card as it requires 4 full screen floating point texture renders to work.
Iv also added parallax mapping as an extra bonus,you can just about see it in this shot.
Demo
hereRequires : VS2.0 and PS2.0 + ability to Draw full screen FP textures.
Im now currently trying to add cubic lighting and cubic base depth shadow maps to get some form of shadowing, Like in stalker. But will require you to own dark shader for the dynamic cube maps if you wish to compile.
EVO,