Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Ray casting
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Ray Casting Applications == Three algorithms using ray casting are to make line drawings, to make shaded pictures, and to compute volumes and other physical properties. Each algorithm, given a camera model, casts one ray per pixel in the screen. For computing volume, the resolution of the pixel screen to use depends on the desired accuracy of the solution. For line drawings and picture shading, the resolution determines the quality of the image. === Line Drawings === [[File:Example line drawings.jpg|thumb|Example line drawings made by casting rays. Two are standard plan views. One shows hidden edges as dashed lines.]]To draw the visible edges of a solid, generate one ray per pixel moving top-down, left-right in the screen. Evaluate each ray in order to identify the visible surface S[1], the first surface pointer in the sorted list of ray-surface intersections. If the visible surface at pixel location (X, Y) is different than the visible surface at pixel (X−1, Y), then display a vertical line one pixel long centered at (X−½, Y). Similarly, if the visible surface at (X, Y) is different than the visible surface at pixel (X, Y−1), then display a horizontal line one pixel long centered at (X, Y−½). The resulting drawing will consist of horizontal and vertical edges only, looking jagged in coarse resolutions. Roth’s ray casting system generated the images of solid objects on the right. Box enclosures, dynamic bounding, and coherence were used for optimization. For each picture, the screen was sampled with a density of about 100×100 (e.g., 10,000) rays and new edges were located via binary searches. Then all edges were followed by casting additional rays at one pixel increments on the two sides of the edges. Each picture was drawn on a Tektronix tube at 780×780 resolution. === Shaded Pictures === To make a shaded picture, again cast one ray per pixel in the screen. This time, however, use the visible surface pointer S[1] at each pixel to access the description of the surface. From this, compute the surface normal at the visible point ''t''[1]. The pixel’s value, the displayable light intensity, is proportional to the cosine of the angle formed by the surface normal and the light-source-to-surface vector. Processing all pixels this way produces a raster-type picture of the scene. === Computing Volume and Moments of Inertia === The volume (and similar properties) of a solid bounded by curved surfaces is easily computed by the “approximating sums” integration method, by approximating the solid with a set of rectangular parallelepipeds. This is accomplished by taking an “in-depth” picture of the solid in a parallel view. Casting rays through the screen into the solid partitions the solid into volume elements. Two dimensions of the parallelepipeds are constant, defined by the 2D spacing of rays in the screen. The third dimension is variable, defined by the enter–exit point computed. Specifically, if the horizontal and vertical distances between rays in the screen is S, then the volume “detected” by each ray is: S × S × (''t''[2]-''t''[1] + ''t''[4]-''t''[3] + … + ''t''[n]-''t''[n-1]) / L where L is defined as the length of the direction vector. (If already normalized, this is equal to 1.) L = √(D<sub>x</sub><sup>2</sup> + D<sub>y</sub><sup>2</sup> + D<sub>z</sub><sup>2</sup>) Each (''t''[''i'']-''t''[''i''-1])/L is a length of a ray segment that is inside of the solid. This figure shows the parallelepipeds for a modeled solid using ray casting. This is a use of parallel-projection camera model.[[File:Parallelepipeds.jpg|thumb|center|Solid modeled by parallelepipeds]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)