<s>
Ray	B-Algorithm
casting	I-Algorithm
is	O
the	O
methodological	O
basis	O
for	O
3D	O
CAD/CAM	O
solid	O
modeling	O
and	O
image	O
rendering	O
.	O
</s>
<s>
It	O
is	O
essentially	O
the	O
same	O
as	O
ray	B-Algorithm
tracing	I-Algorithm
for	O
computer	O
graphics	O
where	O
virtual	O
light	B-Device
rays	I-Device
are	O
"	O
cast	O
"	O
or	O
"	O
traced	O
"	O
on	O
their	O
path	O
from	O
the	O
focal	O
point	O
of	O
a	O
camera	O
through	O
each	O
pixel	B-Algorithm
in	O
the	O
camera	O
sensor	O
to	O
determine	O
what	O
is	O
visible	O
along	O
the	O
ray	O
in	O
the	O
3D	O
scene	O
.	O
</s>
<s>
The	O
term	O
"	O
Ray	B-Algorithm
Casting	I-Algorithm
"	O
was	O
introduced	O
by	O
Scott	O
Roth	O
while	O
at	O
the	O
General	O
Motors	O
Research	O
Labs	O
from	O
1978	O
–	O
1980	O
.	O
</s>
<s>
His	O
paper	O
,	O
"	O
Ray	B-Algorithm
Casting	I-Algorithm
for	O
Modeling	O
Solids	O
"	O
,	O
describes	O
modeled	O
solid	O
objects	O
by	O
combining	O
primitive	O
solids	O
,	O
such	O
as	O
blocks	O
and	O
cylinders	O
,	O
using	O
the	O
set	O
operators	O
union	O
( +	O
)	O
,	O
intersection	B-Algorithm
( &	O
)	O
,	O
and	O
difference	O
(	O
-	O
)	O
.	O
</s>
<s>
This	O
figure	O
on	O
the	O
right	O
shows	O
a	O
U-Joint	O
modeled	O
from	O
cylinders	O
and	O
blocks	O
in	O
a	O
binary	O
tree	O
using	O
Roth	O
's	O
ray	B-Algorithm
casting	I-Algorithm
system	O
,	O
circa	O
1979	O
.	O
</s>
<s>
Before	O
ray	B-Algorithm
casting	I-Algorithm
(	O
and	O
ray	B-Algorithm
tracing	I-Algorithm
)	O
,	O
computer	O
graphics	O
algorithms	O
projected	O
surfaces	O
or	O
edges	O
(	O
e.g.	O
,	O
lines	O
)	O
from	O
the	O
3D	O
world	O
to	O
the	O
image	O
plane	O
where	O
visibility	O
logic	O
had	O
to	O
be	O
applied	O
.	O
</s>
<s>
The	O
world-to-image	O
plane	O
projection	O
is	O
a	O
3D	O
homogeneous	O
coordinate	O
system	O
transformation	O
(	O
aka	O
:	O
3D	B-Algorithm
projection	I-Algorithm
,	O
affine	B-Algorithm
transformation	I-Algorithm
,	O
or	O
projective	O
transform	O
(	O
Homography	B-Algorithm
)	O
)	O
.	O
</s>
<s>
Plus	O
,	O
silhouettes	O
of	O
curved	O
surfaces	O
have	O
to	O
be	O
explicitly	O
solved	O
for	O
whereas	O
it	O
is	O
an	O
implicit	O
by-product	O
of	O
ray	B-Algorithm
casting	I-Algorithm
,	O
so	O
there	O
is	O
no	O
need	O
to	O
explicitly	O
solve	O
for	O
it	O
whenever	O
the	O
view	O
changes	O
.	O
</s>
<s>
Ray	B-Algorithm
casting	I-Algorithm
greatly	O
simplified	O
image	O
rendering	O
of	O
3D	O
objects	O
and	O
scenes	O
because	O
a	O
line	O
transforms	O
to	O
a	O
line	O
.	O
</s>
<s>
So	O
,	O
instead	O
of	O
projecting	O
curved	O
edges	O
and	O
surfaces	O
in	O
the	O
3D	O
scene	O
to	O
the	O
2D	O
image	O
plane	O
,	O
transformed	O
lines	O
(	O
rays	B-Device
)	O
are	O
intersected	B-Algorithm
with	O
the	O
objects	O
in	O
the	O
scene	O
.	O
</s>
<s>
Ray	B-Algorithm
casting	I-Algorithm
is	O
the	O
most	O
basic	O
of	O
many	O
computer	O
graphics	O
rendering	O
algorithms	O
that	O
use	O
the	O
geometric	O
algorithm	O
of	O
ray	B-Algorithm
tracing	I-Algorithm
.	O
</s>
<s>
Geometric	O
rays	B-Device
are	O
traced	O
from	O
the	O
eye	O
of	O
the	O
observer	O
to	O
sample	O
the	O
light	O
(	O
radiance	B-Application
)	O
travelling	O
toward	O
the	O
observer	O
from	O
the	O
ray	O
direction	O
.	O
</s>
<s>
The	O
speed	O
and	O
simplicity	O
of	O
ray	B-Algorithm
casting	I-Algorithm
comes	O
from	O
computing	O
the	O
color	O
of	O
the	O
light	O
without	O
recursively	O
tracing	O
additional	O
rays	B-Device
that	O
sample	O
the	O
radiance	B-Application
incident	O
on	O
the	O
point	O
that	O
the	O
ray	O
hit	O
.	O
</s>
<s>
The	O
high	O
speed	O
of	O
calculation	O
made	O
ray	B-Algorithm
casting	I-Algorithm
a	O
handy	O
rendering	O
method	O
in	O
early	O
real-time	O
3D	O
video	O
games	O
.	O
</s>
<s>
The	O
idea	O
behind	O
ray	B-Algorithm
casting	I-Algorithm
is	O
to	O
trace	O
rays	B-Device
from	O
the	O
eye	O
,	O
one	O
per	O
pixel	B-Algorithm
,	O
and	O
find	O
the	O
closest	O
object	O
blocking	O
the	O
path	O
of	O
that	O
ray	O
–	O
think	O
of	O
an	O
image	O
as	O
a	O
screen-door	O
,	O
with	O
each	O
square	O
in	O
the	O
screen	O
being	O
a	O
pixel	B-Algorithm
.	O
</s>
<s>
This	O
is	O
then	O
the	O
object	O
the	O
eye	O
sees	O
through	O
that	O
pixel	B-Algorithm
.	O
</s>
<s>
One	O
important	O
advantage	O
ray	B-Algorithm
casting	I-Algorithm
offered	O
over	O
older	O
scanline	B-Algorithm
algorithms	I-Algorithm
was	O
its	O
ability	O
to	O
easily	O
deal	O
with	O
non-planar	O
surfaces	O
and	O
solids	O
,	O
such	O
as	O
cones	O
and	O
spheres	O
.	O
</s>
<s>
If	O
a	O
mathematical	O
surface	O
can	O
be	O
intersected	B-Algorithm
by	O
a	O
ray	O
,	O
it	O
can	O
be	O
rendered	O
using	O
ray	B-Algorithm
casting	I-Algorithm
.	O
</s>
<s>
From	O
the	O
abstract	O
for	O
the	O
paper	O
"	O
Ray	B-Algorithm
Casting	I-Algorithm
for	O
Modeling	O
Solids	O
"	O
:	O
To	O
visualize	O
and	O
analyze	O
the	O
composite	O
solids	O
modeled	O
,	O
virtual	O
light	B-Device
rays	I-Device
are	O
cast	O
as	O
probes	O
.	O
</s>
<s>
By	O
virtue	O
of	O
its	O
simplicity	O
,	O
ray	B-Algorithm
casting	I-Algorithm
is	O
reliable	O
and	O
extensible	O
.	O
</s>
<s>
The	O
most	O
difficult	O
mathematical	O
problem	O
is	O
finding	O
line-surface	O
intersection	B-Algorithm
points	O
.	O
</s>
<s>
The	O
adequacy	O
and	O
efficiency	O
of	O
ray	B-Algorithm
casting	I-Algorithm
are	O
issues	O
addressed	O
here	O
.	O
</s>
<s>
Light	B-Device
rays	I-Device
and	O
the	O
camera	O
geometry	O
form	O
the	O
basis	O
for	O
all	O
geometric	O
reasoning	O
here	O
.	O
</s>
<s>
The	O
simple	O
pinhole	O
camera	O
model	O
consists	O
of	O
a	O
focal	O
point	O
(	O
or	O
eye	O
point	O
)	O
and	O
a	O
square	O
pixel	B-Algorithm
array	O
(	O
or	O
screen	O
)	O
.	O
</s>
<s>
Straight	O
light	B-Device
rays	I-Device
pass	O
through	O
the	O
pixel	B-Algorithm
array	O
to	O
connect	O
the	O
focal	O
point	O
with	O
the	O
scene	O
,	O
one	O
ray	O
per	O
pixel	B-Algorithm
.	O
</s>
<s>
To	O
shade	O
pictures	O
,	O
the	O
rays’	O
intensities	O
are	O
measured	O
and	O
stored	O
as	O
pixels	B-Algorithm
.	O
</s>
<s>
The	O
reflecting	O
surface	O
responsible	O
for	O
a	O
pixel	B-Algorithm
’s	O
value	O
intersects	O
the	O
pixel	B-Algorithm
’s	O
ray	O
.	O
</s>
<s>
When	O
the	O
focal	O
length	O
,	O
distance	O
between	O
focal	O
point	O
and	O
screen	O
,	O
is	O
infinite	O
,	O
then	O
the	O
view	O
is	O
called	O
“	O
parallel	O
”	O
because	O
all	O
light	B-Device
rays	I-Device
are	O
parallel	O
to	O
each	O
other	O
,	O
perpendicular	O
to	O
the	O
screen	O
.	O
</s>
<s>
Although	O
the	O
perspective	O
view	O
is	O
natural	O
for	O
making	O
pictures	O
,	O
some	O
applications	O
need	O
rays	B-Device
that	O
can	O
be	O
uniformly	O
distributed	O
in	O
space	O
.	O
</s>
<s>
Given	O
geometric	O
definitions	O
of	O
the	O
objects	O
,	O
each	O
bounded	O
by	O
one	O
or	O
more	O
surfaces	O
,	O
the	O
result	O
of	O
computing	O
one	O
ray	O
’s	O
intersection	B-Algorithm
with	O
all	O
bounded	O
surfaces	O
in	O
the	O
screen	O
is	O
defined	O
by	O
two	O
arrays	O
,	O
</s>
<s>
where	O
n	O
is	O
the	O
number	O
of	O
ray-surface	O
intersections	B-Algorithm
.	O
</s>
<s>
In	O
association	O
with	O
the	O
ray	O
parameters	O
,	O
the	O
surface	O
pointers	O
contain	O
a	O
unique	O
address	O
for	O
the	O
intersected	B-Algorithm
surface	O
’s	O
information	O
.	O
</s>
<s>
Three	O
algorithms	O
using	O
ray	B-Algorithm
casting	I-Algorithm
are	O
to	O
make	O
line	O
drawings	O
,	O
to	O
make	O
shaded	O
pictures	O
,	O
and	O
to	O
compute	O
volumes	O
and	O
other	O
physical	O
properties	O
.	O
</s>
<s>
Each	O
algorithm	O
,	O
given	O
a	O
camera	O
model	O
,	O
casts	O
one	O
ray	O
per	O
pixel	B-Algorithm
in	O
the	O
screen	O
.	O
</s>
<s>
For	O
computing	O
volume	O
,	O
the	O
resolution	O
of	O
the	O
pixel	B-Algorithm
screen	O
to	O
use	O
depends	O
on	O
the	O
desired	O
accuracy	O
of	O
the	O
solution	O
.	O
</s>
<s>
To	O
draw	O
the	O
visible	O
edges	O
of	O
a	O
solid	O
,	O
generate	O
one	O
ray	O
per	O
pixel	B-Algorithm
moving	O
top-down	O
,	O
left-right	O
in	O
the	O
screen	O
.	O
</s>
<s>
Evaluate	O
each	O
ray	O
in	O
order	O
to	O
identify	O
the	O
visible	O
surface	O
S[1],	O
the	O
first	O
surface	O
pointer	O
in	O
the	O
sorted	O
list	O
of	O
ray-surface	O
intersections	B-Algorithm
.	O
</s>
<s>
If	O
the	O
visible	O
surface	O
at	O
pixel	B-Algorithm
location	O
(	O
X	O
,	O
Y	O
)	O
is	O
different	O
than	O
the	O
visible	O
surface	O
at	O
pixel	B-Algorithm
(	O
X-1	O
,	O
Y	O
)	O
,	O
then	O
display	O
a	O
vertical	O
line	O
one	O
pixel	B-Algorithm
long	O
centered	O
at	O
(	O
X-½	O
,	O
Y	O
)	O
.	O
</s>
<s>
Similarly	O
,	O
if	O
the	O
visible	O
surface	O
at	O
(	O
X	O
,	O
Y	O
)	O
if	O
different	O
than	O
the	O
visible	O
surface	O
at	O
pixel	B-Algorithm
(	O
X	O
,	O
Y-1	O
)	O
,	O
then	O
display	O
a	O
horizontal	O
line	O
one	O
pixel	B-Algorithm
long	O
centered	O
at	O
(	O
X	O
,	O
Y-½	O
)	O
.	O
</s>
<s>
Roth	O
's	O
ray	B-Algorithm
casting	I-Algorithm
system	O
generated	O
the	O
images	O
of	O
solid	O
objects	O
on	O
the	O
right	O
.	O
</s>
<s>
For	O
each	O
picture	O
,	O
the	O
screen	O
was	O
sampled	O
with	O
a	O
density	O
of	O
about	O
100x100	O
(	O
e.g.	O
,	O
10,000	O
)	O
rays	B-Device
and	O
new	O
edges	O
were	O
located	O
via	O
binary	O
searches	O
.	O
</s>
<s>
Then	O
all	O
edges	O
were	O
followed	O
by	O
casting	O
additional	O
rays	B-Device
at	O
one	O
pixel	B-Algorithm
increments	O
on	O
the	O
two	O
sides	O
of	O
the	O
edges	O
.	O
</s>
<s>
To	O
make	O
a	O
shaded	O
picture	O
,	O
again	O
cast	O
one	O
ray	O
per	O
pixel	B-Algorithm
in	O
the	O
screen	O
.	O
</s>
<s>
This	O
time	O
,	O
however	O
,	O
use	O
the	O
visible	O
surface	O
pointer	O
S[1]	O
at	O
each	O
pixel	B-Algorithm
to	O
access	O
the	O
description	O
of	O
the	O
surface	O
.	O
</s>
<s>
The	O
pixel	B-Algorithm
’s	O
value	O
,	O
the	O
displayable	O
light	O
intensity	O
,	O
is	O
proportional	O
to	O
the	O
cosine	O
of	O
the	O
angle	O
formed	O
by	O
the	O
surface	O
normal	O
and	O
the	O
light-source-to-surface	O
vector	O
.	O
</s>
<s>
Processing	O
all	O
pixels	B-Algorithm
this	O
way	O
produces	O
a	O
raster-type	O
picture	O
of	O
the	O
scene	O
.	O
</s>
<s>
Casting	O
rays	B-Device
through	O
the	O
screen	O
into	O
the	O
solid	O
partitions	O
the	O
solid	O
into	O
volume	O
elements	O
.	O
</s>
<s>
Two	O
dimensions	O
of	O
the	O
parallelepipeds	O
are	O
constant	O
,	O
defined	O
by	O
the	O
2D	O
spacing	O
of	O
rays	B-Device
in	O
the	O
screen	O
.	O
</s>
<s>
This	O
figure	O
shows	O
the	O
parallelepipeds	O
for	O
a	O
modeled	O
solid	O
using	O
ray	B-Algorithm
casting	I-Algorithm
.	O
</s>
<s>
The	O
ray	B-Algorithm
casting	I-Algorithm
procedure	O
starts	O
at	O
the	O
top	O
of	O
the	O
solid	O
composition	O
tree	O
,	O
recursively	O
descends	O
to	O
the	O
bottom	O
,	O
classifies	O
the	O
ray	O
with	O
respect	O
to	O
the	O
primitive	O
solids	O
,	O
and	O
then	O
returns	O
up	O
the	O
tree	O
combining	O
the	O
classifications	O
of	O
the	O
left	O
and	O
right	O
subtrees	O
.	O
</s>
<s>
Ray	B-Algorithm
casting	I-Algorithm
is	O
a	O
natural	O
modeling	O
tool	O
for	O
making	O
shaded	O
pictures	O
.	O
</s>
<s>
The	O
grayscale	O
ray-casting	B-Algorithm
system	O
developed	O
by	O
Scott	O
Roth	O
and	O
Daniel	O
Bass	O
at	O
GM	O
Research	O
Labs	O
produced	O
pictures	O
on	O
a	O
Ramtek	O
color	O
raster	O
display	O
around	O
1979	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
following	O
figure	O
shows	O
the	O
additional	O
rays	B-Device
that	O
could	O
be	O
cast	O
for	O
a	O
single	O
light	O
source	O
.	O
</s>
<s>
For	O
a	O
single	O
pixel	B-Algorithm
in	O
the	O
image	O
to	O
be	O
rendered	O
,	O
the	O
algorithm	O
casts	O
a	O
ray	O
starting	O
at	O
the	O
focal	O
point	O
and	O
determines	O
that	O
it	O
intersects	O
a	O
semi-transparent	O
rectangle	O
and	O
a	O
shiny	O
circle	O
.	O
</s>
<s>
An	O
additional	O
ray	O
must	O
then	O
be	O
cast	O
starting	O
at	O
that	O
point	O
in	O
the	O
direction	O
symmetrically	O
opposite	O
the	O
surface	O
normal	O
at	O
the	O
ray-surface	O
intersection	B-Algorithm
point	O
in	O
order	O
to	O
determine	O
what	O
is	O
visible	O
in	O
the	O
mirrored	O
reflection	O
.	O
</s>
<s>
Finally	O
,	O
each	O
ray-surface	O
intersection	B-Algorithm
point	O
is	O
tested	O
to	O
determine	O
if	O
it	O
is	O
in	O
shadow	O
.	O
</s>
<s>
The	O
“	O
Shadow	O
feeler	O
”	O
ray	O
is	O
cast	O
from	O
the	O
ray-surface	O
intersection	B-Algorithm
point	O
to	O
the	O
light	O
source	O
to	O
determine	O
if	O
any	O
other	O
surface	O
blocks	O
that	O
pathway	O
.	O
</s>
<s>
Turner	O
Whitted	O
calls	O
the	O
secondary	O
and	O
additional	O
rays	B-Device
“	O
Recursive	O
Ray	B-Algorithm
Tracing	I-Algorithm
”	O
.	O
</s>
<s>
Ray	B-Algorithm
casting	I-Algorithm
qualifies	O
as	O
a	O
brute	O
force	O
method	O
for	O
solving	O
problems	O
.	O
</s>
<s>
The	O
minimal	O
algorithm	O
is	O
simple	O
,	O
particularly	O
in	O
consideration	O
of	O
its	O
many	O
applications	O
and	O
ease	O
of	O
use	O
,	O
but	O
applications	O
typically	O
cast	O
many	O
rays	B-Device
.	O
</s>
<s>
Millions	O
of	O
rays	B-Device
may	O
be	O
cast	O
to	O
render	O
a	O
single	O
frame	O
of	O
an	O
animated	O
film	O
.	O
</s>
<s>
By	O
using	O
minimum	O
bounding	O
boxes	O
around	O
the	O
solids	O
in	O
the	O
composition	O
tree	O
,	O
the	O
exhaustive	O
search	O
for	O
a	O
ray-solid	O
intersection	B-Algorithm
resembles	O
an	O
efficient	O
binary	O
search	O
.	O
</s>
<s>
The	O
brute	O
force	O
algorithm	O
does	O
an	O
exhaustive	O
search	O
because	O
it	O
always	O
visits	O
all	O
the	O
nodes	O
in	O
the	O
tree	O
—	O
transforming	O
the	O
ray	O
into	O
primitives’	O
local	O
coordinate	O
systems	O
,	O
testing	O
for	O
ray-surface	O
intersections	B-Algorithm
,	O
and	O
combining	O
the	O
classifications	O
—	O
even	O
when	O
the	O
ray	O
clearly	O
misses	O
the	O
solid	O
.	O
</s>
<s>
The	O
following	O
are	O
miscellaneous	O
performance	O
improvements	O
made	O
in	O
Roth	O
’s	O
paper	O
on	O
ray	B-Algorithm
casting	I-Algorithm
,	O
but	O
there	O
have	O
been	O
considerable	O
improvements	O
subsequently	O
made	O
by	O
others	O
.	O
</s>
<s>
By	O
initially	O
combining	O
the	O
screen-to-scene	O
transform	O
with	O
the	O
primitive	O
’s	O
scene-to-local	O
transform	O
and	O
storing	O
the	O
resulting	O
screen-to-local	O
transforms	O
in	O
the	O
primitive	O
’s	O
data	B-General_Concept
structures	I-General_Concept
,	O
one	O
ray	O
transform	O
per	O
ray-surface	O
intersection	B-Algorithm
is	O
eliminated	O
.	O
</s>
<s>
If	O
only	O
the	O
visible	O
edges	O
of	O
the	O
solid	O
are	O
to	O
be	O
displayed	O
,	O
the	O
ray	B-Algorithm
casting	I-Algorithm
algorithm	O
can	O
dynamically	O
bound	O
the	O
ray	O
to	O
cut	O
off	O
the	O
search	O
.	O
</s>
<s>
That	O
is	O
,	O
after	O
finding	O
that	O
a	O
ray	O
intersects	O
a	O
sub-solid	O
,	O
the	O
algorithm	O
can	O
use	O
the	O
intersection	B-Algorithm
point	O
closest	O
to	O
the	O
screen	O
to	O
tighten	O
the	O
depth	O
bound	O
for	O
the	O
“	O
ray	O
intersections	B-Algorithm
box	O
”	O
test	O
.	O
</s>
<s>
The	O
principle	O
of	O
coherence	O
is	O
that	O
the	O
surfaces	O
visible	O
at	O
two	O
neighboring	O
pixels	B-Algorithm
are	O
more	O
likely	O
to	O
be	O
the	O
same	O
than	O
different	O
.	O
</s>
<s>
For	O
line	O
drawings	O
,	O
the	O
image	O
area	O
containing	O
edges	O
is	O
normally	O
much	O
less	O
than	O
the	O
total	O
image	O
area	O
,	O
so	O
ray	B-Algorithm
casting	I-Algorithm
should	O
be	O
concentrated	O
around	O
the	O
edges	O
and	O
not	O
in	O
the	O
open	O
regions	O
.	O
</s>
<s>
This	O
can	O
be	O
effectively	O
implemented	O
by	O
sparsely	O
sampling	O
the	O
screen	O
with	O
rays	B-Device
and	O
then	O
locating	O
,	O
when	O
neighboring	O
rays	B-Device
identify	O
different	O
visible	O
surfaces	O
,	O
the	O
edges	O
via	O
binary	O
searches	O
.	O
</s>
<s>
Also	O
,	O
details	O
in	O
the	O
scene	O
smaller	O
than	O
the	O
spacing	O
between	O
rays	B-Device
may	O
be	O
lost	O
.	O
</s>
<s>
The	O
purpose	O
of	O
such	O
an	O
algorithm	O
is	O
to	O
minimize	O
the	O
number	O
of	O
lines	O
needed	O
to	O
draw	O
the	O
picture	O
within	O
one	O
pixel	B-Algorithm
accuracy	O
.	O
</s>
<s>
To	O
smooth	O
the	O
jagged	O
edges	O
in	O
a	O
shaded	O
picture	O
with	O
subpixel	O
accuracy	O
,	O
additional	O
rays	B-Device
should	O
be	O
cast	O
for	O
information	O
about	O
the	O
edges	O
.	O
</s>
<s>
(	O
See	O
Supersampling	B-Algorithm
for	O
a	O
general	O
approach	O
.	O
)	O
</s>
<s>
Edges	O
are	O
formed	O
by	O
the	O
intersection	B-Algorithm
of	O
surfaces	O
or	O
by	O
the	O
profile	O
of	O
a	O
curved	O
surface	O
.	O
</s>
<s>
Applying	O
"	O
Coherence	O
"	O
as	O
described	O
above	O
via	O
binary	O
search	O
,	O
if	O
the	O
visible	O
surface	O
at	O
pixel	B-Algorithm
(	O
X	O
,	O
Y	O
)	O
is	O
different	O
than	O
the	O
visible	O
surface	O
at	O
pixel	B-Algorithm
(	O
X+1	O
,	O
Y	O
)	O
,	O
then	O
a	O
ray	O
could	O
be	O
generated	O
midway	O
them	O
at	O
(	O
X+½	O
,	O
Y	O
)	O
and	O
the	O
visible	O
surface	O
there	O
identified	O
.	O
</s>
<s>
Since	O
(	O
1	O
)	O
the	O
area	O
of	O
the	O
image	O
that	O
contains	O
edges	O
is	O
usually	O
a	O
small	O
percentage	O
of	O
the	O
total	O
area	O
and	O
(	O
2	O
)	O
the	O
extra	O
rays	B-Device
cast	O
in	O
binary	O
searches	O
can	O
be	O
bounded	O
in	O
depth	O
—	O
that	O
of	O
the	O
visible	O
primitives	O
forming	O
the	O
edges	O
—	O
the	O
cost	O
for	O
smoothing	O
jagged	O
edges	O
is	O
affordable	O
.	O
</s>
<s>
For	O
the	O
history	O
of	O
ray	B-Algorithm
casting	I-Algorithm
,	O
see	O
ray	B-Algorithm
tracing	I-Algorithm
(	O
graphics	O
)	O
as	O
both	O
are	O
essentially	O
the	O
same	O
technique	O
under	O
different	O
names	O
.	O
</s>
<s>
Scott	O
Roth	O
had	O
invented	O
the	O
term	O
"	O
ray	B-Algorithm
casting	I-Algorithm
"	O
before	O
having	O
heard	O
of	O
"	O
ray	B-Algorithm
tracing	I-Algorithm
"	O
.	O
</s>
<s>
Additionally	O
,	O
Scott	O
Roth	O
's	O
development	O
of	O
ray	B-Algorithm
casting	I-Algorithm
at	O
GM	O
Research	O
Labs	O
occurred	O
concurrently	O
with	O
Turner	O
Whitted	O
's	O
ray	B-Algorithm
tracing	I-Algorithm
work	O
at	O
Bell	O
Labs	O
.	O
</s>
<s>
In	O
early	O
first	O
person	O
games	O
,	O
raycasting	B-Algorithm
was	O
used	O
to	O
efficiently	O
render	O
a	O
3D	O
world	O
from	O
a	O
2D	O
playing	O
field	O
using	O
a	O
simple	O
one-dimensional	O
scan	O
over	O
the	O
horizontal	O
width	O
of	O
the	O
screen	O
.	O
</s>
<s>
Early	O
first-person	O
shooters	O
used	O
2D	O
ray	B-Algorithm
casting	I-Algorithm
as	O
a	O
technique	O
to	O
create	O
a	O
3D	O
effect	O
from	O
a	O
2D	O
world	O
.	O
</s>
<s>
This	O
style	O
of	O
rendering	O
eliminates	O
the	O
need	O
to	O
fire	O
a	O
ray	O
for	O
each	O
pixel	B-Algorithm
in	O
the	O
frame	O
as	O
is	O
the	O
case	O
with	O
modern	O
engines	O
;	O
once	O
the	O
hit	O
point	O
is	O
found	O
the	O
projection	O
distortion	O
is	O
applied	O
to	O
the	O
surface	O
texture	O
and	O
an	O
entire	O
vertical	O
column	O
is	O
copied	O
from	O
the	O
result	O
into	O
the	O
frame	O
.	O
</s>
<s>
The	O
video	O
game	O
Wolfenstein	B-Application
3D	I-Application
was	O
built	O
from	O
a	O
square	O
based	O
grid	O
of	O
uniform	O
height	O
walls	O
meeting	O
solid-colored	O
floors	O
and	O
ceilings	O
.	O
</s>
<s>
In	O
order	O
to	O
draw	O
the	O
world	O
,	O
a	O
single	O
ray	O
was	O
traced	O
for	O
every	O
column	O
of	O
screen	O
pixels	B-Algorithm
and	O
a	O
vertical	O
slice	O
of	O
wall	O
texture	O
was	O
selected	O
and	O
scaled	O
according	O
to	O
where	O
in	O
the	O
world	O
the	O
ray	O
hits	O
a	O
wall	O
and	O
how	O
far	O
it	O
travels	O
before	O
doing	O
so	O
.	O
</s>
<s>
The	O
Raven	O
Software	O
game	O
ShadowCaster	B-Application
uses	O
an	O
improved	O
Wolfenstein-based	O
engine	O
with	O
added	O
floors	O
and	O
ceilings	O
texturing	O
and	O
variable	O
wall	O
heights	O
.	O
</s>
<s>
The	O
Voxel	B-Application
Space	I-Application
engine	O
developed	O
by	O
NovaLogic	O
for	O
the	O
Comanche	B-Application
games	O
traced	O
a	O
ray	O
through	O
each	O
column	O
of	O
screen	O
pixels	B-Algorithm
and	O
tested	O
each	O
ray	O
against	O
points	O
in	O
a	O
heightmap	B-Data_Structure
.	O
</s>
<s>
Then	O
it	O
transformed	O
each	O
element	O
of	O
the	O
heightmap	B-Data_Structure
into	O
a	O
column	O
of	O
pixels	B-Algorithm
,	O
determined	O
which	O
are	O
visible	O
(	O
that	O
is	O
,	O
have	O
not	O
been	O
occluded	O
by	O
pixels	B-Algorithm
that	O
have	O
been	O
drawn	O
in	O
front	O
)	O
,	O
and	O
drew	O
them	O
with	O
the	O
corresponding	O
color	O
from	O
the	O
texture	O
map	O
.	O
</s>
<s>
Later	O
DOS	B-Application
games	O
like	O
id	O
Software	O
's	O
DOOM	O
kept	O
many	O
of	O
the	O
raycasting	B-Algorithm
2.5D	O
restrictions	O
for	O
speed	O
but	O
went	O
on	O
to	O
switch	O
to	O
alternative	O
rendering	O
techniques	O
(	O
like	O
BSP	O
)	O
,	O
making	O
them	O
no	O
longer	O
raycasting	B-Algorithm
engines	O
.	O
</s>
<s>
In	O
computational	O
geometry	O
,	O
the	O
ray	B-Algorithm
casting	I-Algorithm
problem	O
is	O
also	O
known	O
as	O
the	O
ray	B-Algorithm
shooting	I-Algorithm
problem	O
and	O
may	O
be	O
stated	O
as	O
the	O
following	O
query	O
problem	O
:	O
given	O
a	O
set	O
of	O
objects	O
in	O
d-dimensional	O
space	O
,	O
preprocess	O
them	O
into	O
a	O
data	B-General_Concept
structure	I-General_Concept
so	O
that	O
for	O
each	O
query	O
ray	O
,	O
the	O
initial	O
object	O
hit	O
by	O
the	O
ray	O
can	O
be	O
found	O
quickly	O
.	O
</s>
<s>
The	O
problem	O
has	O
been	O
investigated	O
for	O
various	O
settings	O
:	O
space	O
dimension	O
,	O
types	O
of	O
objects	O
,	O
restrictions	O
on	O
query	O
rays	B-Device
,	O
etc	O
.	O
</s>
