the camera course information cvg: programming 4 my name: mark walsh website: recommended reading
TRANSCRIPT
![Page 1: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/1.jpg)
The Camera
Course Information
• CVG: Programming 4
• My Name: Mark Walsh
• Website: www.activehelix.co.uk/courses
Recommended Reading
• Introduction to 3D Game Programming with DirectX 9.0 (Frank D. Luna)
![Page 2: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/2.jpg)
Re-Cap
• Local Space
• World Space
• View Space
![Page 3: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/3.jpg)
Local Space
![Page 4: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/4.jpg)
World Space
![Page 5: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/5.jpg)
View Space
![Page 6: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/6.jpg)
• Flexible Camera Class
• Objective is to build a flexible FP based games camera: Flight Simulators and Shooters
• The first stage is camera design
![Page 7: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/7.jpg)
Camera Design
• The camera position is defined relative to the world coordinate system using 4 vectors
• Right, Up, Look, Position
• They define a local coordinate system relative to the world coordinate system
![Page 8: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/8.jpg)
• Camera Picture:
![Page 9: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/9.jpg)
• Vectors: Right, Up and Look define the cameras orientation in the world
• They are therefore the orientation vectors
• The orientation vectors must be orthonormal– Mutually perpendicular to each other
– Of Unit Length
• A row matrix where the rows are made up of orthonormal vectors is orthagonal
![Page 10: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/10.jpg)
Camera Operations
• Using the 4 vectors we wish to be able to:
• Rotate around the right vector or X axis (Pitch)• Rotate around the up vector or Y axis (Yaw)• Rotate around the look vector Z axis (Roll)• Strafe along the right vector• Fly along the up vector• Move along the look vector
![Page 11: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/11.jpg)
Implementation
• We calculate the view matrix using the camera vectors
• Remember that view space transforms the geometry in the world…
• …so that the camera is centred at the origin and the axes are aligned with the major coordinate axes
![Page 12: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/12.jpg)
Rotation About Arbitrary Axis
• Pitch
• Yaw
• Roll
![Page 13: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/13.jpg)
Rotation
• D3DXMatrixRotationAxis
• Angle in Radians to Rotate
• Rotate around arbitrarily defined vector
![Page 14: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/14.jpg)
![Page 15: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/15.jpg)
Walking, Strafing, Flying
• Walking = Moving along the Look vector
• Strafing = Moving along the Right vector
• Flying = Moving along the Up Vector
![Page 16: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/16.jpg)
• To move we add a vector to our position vector
• The should have the same direction
• Need to set restrictions– Walking, flying distinctions
![Page 17: The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: Recommended Reading](https://reader035.vdocument.in/reader035/viewer/2022062803/56649f425503460f94c624e7/html5/thumbnails/17.jpg)
The End