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
Rendering (computer graphics)
(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 tracing === {{Main|Ray tracing (graphics)}} [[Image:SpiralSphereAndJuliaDetail1.jpg|thumb|250px|''Spiral Sphere and Julia, Detail'', a computer-generated image created by visual artist Robert W. McGregor using only [[POV-Ray]] 3.6 and its built-in scene description language]] Ray casting can be used to render an image by tracing [[Ray (optics)|light rays]] backwards from a simulated camera. After finding a point on a surface where a ray originated, another ray is traced towards the light source to determine if anything is casting a shadow on that point. If not, a ''[[Bidirectional reflectance distribution function|reflectance model]]'' (such as [[Lambertian reflectance]] for [[Paint sheen|matte]] surfaces, or the [[Phong reflection model]] for glossy surfaces) is used to compute the probability that a [[photon]] arriving from the light would be reflected towards the camera, and this is multiplied by the brightness of the light to determine the pixel brightness. If there are multiple light sources, brightness contributions of the lights are added together. For color images, calculations are repeated for multiple [[Visible spectrum|wavelengths]] of light (e.g. red, green, and blue).{{r|AkenineMöller2018|loc=11.2.2}}{{r|RayTracingGems_1|p=8}} ''Classical ray tracing'' (also called ''Whitted-style'' or ''recursive'' ray tracing) extends this method so it can render mirrors and transparent objects. If a ray traced backwards from the camera originates at a point on a mirror, the [[Specular reflection|reflection formula]] from [[geometric optics]] is used to calculate the direction the reflected ray came from, and another ray is cast backwards in that direction. If a ray originates at a transparent surface, rays are cast backwards for both [[Specular reflection|reflected]] and [[Refraction|refracted]] rays (using [[Snell's law]] to compute the refracted direction), and so ray tracing needs to support a branching "tree" of rays. In simple implementations, a [[Recursion (computer science)|recursive function]] is called to trace each ray.{{r|AkenineMöller2018|loc=11.2.2}}{{r|RayTracingGems_1|p=9}} Ray tracing usually performs [[Spatial anti-aliasing|anti-aliasing]] by taking the average of multiple [[Sampling (statistics)|samples]] for each pixel. It may also use multiple samples for effects like [[depth of field]] and [[motion blur]]. If evenly-spaced ray directions or times are used for each of these features, many rays are required, and some aliasing will remain. ''Cook-style'', ''stochastic'', or ''Monte Carlo ray tracing'' avoids this problem by using [[Monte Carlo method|random sampling]] instead of evenly-spaced samples. This type of ray tracing is commonly called [[distributed ray tracing|''distributed ray tracing'', or ''distribution ray tracing'']] because it samples rays from [[probability distribution]]s. Distribution ray tracing can also render realistic "soft" shadows from large lights by using a random sample of points on the light when testing for shadowing, and it can simulate [[chromatic aberration]] by sampling multiple wavelengths from the [[Visible spectrum|spectrum of light]].{{r|RayTracingGems_1|p=10}}{{r|IntroToRTCh1|p=25}} Real surface materials reflect small amounts of light in almost every direction because they have small (or microscopic) bumps and grooves. A distribution ray tracer can simulate this by sampling possible ray directions, which allows rendering blurry reflections from glossy and metallic surfaces. However, if this procedure is repeated [[Recursion|recursively]] to simulate realistic indirect lighting, and if more than one sample is taken at each surface point, the tree of rays quickly becomes huge. Another kind of ray tracing, called ''path tracing'', handles indirect light more efficiently, avoiding branching, and ensures that the distribution of all possible paths from a light source to the camera is sampled in an [[Unbiased rendering|unbiased]] way.{{r|IntroToRTCh1|pp=25-27}}{{r|Kajiya1986}} Ray tracing was often used for rendering reflections in animated films, until path tracing became standard for film rendering. Films such as [[Shrek 2]] and [[Monsters University]] also used distribution ray tracing or path tracing to precompute indirect illumination for a scene or frame prior to rendering it using rasterization.{{r|Christensen2016|pp=118-121}} Advances in GPU technology have made real-time ray tracing possible in games, although it is currently almost always used in combination with rasterization.{{r|RealTimeRayTracing|page=2}} This enables visual effects that are difficult with only rasterization, including reflection from curved surfaces and interreflective objects,{{r|RayTracingGems_19|page=305}} and shadows that are accurate over a wide range of distances and surface orientations.{{r|n=RayTracingGems_13|p=159-160}} Ray tracing support is included in recent versions of the graphics APIs used by games, such as [[DirectX Raytracing|DirectX]], [[Metal (API)|Metal]], and [[Vulkan]].{{r|KhronosRTInVukan}} Ray tracing has been used to render simulated [[black hole]]s, and the appearance of objects moving at close to the speed of light, by taking [[curved spacetime|spacetime curvature]] and [[Special relativity|relativistic effects]] into account during light ray simulation.{{r|Riazuelo2019}}{{r|Howard1995}}
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)