Raycasting

Ray casting (in English spelling usually ray casting ) is a term used in computer graphics. He describes techniques for quick display (rendering) of three-dimensional scene, but is now used mainly in the context of volume visualization. The exact definition of the term varies depending on the context.

Ray casting in the volume visualization

Ray casting is a method to visualize scalar functions in a three-dimensional volume that occur in many scientific applications. In the medical field are examples of this: computed tomography ( CT), magnetic resonance imaging ( MRI) or positron emission tomography (PET). In the field of numerical simulation in a finite element method (FEM ) for Computational Fluid Dynamics ( CFD), in which the flow behavior of gases and liquids is calculated. The scalar data obtained here, for example, the density or temperature, can be visualized by several methods, including by ray casting. A distinction is made between direct and indirect methods. Indirect methods visualize the volume with the help of a polygonal intermediate representation. Marching Cubes is one of these indirect methods. Direct methods visualize the volume without the production of such intermediate data. These methods include, ray casting and splatting. Next, a distinction between image, space -oriented method (image -order ) and object- space -based method (Object -Order ).

Ray casting method as in the volume visualization

The basic idea is as volume data using the ray-casting process can be visualized. The theoretical basis is the volume rendering equation, a composition of emission and absorption. Ray casting solves ( approximated ) this problem.

Ray-casting method

Raycasting sent for each pixel of the observer ( the image to be calculated ), a line of sight ( the primary beam ) by the volume. The beam is tracked within the volume, and determines the color and opacity values ​​at regular intervals of the sample points on the beam. It is also the shading at all sampling points calculated for the color values. The vector thus obtained, for the line of sight which contains the parent sample values ​​(color, opacity ), the color values ​​of the source term, and the opacity corresponding to the extinction coefficient. In a last step, the compositing, then the color and opacity values ​​are combined and the resulting pixel is calculated from the line of sight in the image plane.

Ray casting as a simple ray tracing

Raycasting often referred to a simple form of ray tracing, a known Render method. The three-dimensional scene is regularly sampled in accordance with established procedures such as the viewer's position and perspective, so that a two-dimensional image of a section is created. In contrast to advanced raytracing options scanning a beam is terminated by the collision of beam and object, so there is only a masking calculation instead. The determined at this intersection is the color pixel color value. Reflections, refractions and transmissions of the object are ignored. This technique allows for a very quick preview of a scene.

Occasionally ray casting is also used as a synonym for ray tracing.

Ray casting in computer games

In the computer game development, the term refers to the ray casting based on a two-dimensional map calculating a pseudo - 3D view. Based on the distance to an object that a " line of sight " applies, firstly, the object color is represented vertically centered and calculated, on the other, the proportion of the floor or ceiling of the corresponding pixel column. In contrast to the normal ray tracing technique here only a single image line is sampled to calculate the entire image; Thus, the masking calculation takes place in only one plane and not in the room. This type of ray casting is used for example in the computer game Wolfenstein 3D application.

Since this technique does not correspond to real 3D, it is subject to various limitations: it can be shown not three-dimensional objects such as people and objects, floor and ceiling are always the same height and slopes are not possible.

There various workarounds have been found which are intended to create the impression of three-dimensionality. Thus, two-dimensional graphics, so-called sprites used for any objects that are scaled to be inserted in the rendered image. These were in advanced games like Duke Nukem 3D angle-dependent selected so that an object from the front looks different from the back.

Textures for walls, floors and the sky were installed to reflect the three-dimensional structures. Sky or ceiling and floor were made ​​dependent adjustable for sections of a map, so stairs, passageways and the like were possible (as in Doom ). In Duke Nukem 3D finally even slanted shelves or sky or ceiling were made possible and a vertical rotation of the viewpoint, so you could look up or down. However, the representation so strongly distorted and unnatural. Even with the best extensions no overlapping three dimensional objects such as bridges are possible. Representations of the same are always " faked " using sprites or other tricks.

Popular was the ray casting by the early first-person shooter Catacomb, Wolfenstein 3D, Doom and Duke Nukem 3D, as it requires significantly less computation time than real 3D.

Related to the ray casting is introduced with the game Comanche voxelspace algorithm for visualization of height fields. Then based graphics engines will often simply referred to as voxel engines, although no voxels are visualized.

674000
de