Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At the moment I am trying to create a tech demo in directX 9. I have a good understanding of basic lighting but, in my game/demo, I want to be able to create and light a scene like the following:

enter image description here

Could someone please help me and point me in the direction of a good base light class, or where I could learn how to implement one myself?

share|improve this question
It's from UDK showcase ( with DirectX 11 specific Deferred Lighting. Will be hard time achieving it with DX9... – joltmode Jul 3 '12 at 20:27
I know. Just wanted a sample picture of the type of thing I'm after mate. Easier to show a picture :) – N0xus Jul 3 '12 at 20:31
As I said, hard time achieving with DX9. Try googling DX9 Deferred Shading / Rendering. – joltmode Jul 3 '12 at 20:36

That tech demo uses deferred rendering, it might be hard to get exactly that quality but it is perfectly possible to write a deferred renderer for DirectX9.

The idea behind deferred rendering is that you trade video memory for speed of calculating lighting. You create multiple render targets (using MRT) one for the lighting, one for the diffuse + specular intensity, one for the normals + specular power. Light calculations needed for adding a new light are performed on the data from the render targets (mainly from normals and depth data in there) so drawing an extra light means you don't have to draw the geometry an extra time. This way a scene with a dozen or even a hundreds of lights is possible, as opposite to a normal forward renderer where you have to draw all the geometry for each light, which quickly becomes costly.

Unfortunately computing shadows is still expensive but good designers have noticed that it's not necessary at all for all lights to cast a shadow to get a realistic scene.

An excellent example of this technique is the game S.T.A.L.K.E.R, and lucky for you they did a few articles on their implementation of the technique which are available for free at nVidia's developer pages.

Another similar technique is called light pre-pass of which some excellent slides by Wolfgang Engel are available here

Now as for some tutorials to point you at, I don't know of any specific C++/DirectX 9 one's, but to show it's possible this is a tutorial for deferred rendering in XNA, which uses only techniques available in DirectX 9 (XNA can't do any DirectX 10+ stuff since it has to run on the Xbox 360 as well)

share|improve this answer

Achieving the quality of lighting in the screenshot you provided and takes a team of programmers and a small army of artists. You're better off using an existing engine (like the Unreal Development Kit or CryEngine) which has the lighting you want.

However, if you want to do it yourself, I'd suggest taking a look at this presentation: Rendering Tech of Space Marine. It goes to great lengths to explain the techniques used in their DirectX 9 deferred renderer. It should either give you a starting point or let you realize that you've bitten off more than you can chew.

Keep in mind that it took them close to 6 years to develop Space Marine from scratch on Xbox 360 and PC.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.