Ray casting

Ray casting

Ray casting is the use of ray-surface intersection tests to solve a variety of problems in computer graphics. The term was first used in computer graphics in a 1982 paper by Scott Roth to describe a method for rendering CSG models. [Citation
last1 = Roth | first1 = Scott D.
title = Ray Casting for Modeling Solids
journal = Computer Graphics and Image Processing
volume = 18
date = February 1982
pages = 109-144
]

Usage

Ray casting can refer to
* the general problem of determining the first object intersected by a ray, [ Citation
last1 = Woop | first1 = Sven
last2 = Schmittler | first2 = Jörg
last3 = Slusallek | first3 = Philipp
title = RPU: A Programmable Ray Processing Unit for Realtime Ray Tracing
journal = SIGGRAPH 2005
doi = 10.1145/1073204.1073211
]
* a technique for hidden surface removal based on finding the first intersection of a ray cast from the eye through each pixel of an image,
* a non-recursive variant of ray tracing that only casts primary rays, or
* a direct volume rendering method, also called volume ray casting.

Although "ray casting" and "ray tracing" were often used interchangeably in early computer graphics literature [Citation
last1 = Foley | first1 = James D.
author1-link = James D. Foley
last2 = van Dam | first2 = Andries
author2-link = Andries van Dam
last3 = Feiner | first3 = Steven K.
last4 = Hughes | first4 = John F.
title = Computer Graphis: Principles and Practice
publisher = Addison-Wesley
year = 1995
pages = 701
isbn = 0-201-84840-6
] , more recent usage tries to distinguish the two. [For example, Citation
last1 = Boulos | first1 = Solomon
title = Notes on efficient ray tracing
journal = SIGGRAPH 2005 Courses
doi = 10.1145/1198555.1198749
]

Concept

Ray casting is not a synonym for ray tracing, but can be thought of as an abridged, and significantly faster, version of the ray tracing algorithm. Both are image order algorithms used in computer graphics to render three dimensional scenes to two dimensional screens by following rays of light from the eye of the observer to a light source. Ray casting does not compute the new tangents a ray of light might take after intersecting a surface on its way from the eye to the source of light. This eliminates the possibility of accurately rendering reflections, refractions, or the natural fall off of shadows -- however all of these elements can be faked to a degree, by creative use of texture maps or other methods. The high speed of calculation made ray casting a handy method for the rendering in early real-time 3D video games.

In nature, a light source emits a ray of light which travels, eventually, to a surface that interrupts its progress. One can think of this "ray" as a stream of photons travelling along the same path. At this point, any combination of three things might happen with this light ray: absorption, reflection, and refraction. The surface may reflect all or part of the light ray, in one or more directions. It might also absorb part of the light ray, resulting in a loss of intensity of the reflected and/or refracted light. If the surface has any transparent or translucent properties, it refracts a portion of the light beam into itself in a different direction while absorbing some (or all) of the spectrum (and possibly altering the color). Between absorption, reflection, and refraction, all of the incoming light must be accounted for, and no more. A surface cannot, for instance, reflect 66% of an incoming light ray, and refract 50%, since the two would add up to be 116%. From here, the reflected and/or refracted rays may strike other surfaces, where their absorptive, refractive, and reflective properties are again calculated based on the incoming rays. Some of these rays travel in such a way that they hit our eye, causing us to see the scene and so contribute to the final rendered image. Attempting to simulate this real-world process of tracing light rays using a computer can be considered extremely wasteful, as only a minuscule fraction of the rays in a scene would actually reach the eye.

The first ray casting (versus ray tracing) algorithm used for rendering was presented by Arthur Appel in 1968. [ [http://nccastaff.bournemouth.ac.uk/jmacey/CGF/slides/RayTracing4up.pdf "Ray-tracing and other Rendering Approaches"] (PDF), lecture notes, MSc Computer Animation and Visual Effects, Jon Macey, University of Bournemouth] The idea behind ray casting is to shoot rays from the eye, one per pixel, and find the closest object blocking the path of that ray - think of an image as a screen-door, with each square in the screen being a pixel. This is then the object the eye normally sees through that pixel. Using the material properties and the effect of the lights in the scene, this algorithm can determine the shading of this object. The simplifying assumption is made that if a surface faces a light, the light will reach that surface and not be blocked or in shadow. The shading of the surface is computed using traditional 3D computer graphics shading models. One important advantage ray casting offered over older scanline algorithms is its ability to easily deal with non-planar surfaces and solids, such as cones and spheres. If a mathematical surface can be intersected by a ray, it can be rendered using ray casting. Elaborate objects can be created by using solid modelling techniques and easily rendered.

Ray casting for producing computer graphics was first used by scientists at Mathematical Applications Group, Inc., (MAGI) of Elmsford, New York, New YorkFact|date=May 2008. In 1966 the company was created to perform radiation exposure calculations for the Department of Defense. MAGI's software calculated not only how the gamma rays bounced off surfaces (ray casting for radiation had been done since the 1940s), but also how they penetrated and refracted within. These studies helped the government to determine certain military applications; constructing military vehicles that would protect troops from radiation, designing re-entry vehicles for space exploration. Under the direction of Dr. Philip Mittelman, the scientists developed a method of generating images using the same basic software. In 1972 MAGI became a commercial animation studio. This studio used ray casting to generate 3-D computer animation for television commercials, educational films, and eventually feature films -- they created much of the animation in the film "Tron" using ray casting exclusively. MAGI went out of business in 1985.

Ray casting in computer games

Wolfenstein 3-D

The world in Wolfenstein 3-D is built from a square based grid of uniform height walls meeting solid coloured floors and ceilings. In order to draw the world, a single ray is traced for every column of screen pixels and a vertical slice of wall texture is selected and scaled according to where in the world the ray hits a wall and how far it travels before doing so. [ [http://www.permadi.com/tutorial/raycast/ Wolfenstein-style ray casting tutorial] by F. Permadi]

The purpose of the grid based levels is twofold - ray to wall collisions can be found more quickly since the potential hits become more predictable and memory overhead is reduced. However, encoding wide-open areas takes extra space.

"Comanche" series

The so-called "Voxel Space" engine developed by NovaLogic for the "Comanche" games traces a ray through each column of screen pixels and tests each ray against points in a heightmap. Then it transforms each element of the heightmap into a column of pixels, determines which are visible (that is, have not been covered up by pixels that have been drawn in front), and draws them with the corresponding color from the texture map. [Andre LaMothe. "Black Art of 3D Game Programming." ISBN and page numbers needed.]

Build engine

The Build engine's raycasting method has been described by its creator, Ken Silverman:

This is how Build works: It starts by looking at the front-facing walls in the current sector. It then renders walls 1 at a time, starting with the first unoccluded wall it finds on the list. (There is always at least 1 unoccluded wall). I do hidden surface removal by remembering the highest and lowest points that have been drawn so far to each column. Ceilings and floors fill the gaps between these old high and low points and the tops and bottoms of the new wall. If a wall is a portal, I add the walls of the sector behind it to the list of walls left to consider. Rendering ends when either the wall list is empty, or all columns are filled. [ [http://www.jonof.id.au/forum/index.php?topic=1184.msg7012#msg7012 Ken Silverman's post on the topic] ]

External links

* [http://pixellove.eu/wega/ Raycasting-Java-Applet by Peter Paulis]
* [http://wiioperasdk.com/wall.html Raycasting demonstration in JavaScript using a canvas]
* [http://leftech.com/raycaster.htm Raycasting demonstration in a web browser]

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Ray casting — Изображение черепа, полученное при помощи объёмного рейкастинга (Volume ray casting) …   Википедия

  • Ray Casting — Raycasting (in englischer Schreibweise meist ray casting) ist ein Begriff aus der Computergrafik. Er bezeichnet Techniken zur schnellen Darstellung (Rendern) einer dreidimensionalen Szene, wird aber inzwischen hauptsächlich im Kontext der… …   Deutsch Wikipedia

  • Ray casting — Raycasting (in englischer Schreibweise meist ray casting) ist ein Begriff aus der Computergrafik. Er bezeichnet Techniken zur schnellen Darstellung (Rendern) einer dreidimensionalen Szene, wird aber inzwischen hauptsächlich im Kontext der… …   Deutsch Wikipedia

  • ray casting — noun The calculation of intersections between a ray and a surface …   Wiktionary

  • Ray Casting — …   Википедия

  • Volume ray casting — Volume ray casting, sometimes called volumetric ray casting, is an image based volume rendering technique. It computes 2D images from 3D volumetric data sets. Volume ray casting, which processes volume data, must not be mistaken with ray casting …   Wikipedia

  • Ray tracing (graphics) — In computer graphics, ray tracing is a technique for generating an image by tracing the path of light through pixels in an image plane. The technique is capable of producing a very high degree of photorealism; usually higher than that of typical… …   Wikipedia

  • Ray Dennis Steckler — (born 1939, Reading, Pennsylvania), widely known by the pseudonym Cash Flagg, is an American film director.He served briefly during the late 1950s in the Army, then began working with cinematography in the Los Angeles area. He directed Wild… …   Wikipedia

  • Ray Park — en 2003 Données clés Naissance 23 août 1974 …   Wikipédia en Français

  • Ray Liotta — Données clés Nom de naissance Raymond Liotta Naissance 18  …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”