Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/docs/ray_intersect.tex
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
\begin{equation*} | \begin{equation*} | ||||
\mathbf{r}(t) = \mathbf{o} + t \mathbf{d} | \mathbf{r}(t) = \mathbf{o} + t \mathbf{d} | ||||
\end{equation*} | \end{equation*} | ||||
where $\mathbf{o}$ denotes the origin of the ray, $\mathbf{d}$ is a unit vector indicating the direction of the ray, and $t$ is an independent scalar parameter that specifies the distance of $\mathbf{r}(t)$ from the origin of the ray. Points that are generated by negative values of $t$ are said to lie behind the ray origin, and are not considered part of the ray. | where $\mathbf{o}$ denotes the origin of the ray, $\mathbf{d}$ is a unit vector indicating the direction of the ray, and $t$ is an independent scalar parameter that specifies the distance of $\mathbf{r}(t)$ from the origin of the ray. Points that are generated by negative values of $t$ are said to lie behind the ray origin, and are not considered part of the ray. | ||||
An OBB, or Oriented Bounding Box, is an arbitarily-rotated three-dimensional rectangular cuboid defined by a center point $\mathbf{a}_c$, a set of mutually orthonormal basis vectors $(\mathbf{a}_u, \mathbf{a}_v, \mathbf{a}_w)$, and the half-distances $(h_u, h_v, h_w)$ of each face from the origin along their respective axes. | An OBB, or Oriented Bounding Box, is an arbitarily-rotated three-dimensional rectangular cuboid defined by a center point $\mathbf{a}_c$, a set of mutually orthonormal basis vectors $(\mathbf{a}_u, \mathbf{a}_v, \mathbf{a}_w)$, and the half-distances $(h_u, h_v, h_w)$ of each face from the origin along their respective axes. | ||||
\section{Method} | \section{Method} | ||||
In 0 A.D., rays are tested for intersection with OBBs using the slab method as outlined in \cite{real_time_rendering_3}. In brief, the goal of the algorithm is to compute the distances from the ray's origin to its intersection points with each of three slabs (one for each dimension). By then performing a clever comparison of these intersection point distances, it is able to determine whether the ray hits or misses the shape. | In 0!A.D., rays are tested for intersection with OBBs using the slab method as outlined in \cite{real_time_rendering_3}. In brief, the goal of the algorithm is to compute the distances from the ray's origin to its intersection points with each of three slabs (one for each dimension). By then performing a clever comparison of these intersection point distances, it is able to determine whether the ray hits or misses the shape. | ||||
This document is concerned with providing some details of how these distances are computed, in order to allow the reader to more thoroughly comprehend the algorithm. Before continuing, the reader should have the algorithm as it appears in \cite{real_time_rendering_3} at hand. For the most part, the same variable names will be used here. | This document is concerned with providing some details of how these distances are computed, in order to allow the reader to more thoroughly comprehend the algorithm. Before continuing, the reader should have the algorithm as it appears in \cite{real_time_rendering_3} at hand. For the most part, the same variable names will be used here. | ||||
Figure \ref{fig:visual_2d} presents a visual illustration of a sample 2D case, for one particular slab. The points $\mathbf{t}_1$ and $\mathbf{t}_2$ are the intersection points of the ray with the slab. The goal is to determine the distances between $\mathbf{o}$ and these points in the general case. Observe that each basis vector $\mathbf{a}_i$ corresponds to a slab of which it is the normal vector. | Figure \ref{fig:visual_2d} presents a visual illustration of a sample 2D case, for one particular slab. The points $\mathbf{t}_1$ and $\mathbf{t}_2$ are the intersection points of the ray with the slab. The goal is to determine the distances between $\mathbf{o}$ and these points in the general case. Observe that each basis vector $\mathbf{a}_i$ corresponds to a slab of which it is the normal vector. | ||||
As in the algorithm, in what follows, let: | As in the algorithm, in what follows, let: | ||||
\begin{eqnarray*} | \begin{eqnarray*} | ||||
f & \mathdef & \mathbf{a}_i \cdot \mathbf{d} = \cos \theta \\ | f & \mathdef & \mathbf{a}_i \cdot \mathbf{d} = \cos \theta \\ | ||||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator