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!
=== Concept Model === For modeling convenience, a typical standard coordinate system for the camera has the screen in the X–Y plane, the scene in the +Z half space, and the focal point on the −Z axis. [[File:Cameras local coordinate system.jpg|thumb|Camera local coordinate system with the "screen" in the Z=0 plane]] A <dfn style="font-style:italic">ray</dfn> is simply a straight line in the 3D space of the camera model. It is best defined in parameterized form as a point vector (X<sub>0</sub>, Y<sub>0</sub>, Z<sub>0</sub>) and a direction vector (D<sub>x</sub>, D<sub>y</sub>, D<sub>z</sub>). In this form, points on the line are ordered and accessed via a single parameter <var>t</var>. For every value of <var>t</var>, a corresponding point (<var>X</var>, <var>Y</var>, <var>Z</var>) on the line is defined: X = X<sub>0</sub> + t · D<sub>x</sub> Y = Y<sub>0</sub> + t · D<sub>y</sub> Z = Z<sub>0</sub> + t · D<sub>z</sub> If the vector is normalized, then the parameter <var>t</var> is distance along the line. The vector can be normalized easily with the following computation: Dist = √(D<sub>x</sub><sup>2</sup> + D<sub>y</sub><sup>2</sup> + D<sub>z</sub><sup>2</sup>) D<sup>'</sup><sub>x</sub> = D<sub>x</sub> / Dist D<sup>'</sup><sub>y</sub> = D<sub>y</sub> / Dist D<sup>'</sup><sub>z</sub> = D<sub>z</sub> / Dist Given geometric definitions of the objects, each bounded by one or more surfaces, the result of computing one ray’s intersection with all bounded surfaces in the screen is defined by two arrays: '''Ray parameters:''' ''t''[1], ''t''[2], …, ''t''[n] '''Surface pointers:''' S[1], S[2], …, S[n] Where <var>n</var> is the number of ray-surface intersections. The ordered list of ray parameters, <var>t[i]</var>, denote the enter–exit points. The ray enters a solid at point <var>t</var>[1], exits at <var>t</var>[2], enters a solid at <var>t</var>[3], etc. Point <var>t</var>[1] is closest to the camera and <var>t[n]</var> is furthest. In association with the ray parameters, the surface pointers contain a unique address for the intersected surface’s information. The surface can have various properties such as color, specularity, transparency with/without refraction, translucency, etc. The solid associated with the surface may have its own physical properties such as density. This could be useful, for instance, when an object consists of an assembly of different materials and the overall center of mass and moments of inertia are of interest.
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)