dhpoware logo
navbar
home products source demos contact us
navbar navbar
box top left corner box top right corner
 
 
Direct3D 9 Multiple Point Lights Demo.

This Windows Direct3D 9 application demonstrates per pixel lighting using multiple point light sources. Lighting using multiple light sources can be performed in a single pass or with multiple passes that are additively blended together.

Two versions of the per pixel Blinn-Phong Direct3D Effect (.fx) file are provided: a shader model 2.0 version, and a shader model 3.0 version. Both versions implement per pixel Blinn-Phong point lighting and supports attenuation (based on a light radius) and (Blinn-Phong) specular highlights.

The shader model 2.0 version quickly reaches the 64 arithmetic instructions limit with more than 2 point lights in a single pass.

Shader model 3.0 contains a loop instruction that greatly reduces the total number of instructions used. The shader model 3.0 version is hard coded to support a maximum of 8 lights in a single pass. However the shader is able to support more than this. This is a limit set by this demo.

An alternative to single pass lighting is multi pass lighting. With multi pass lighting the scene is rendered once for each point light source. Each successive rendering pass after the first is additively blended together. This works well for less capable hardware that can only support shader model 2.0. But lighting using multiple passes is much more expensive compared to single pass lighting. For example, running this demo using only shader model 2.0 on a 2.4 GHz Intel Core2 Duo system with a NVIDIA G80 class video card saw a 33% drop in frame rate when switching from single pass lighting to multi pass lighting.

The shader model 2.0 version supports both single pass and multi pass lighting. The shader model 3.0 version only supports single pass lighting.

This demo was built using the June 2010 update of the Microsoft DirectX SDK. The required end-user runtimes can be downloaded here.

To learn more about per pixel lighting in Direct3D check out the Direct3D 9 HLSL Pixel Lighting Demo.

Note:
1. This demo requires shader model 2.0 or higher support.
2. This demo requires the Visual C++ 2010 Library Runtimes. Download instructions can be found here

screen shot

zip file Download executable, source, and Visual C++ 2010 solution files.

Change History:

10 July 2010.
Added missing .vcxproj.filters file to the project.

13 June 2010.
Updated solution to Microsoft Visual Studio 2010.

 
box bottom left corner content box box bottom right corner
logo logo