← All resources

Mouse Raycasting Derivation

Auto-discovered

Blog Intermediate

Kevin Moran

Visit resource ↗

Description

Mouse Raycasting Derivation is Kevin Moran's blog article that builds a compact world-space picking ray from a screen-space mouse position, camera basis vectors, and vertical field of view. The post is a self-contained reference for engine programmers who want the math in one place instead of scattered across forum answers.

Moran walks through constructing the ray origin on the near plane, scaling horizontal and vertical offsets by aspect ratio and tangent of half-FOV, and normalizing the resulting direction in camera space before transforming to world space. Diagrams and pseudocode illustrate mouse picking, object selection, and related gameplay queries.

You should understand basic linear algebra, camera view/projection conventions, and how your engine stores aspect ratio and FOV. The derivation is intermediate level and stays API-agnostic so it ports to DirectX, OpenGL, Vulkan, or custom software rasterizers.

The page lives on Moran's GitHub Pages site as a static HTML article with no login required. It complements longer engine tutorials by isolating the ray construction step that many students re-derive when implementing editors or first-person controllers.

Moran's graphics math posts are commonly bookmarked by indie engine authors; this raycasting note is a practical companion to camera matrix documentation rather than a full rendering course.