|Direct3D Third Person Camera Demo - Part 1.
This is the third demo in the Direct3D camera demo series and it builds on the previous demo. In this demo the third person camera model is implemented. The third person camera model is also sometimes referred to as the chase camera model. The third person camera is different to the first person and flight simulation camera models in that the user does not explicitly control the third person camera.
A third person camera is attached to an object in the game world. The third person camera is typically positioned at some distance behind and above this object. As the user moves and rotates this object about the game world, the third person camera will follow this object and reposition itself so that it is always oriented behind and above this object.
The third person camera model in this demo does not implement any dampening or lag when the camera repositions itself in response to the target object being moved and rotated. This results in the camera snapping to its new position and orientation. To minimize this behavior time based movement and rotations are used. A future demo will address this problem.
This demo was built using the June 2010 update of the Microsoft DirectX SDK. The required end-user runtimes can be downloaded here.
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.
Download executable, source, and Visual C++ 2010 solution files.
10 July 2010.
Added missing .vcxproj.filters file to the project.
13 June 2010.
Updated solution to Microsoft Visual Studio 2010.
10 April 2008.
blinn_phong.fx: Fixed a bug in the PS_PointLighting() and PS_SpotLighting() functions where the computed light attenuation was not being clamped.
25 March 2008.
Fixed memory leak in CreateNullTexture() function where 'pSurface' was not being released.
2 February 2008.
Updated solution to Microsoft Visual Studio 2008.
26 January 2008.
Added blinn_phong.fx shader.
third_person_camera.h: Made all public member variables private. Added public getter methods for the member variables. Renamed setTargetPosition() to lookAt().
third_person_camera.cpp: Renamed setTargetPosition() to lookAt().
main.cpp: Major rewrite to match the format and structure of the more recent Direct3D demos. Added proper text rendering support. The scene is now rendered using a per-pixel Blinn-Phong shader. Added the ability to toggle textures on and off.