Page 1 of 3
Deferred Shading with Alpha support!!!
Posted: Mon Jun 23, 2008 3:49 pm
by Nadro
Hi, I create example Multi Lighting (6 Lights one per pass) Deferred Shading for Irrlicht (Direct3D9 and OpenGL are supported). I tested it on my Radeon 2600 PRO and all works fine:) In example I include 2 versions of dwarf from Irrlicht SDK (one orginal and second is smoothed) for compare Deferred Shading with standard Forward Rendering. This is conclusion:
*On low poly scene (4 000 poly per frame Forward Rendering is faster than Deferred Shading)
*On scene with 35 000 poly per frame performance is very similar
*On scene with 100 000 poly per frame (standard in games) deferred Shading is faster than 6 passes Forward Rendering with VBO
I think than Deferred Shading is very very useful technique for games also Outdoor and Indoor, Forward rendering is only better for small demo scenes.
You can download it from:
http://nadro.net46.net/Demos/DeferredShading.zip
or:
http://www.sendspace.com/file/m2w60d
Posted: Mon Jun 23, 2008 4:04 pm
by JP
The deferred version doesn't work on my work PC, just get a black screen... forward rendering seems to work ok..
But well done anyway!
Could you give some more info on what deferred shading is? Is it like doing one pass per frame and then combining them later or something?
Posted: Mon Jun 23, 2008 6:25 pm
by Nadro
You have NVIDIA card? In DirectX work properly? In OpenGL I add ATI_draw_buffers extension, so maybe GeForce don't work currently (I can't test it because I don't have GeForce). I will upload modified version also for GeForce cards today in night. Deferred Shading passes looks that: 1 Pass G-Buffer pass, and N-Pass for N-Light with draw only quad screen with G-Buffer infos.
Re:
Posted: Mon Jun 23, 2008 7:36 pm
by PI
Hello!
Sounds pretty cool! It would be great to have innumerable light sources in irrlicht
I'd like to try it out but every time the archive seems to be broken!
Can you please check it?
Thanks!
PI
Posted: Mon Jun 23, 2008 7:51 pm
by lostclimategames
i should probably be wiki-ing this but what is deferred shading?
Re:
Posted: Mon Jun 23, 2008 8:06 pm
by PI
It renders a scene:
- 1X with diffuse textures
- 1X with normal maps
- applies lighting on the screen-space (why to calulate lighting on an object if not even being on the screen or just some parts of it are visible?)
- mixes these frames within a post process
Pros:
Theoretically innumerable lights
Worth to use with large scenes, many lights, because it's relatively fast
Cons:
Slow for smaller scenes (compared to forward rendering)
Transparent/Opaque objects are problematic to render
Am I right, guys?
Cheers,
PI
Posted: Mon Jun 23, 2008 8:39 pm
by dlangdev
Very nice, thanks for sharing the code.
Awesome.
By the way, I found this link about deferred shading...
http://www.talula.demon.co.uk/DeferredShading.pdf
Posted: Mon Jun 23, 2008 8:56 pm
by Halifax
Wow, amazing deferred shading example Nadro. Surprisingly I am running the deferred shading example, in D3D9, with the hi-poly scene at 8 FPS with a screen size of 1024x768, and I only have an ATI Raedon 200M Xpress. By the way with the same settings, but only forward rendering I only get 4 FPS.
Posted: Mon Jun 23, 2008 10:08 pm
by Nadro
Hi, I check the archive and is ok, I downloaded archive and unpacked it and all unpacked properly, You try redownloaded file, maybe it was temporary server problem. Who can test it with GeForce cards? In next version I will improve problem with poor precision of RTT Normals;)
Posted: Mon Jun 23, 2008 10:15 pm
by dlangdev
Spec: Nvidia 8500
menu option: A,A,B,A
menu option: A,A,B,B

Posted: Mon Jun 23, 2008 10:23 pm
by Nadro
Thanks for test:) So, ATI_draw_buffers extension activate in Cg shader dosn't cause conflict with ARB_draw_buffers for NVIDIA cards:) BTW. You have got very good results on Your GF8500, better than Me on Radeon 2600 PRO with unfinished DirectX drivers:)
Posted: Mon Jun 23, 2008 10:28 pm
by dlangdev
Have you tried shadowmaps?
Not sure if FPS will still be that high if shadows were calculated into it, though. Coz the lights are too close together. I mean, the convexes are inter-penetrating, I read that's an expensive calculation.
Posted: Mon Jun 23, 2008 10:40 pm
by Nadro
ShadowMaps will be of course work properly:) But it need n-pass for n-light if You need shadows from all lights, because we have to grab depth value;)
Posted: Mon Jun 23, 2008 11:26 pm
by BlindSide
Ooooh you beat me to it, I was about to make a tutorial on how to do this in Irrlicht. (Maybe I will change my mind now

)
Anyway, nice work, it's great to see the quality of programmers in this forum improving.
Posted: Mon Jun 23, 2008 11:30 pm
by BlindSide
Ooooh you beat me to it, I was about to make a tutorial on how to do this in Irrlicht. (Maybe I will change my mind now

)
Anyway, nice work, it's great to see the quality of programmers in this forum improving.