150 likes | 282 Vues
This guide explores the crucial role of camera placement in interactive cinematography, focusing on its impact on narrative and gameplay. It covers techniques for first-person shooters (FPS) and flight simulations, detailing camera movement, inertia, and control mechanisms. Learn about advanced concepts such as 6DOF, gimbal lock problems, and the use of quaternions for smoother motion. Additionally, discover third-person camera styles and algorithms for optimal camera placement, ensuring that the player’s perspective enhances the gaming experience.
E N D
(Interactive) Cinematography Ref: Chap. 16 (Core Techniques and Algorithms in Game Programming)
Introduction • Placing the camera is extremely important from a narrative standpoint • Helps to convey the story • [interesting games spoiled by bad camera angles]
FPS • Camera movement: 4 DOF (x,y,z,yaw) • Pitch (sometimes); strafing (moving sideways) • E.g., keyboard (playerpos) + mouse (orientation) • Adding inertia to camera for increased realism • implement control on acceleration (not velocity) • [opengl implementation]
forward back strafe FPS Control Use mouse to change direction
-Z Right: x+=rcosq z-= rsinq Left: x-=rcosq z+= rsinq Up: x -= rsinq z-=rcosq Down:x+= rsinq z+=rcosq q playerpos X Implementing FPS
Keyboard: still position control Mouse drag: Speed proportional to torque Each jerk represent an impulsive torque Need friction to stop Time-based motion by Euler integration Inertia Camera
Mouse Movement • Use glutPassiveMotionFunc • Detect moving direction • Detect moving speed • Related API calls: • glutPassiveMotionFunc, glutSetCursor, glutWarpPointer • Ref: Ref:http://www.gamedev.net/community/forums/topic.asp?topic_id=202516 • Issues: • Hide mouse cursor • Lock mouse focus
Flight Simulation • Placing virtual camera inside a cockpit • Complexity: • 6 DOF • Careful for upside-down motion (flying a loop) • Euler angles: gimbal lock problem • Use quaternion [how? Code]
Not to occlude the enemy Problem: rotating will cause the camera to define large arcs (motion sickness) Solution: inertia camera Interpolate orientation: quaternion Problem: camera colliding with level geometry Solution: transparent wall between Change camera location: move up (lower roof), sideways (corner), in front of the player Third-person Camera
Camera position Camera lookat Fwd distance Player position Third Person Camera
Camera Styles • Fixed camera • Dolly cameras • Crane cameras • Steadycams • Implement a real-time algorithm that selects the best camera according to heuristics (e.g., the one closest to player)
Placement Algorithms • Basic rules: • show everything relevant to the scene • Should be placed so obstruction between relevant information does not occur • Aimed at a point of interest • Main character, other character in the vicinity, pickable items closer than a threshold, objects relevant to game play (e.g., obstacle)
Ex: Camera Placement Dolly Pan Fixed Dolly Pan
Agent-based Approach • AI techniques (rule-based system) to model the decision process used by our virtual cinematographer in order to call the best possible shot