Deferred VS Forward

I tested unity3.0 for few weeks and now i could show some thing i got.
Deferred VS Forward
At first,when i test deferred ifound it much slower than forward.
I was told the scene i used to test deferred is too simple and need more light.
So i did this scene.
This scene don’t have much special thing.
some imageeffect: SSAO,Bloom,DOF,Sun Shafts,
The modeles were downloaded from internet,i just wrote some skin shader for them.
Only one light with shadow(this would be good for forward to beat deferred ~:))

my pc:
HD4850 1G
core i7 3.66G
6G ram
windows xp64

here is my result.

in the resolution 1920*1200
Deferred could got around 23 fps and forward only got around 19 fps.

in the resolution 1280*800
Deferred could got around 45 fps and forward only got around 38 fps.

in the resolution 640*300
Deferred could got around 110 fps and forward only got around 63 fps.

Now i believe deferred is better than forward.
I hope some bug in deferred could be fixed soon~
When i add SSAO with deferred,i found some black faces in the back of the leaves,(the levaves use the transparent\cutout shader,i just add cull off in it)
in forward,there is no this problem.

I am not 100% sure, but forward allows you to use max 8 dynamic light sources per scene, while deferred - at least an order of magnitude more with the same performance hit. So deferred only makes scense if you do need many light sources in your scene like the city lights for instance

The example you showed - openworld during day time, does not need deferred. Try to simulate a city with many torches

Simulate a city would made deferred beat forward in a big advantages.
I don’t even need to test it. :stuck_out_tongue:

@Nikolay116 forward is not capped to 8 lights or any number of lights (OGL fixed pipeline was limited to 8 GL_LIGHTS, but programmed pipelines allow you to overcome that restriction). [no clue if this applies to Unity implementation honestely]

As for deferred and forward. Deferred default cost is HIGHER than forward, as you need to work with several buffers and do some post processing on the g-buffer. The benefit of this technique is simple: linear cost for adding lights. Therefore, in short: the only reason to use deferred is because you want to have a good amount of lights, if you are using directional outdoor light with nothing extra, makes no sense to use it.

There’s no hard numbers like “8 light sources” or anything…the cost of deferred rendering with lights depends on the number of pixels being lit, so e.g. 50 small point lights could potentially take the same amount of time as 1 large point light, if the area they both lit was the same. Whereas 50 small point lights in forward rendering will always be slower than 1 large point light, because the cost depends on the number of lights.

–Eric

then why deferred could beat forward in my scene?
there is only one light.

3 Likes