SYSTEMS AND METHODS FOR THE REAL-TIME AND REALISTIC SIMULATION OF NATURAL ATMOSPHERIC LIGHTING PHENOMENON
Systems and methods are provided for visually realistic simulation and real-time rendering of natural atmospheric lighting and related phenomena in an outdoor scene represented by an image provided by a simulation environment. The systems and methods of the present invention provide techniques to approximate the visual effects of natural atmospheric lighting and related phenomena that are visually realistic and that can be computed in real-time to render frames of a scene at real-time frame rates per second. The techniques consider the light scattering effects due to sunlight and ambient light in relation to objects, atmospheric particles and other scene elements represented by the image.
The present application claims the benefit of and priority to U.S. Non-provisional application Ser. No. 11/051,318, filed on Feb. 4, 2005, which is incorporated herein by reference in its entirety.
TECHNICAL FIELDThe present invention generally relates to the real-time graphical processing and realistic simulation of natural atmospheric lighting phenomena.
BACKGROUND INFORMATIONSimulated images are used in various applications, such as training simulators, electronic games, and visual planning and modeling tools. Using realistic simulated images in such applications is desirable to visually present and represent real world scenarios as it may be seen by the human eye outside of the application. In particular, it would be desirable to realistically simulate an outside scene including terrain and sky and the naturally occurring effects of atmospheric light on the scene. Although some simulation applications, such as games, provide a believable representation of outside scenes, these applications do not represent natural atmospheric lighting phenomena in a visual or photo realistic manner. For example, it would be desirable in a military training simulator to present training scenarios that realistically simulate an outside natural scene, including terrain, sky and lighting effects. Simulations using realistic outside scenes will make the image synthesis process more intuitive and have a broader scope of applications.
However, the realistic simulation of outdoor scenes presents significant challenges because of the geometry and lighting effects naturally occurring in such environments. The shapes of natural objects found in outdoor scenes and the effect of light and illumination on these natural objects make it particularly challenging to realistically simulate. Outdoor scenes exhibit great geometric complexity, and the sheer scale of outdoor scenes is typically significantly larger than that of indoor scenes. Furthermore, outdoor scenes often contain natural objects that have complex shapes. The geometric representation of the physical features of varying land mass, sky line and other terrain and atmospheric objects can be quite complex. Another challenge with outdoor scenes is the complexity of the illumination itself. The sky essentially surrounds all objects in the outside scene. Natural illumination from the sun and the sky has special and naturally occurring reflective and optical properties. As such, the lighting effects from the natural illumination affect the color and brightness of objects, terrain and atmosphere in the outside scene.
The realistic and efficient simulation of outdoor scenes is even further challenging. In order to create realistic simulations of outdoor scenes, such as a photo realistic simulation of a terrain and sky, simulating and rendering the visual effects from natural atmospheric lighting phenomena is required. The simulation needs to take into account the interaction of atmospheric light with the natural and man-made objects in the outside scene and the dynamics of natural systems. However, the modeling of such natural atmospheric lighting phenomena is difficult. Although accurate mathematical models of atmospheric lighting phenomena exist, the execution of such models in a simulation environment is very time consuming with a heaving computational burden. Moreover, because outdoor scenes are geometrically complex, the execution of accurate models for atmospheric lighting phenomena integrated with the geometric complexity of the scene is even more time consuming. As such, these models are not executed in real-time.
Thus it is desired to realistically simulate and render in real-time natural atmospheric lighting phenomena in outdoor scenes. Systems and methods are needed to realistically simulate and render in real-time the complexity of natural objects in outdoor scenes integrated with the visual effects from atmospheric lighting phenomena.
SUMMARY OF THE INVENTIONThe present invention provides systems and methods for providing visually realistic simulation and real-time rendering of natural atmospheric lighting and related phenomena in an outdoor scene represented by an image provided by a simulation environment. The systems and methods of the present invention provide techniques to approximate the visual effects of natural atmospheric lighting and related phenomena that are visually realistic and that can be computed in real-time to render frames of a scene at high frame rates per second. The techniques consider the light scattering effects due to sunlight and ambient light in relation to objects, atmospheric particles and other scene elements represented by the image.
Using the techniques, the present invention can provide images and simulations having visually realistic representations of sunlight at any time of day, including from dawn to twilight, along with accurate shadows. Additionally, the present invention can simulate a visually realistic representation of a wide range of cloud formations, resulting cloud cover over the landscape of a scene, and shadows cast by clouds on elements of the scene. Furthermore, the present invention provides a realistic simulation of the visual effects from light scattering by the cloud cover, and also provides visually realistic simulation of water including accurate reflections, refractions, and turbulence.
In one aspect, the present invention relates to a method for providing a realistic simulation of natural atmospheric lighting phenomenon. The method includes the step of providing in a simulation environment an image realistically representing a scene of natural atmospheric lighting phenomena having an atmosphere, atmospheric particles, and light. The image may provide a visual or photo realistic representation of an outdoor scene. The method further provides a viewing position and one or more viewing objects associated with a view of the scene. A viewing object may be any element of the image. The method of the present invention determines, in real-time, a color of one or more portions of the image to realistically represent one or more visual effects from the natural atmospheric lighting phenomena of the scene from a change in one or more of the following: the view, the viewing position, one or more viewing objects, atmosphere, atmospheric particles and light. The method renders, in real-time, images of the scene comprising the color of one or more portions of the image to realistically simulate the one or more visual effects.
In one embodiment, the method includes rendering at a frame per second rate of at least 10 frames per second. The method also determines the colors in real-time by performing processing at a rate to provide for realistically rendering at a frame per second rate of at least 10 frames per second. In one embodiment, the color comprises a Red-Green-Blue (RGB) color code, and the one or more portions of the image comprises a vector.
In other embodiments, the atmospheric particles represent a portion of one or more of the following: a cloud, rain, ice, dust, fog, haze, smoke, pollutants, and air. In a further embodiment, at least one of the one or more viewing objects represents one or more of the following: a sky, a cloud, a land mass, a celestial body, a body of water, and a man-made item. In the methods of the present invention, the light represents a portion of illumination from one of sunlight and scattering of light by atmospheric particles. In one embodiment, the step of rendering in the method of the present invention includes depicting a movement of at least one of the viewing objects in the scene.
In another embodiment, the method of the present invention determines the color by calculating a realistic approximation of a visible effect on the natural atmospheric lighting phenomenon from one or more of the following: in scattering light from atmospheric particles, out scattering light from atmospheric particles, sunlight illumination, ambient illumination, cloud appearance, cloud density, cloud lighting, and cloud shadowing.
In a further embodiment, the method determines the color from an effect of the atmospheric particles scattering out light between the viewing position and at least one of the one or more viewing objects by calculating an attenuation factor that realistically approximates a proportion of light reduced from the light reaching the viewing position from the viewing object. The attenuation factor may be wavelength dependent and derived from a calculation of a cumulative density of atmospheric particles along a path of the line of sight between the viewing position and at least one viewing object. In some embodiments, the cumulative density is proportional to the length of the intersection of a path of the line of sight with the atmosphere.
In one embodiment of the present invention, the method determines the color from an effect of the atmospheric particles scattering light into the line of sight between the viewing position and at least one of the one or more viewings object by calculating an additive factor that realistically approximates an increase to the light reaching the viewing position from the viewing object. The additive factor may be dependent on a selected horizon color and derived from a calculation of a cumulative density of atmospheric particles along a path of the line of sight between the viewing position and at least one viewing object. The cumulative density may be proportional to the length of the intersection of a path of the line of sight with the atmosphere.
In an additional embodiment, the method of the present invention determines the color from an effect of sunlight illuminating at a point in the atmosphere as viewed from the viewing point by calculating a sunlight attenuation factor that realistically approximates a proportion of sunlight reaching the point in the atmosphere. The sunlight attenuation factor may be derived from a calculation of a cumulative optical density for a dominant point along a path from the viewer towards the viewing object. The dominant point may include a point along the path having a dominant color and intensity of the sunlight.
In another aspect, the present invention relates to a system for providing a realistic simulation of natural atmospheric lighting phenomenon. The system includes a simulation environment, a simulation engine, and a rendering mechanism. The simulation environment provides an image realistically representing a scene of a natural atmospheric lighting phenomenon comprising an atmosphere, atmospheric particles, and light, and provides a viewing position and one or more viewing objects associated with a view of the image. The scene may be any outdoor scene. The one or more viewing objects can includes any element of the image.
The simulation engine of the present invention determines, in real-time, a color of one or more portions of the image to realistically represent one or more visual effects from the natural atmospheric lighting phenomenon of the scene from a change in one or more of the following: the view, the viewing position, one or more viewing objects, atmosphere, atmospheric particles and light. The rendering mechanism of the present invention renders, in real-time, images of the scene comprising the color of one or more portions of the image to realistically simulate the one or more visible effects.
In one embodiment, the rendering mechanism renders images at a frame per second rate of at least 10 frames per second. The simulation engine determines the color at a processing rate to provide an image for the rendering mechanism to render at a frame per second rate of at least 10 frames per second.
In another embodiment, the atmospheric particles represent a portion of one or more of the following: a cloud, rain, ice, dust, fog, haze, smoke, pollutants, and air. Additionally, at least one of the one or more viewing objects represents one or more of the following: a sky, a cloud, a land mass, a celestial body, a body of water, and a man-made physical item. The light represents a portion of illumination from one of sunlight and scattering of light by atmospheric particles. In a further embodiment, the simulation provided by the simulation environment depicts a movement of at least one of the viewing objects in the scene.
In one embodiment, the simulation engine of the present invention determines the color by calculating a realistic approximation of a visible effect on the natural atmospheric lighting phenomenon from one or more of the following: in scattering light from atmospheric particles, out scattering light from atmospheric particles, sunlight illumination, ambient illumination, cloud appearance, cloud density, cloud lighting, and cloud shadowing. In one embodiment, the color comprises a Red-Green-Blue (RGB) color code, and the one or more portions of the image comprises a vector.
In another embodiment, the simulation engine of the present invention determines the color from an effect of the atmospheric particles scattering out light between the viewing position and at least one of the one or more viewing objects by calculating an attenuation factor that realistically approximates a proportion of light reduced from the light reaching the viewing position from the viewing object. The attenuation factor may be wavelength dependent and derived from a calculation of a cumulative density of atmospheric particles along a path of the line of sight between the viewing position and at least one viewing object. Additionally, the cumulative density may be proportional to the length of the intersection of a path of the line of sight with the atmosphere.
In another embodiment of the present invention, the simulation engine determines the color from an effect of the atmospheric particles scattering light into the line of sight between the viewing position and at least one of the one or more viewings object by calculating an additive factor that realistically approximates an increase to the light reaching the viewing position from the viewing object. The additive factor may be dependent on a selected horizon color and derived from a calculation of a cumulative density of atmospheric particles along a path of the line of sight between the viewing position and at least one viewing object. The cumulative density may be proportional to the length of the intersection of a path of the line of sight with the atmosphere.
In other embodiments, the simulation engine of the present invention determines the color from an effect of sunlight illuminating at a point in the atmosphere as viewed from the viewing point by calculating a sunlight attenuation factor that realistically approximates a proportion of sunlight reaching the point in the atmosphere. Additionally, the sunlight attenuation factor may be derived from a calculation of a cumulative optical density for a dominant point along a path from the viewer towards the viewing object. The dominant point can include a point along the path having a dominant color and intensity of the sunlight.
The details of various embodiments of the invention are set forth in the accompanying drawings and the description below.
The foregoing and other objects, aspects, features, and advantages of the invention will become more apparent and may be better understood by referring to the following description taken in conjunction with the accompanying drawings, in which:
Certain embodiments of the present invention are described below. It is, however, expressly noted that the present invention is not limited to these embodiments, but rather the intention is that additions and modifications to what is expressly described herein also are included within the scope of the invention. Moreover, it is to be understood that the features of the various embodiments described herein are not mutually exclusive and can exist in various combinations and permutations, even if such combinations or permutations are not expressly made herein, without departing from the spirit and scope of the invention.
The illustrative embodiment of the present invention provides systems and methods for visually realistic simulation and real-time rendering of natural atmospheric lighting phenomena in a simulation environment. The simulation environment provides an image of an outdoor scene including naturally occurring elements of an atmosphere such as the sky, sun light, clouds and other atmospheric particles and celestial objects. The outdoor scene may also include terrain with any naturally occurring land mass, body of water and/or man-made objects and structures. The simulation environment may provide a photo realistic, near photo realistic or otherwise substantially realistic representation of the outdoor scene.
The present invention provides approximations for determining the realistic visual effects of natural atmospheric lighting phenomena upon a scene provided by the image, such as the effects of light and illumination upon an object in the image. Natural atmospheric lighting phenomena include the out scattering and in scattering of light upon a view of one or more objects from the effects of Rayleigh and Mie scattering. Natural atmospheric lighting phenomena also include attenuation by the atmosphere upon light from the sun, e.g., the color of the atmosphere from the effects of a sunrise or sunset. The natural atmospheric lighting phenomena causes visual effects to the color, shading and brightness of objects in the scene of the image. Additionally, the present invention approximates the realistic appearance of clouds, the effect of sky illumination and light from the sun upon clouds, self shadowing effects of clouds, and shadows cast by clouds onto other objects in the scene.
The approximations are computationally efficient and provide for the real-time simulation and rendering of the image upon any type of changes in the scene or for executing a series of changes to the scene over time. The approximations can be executed to take into account the visual effects from natural atmospheric lighting phenomena upon all of the desired objects in the scene. Furthermore, the approximations can be executed at a speed to provide a real-time simulation frame rate of ten frames per second or greater, and in the exemplary embodiment to be discussed herein, at frame rates of 120 frames per second or more.
Moreover, the approximations provide for the realistic rendering of the natural atmospheric lighting phenomena upon the scene. The approximations provide for the color values of pixels of the image to be rendered on the screen. Although the approximations are more computationally efficient in comparison to more accurate modeling approaches of natural atmospheric lighting phenomenon, the approximations produce color values for the natural atmospheric lighting that are visually similar to the more accurate and computationally expensive modeling approaches. As such, the present invention also provides for the photo realistic, near photo realistic or otherwise substantially realistic representation of natural atmospheric lighting phenomena.
In brief introduction, the illustrative embodiment of the present invention provides approximations for natural atmospheric lighting phenomena that are both visually realistic and can be executed in real-time. This provides for the simulation of realistic outdoor scenes that can be rendered at a real-time frame rate. As such, the simulation environment of the present invention can provide for a wide range of graphics and simulation applications where the substantial realistic representation of outdoor scenes is desired. For example, the simulation environment of the present invention can be used for driving and flight simulators as well as military and other training environments. Additionally, the methods and systems of the present invention may be applied in gaming and entertainment type applications.
The illustrative embodiment will be described solely for illustrative purposes relative to a simulation environment using a shader type program in a programmable graphics processor, such as in a graphics card. Although the illustrative embodiment will be described relative to such an environment, one of ordinary skill in the art will appreciate that the present invention may be applied to other graphics and simulation environments capable of the operations described herein.
The computing device 102 may include other I/O devices such a keyboard 110 and a pointing device 112, for example a mouse, for receiving input from a user. Optionally, the keyboard 110 and the pointing device 112 may be connected to the visual display device 114. Additionally, the computing device 102 may include any type of input device for receiving user input, such as a joystick. In other embodiments, the computing device 102 may include any type of haptic device, such as a vibration generating mouse or force feedback joystick. In some embodiments, the computing device 102 may include any form of input device used for training and simulation, such a flight or tank simulation input device of a military training simulator.
The computing device 102 may include other suitable conventional I/O peripherals. The computing device 102 may support any suitable installation medium 116, a CD-ROM, floppy disks, tape device, USB device, hard-drive or any other device suitable for installing software programs such as the simulation environment 120 of the present invention. The computing device 102 may further comprise a storage device 108, such as a hard-drive or CD-ROM, for storing an operating system and other related software, and for storing application software programs such as the simulation environment 120 of the present invention. Additionally, the operating system and the simulation environment 120 can be run from a bootable CD, such as, for example, KNOPPIX®, a bootable CD for GNU/Linux.
The computing device 102 may include a network interface 118 to interface to a Local Area Network (LAN), Wide Area Network (WAN) or the Internet through a variety of connections including, but not limited to, standard telephone lines, LAN or WAN links (e.g., 802.11, T1, T3, 56 kb, X.25), broadband connections (e.g., ISDN, Frame Relay, ATM), wireless connections, or some combination of any or all of the above. The network interface 118 may comprise a built-in network adapter, network interface card, PCMCIA network card, card bus network adapter, wireless network adapter, USB network adapter, modem or any other device suitable for interfacing the computing device 118 to any type of network capable of communication and performing the operations described herein. Moreover, the computing device 102 may be any type of computer system such as a workstation, desktop computer, server, laptop, handheld computer, or other form of computing or telecommunications device that has sufficient processor power and memory capacity to perform the operations described herein.
Additionally, the computing device 102 may include a graphics card/processor 105 for handling one or more graphics processing functions of the computing device for displaying graphics, images, user interfaces, or any other type of visual element to the display device 114. In one embodiment, the computing device 102 includes an expansion card 105 that interprets drawing instructions sent by the central processor (CPU) 104, processes them via a dedicated graphics processor 105, and writes the resulting frame data to the frame buffer, also called or otherwise is part of the video adapter 107. The graphics processor 105 may perform one or more graphics processing functions such as bitmap transfers and painting, window resizing and repositioning, line drawing, font scaling and polygon drawing. The graphics processor 105 may be designed to handle these tasks in hardware at far greater speeds than the software running on the system's central processor 104. The graphics processor 105 may be any type of graphics processor, such as any graphic processing chip provided or manufactured by Nvidia Corporation of Santa Clara, Calif., or ATI Technologies, Inc. of Markham, Ontario. The graphics processor 105 may be part of any type of graphics card, such as any of the graphics cards incorporating the Nvidia graphics processor, such as Nvidia's series of nForce® and GeForce® graphics chip, or the Radeon® series of graphics cards from ATI Technologies. One ordinarily skilled in the art will recognize and appreciate the various types and wide range of graphics card/processors 105 that may be used in the computing device 102.
Although generally described as a graphics processor 105, or a processor dedicated to graphics processing functions, the processor 105 can be any type of general purpose processor (GPP), or any other type of integrated circuit, such as a Field Programmable Gate Array (FPGA), Programmable Logic Device (PLD), or Application Specific Integrated Circuit (ASIC). Furthermore, although the illustrative embodiment of the computing device 102 is described with a separate processor 105 for graphics related processing, the central processor 104 may provide for such graphics related processing. Alternatively, the computing device 102 may have multiple processors to distribute processing of computing tasks, along with any graphics processing functions. In one embodiment, the graphics card/processor 105 of the computing device 102 has multiple graphics processors, such as for example the dual GPU graphics card provided or manufactured by Giga-Byte Technology, Co. LTD of Taipei Hsien, Taiwan. In another embodiment, the graphics processor 105 performs graphics-oriented operations but also other computations, such as any operation of the processor 104, such as a CPU. One ordinarily skilled in the art will recognize and appreciate that any type of computing device with any type of processor may be used to perform the operations of the present invention as described herein.
The present invention provides a simulation environment 120 for generating, modeling, creating, editing or otherwise handling, manipulating and processing images. In brief overview, the simulation environment 120 provides a platform for image based design, processing, and simulation of outdoor and/or indoor scenes including naturally occurring atmospheres and terrains, naturally occurring dynamic systems, along with any man-made objects, structures and/or system. The simulation environment 120 may include one or more images 215 representing visually, graphically, or otherwise, a scene, such as an outside scene. For example, the image 215 may comprise a photo realistic, near photo realistic or otherwise substantially realistic representation of an outside scene including an atmosphere, such as a sky, sun, and clouds, and optionally, any type of terrain, such as a landscape, mountain range, and a body of water.
The simulation environment 120 includes a graphical user interface for interactively creating and working with images 215 and may also provide for simulating, editing, configuring, and processing the images 215. The simulation environment 120 may read, save, interpret, or otherwise process image files in any format known to one ordinarily skilled in the art. For example, the simulation environment 120 may process images 215 comprising data in any terrain data sources known by those skilled in the art. For example, the terrain data may be in the form of a digital elevation map (DEM) and/or digital lines graphics (DLG) of any available granularity and may come from any source, such as the Unites States Geographical Survey (USGS) at www.usgs.gov. In other embodiments, the simulation environment 120 may use any available satellite data. As such, the images 215 processed by the simulation environment 120 may comprise real world terrain data from actual geographic locations. Additionally, any terrain data may be generated, created/edited, or provided to represent a desired terrain. Furthermore, the terrain data may be processed from one format to another format as suitable or desired for processing by the simulation environment 120.
The simulation environment 120 may comprise any suitable configuration mechanism 250 for configuring any elements and properties of the image 215, the simulation and rendering of one or more images 215, and/or the simulation environment 120. The configuration mechanism 250 may comprise any type of user interface, such as a graphical user interface or command line interface. As such, it may comprise any user interface mechanisms such as menu items, forms, toolbars, etc. as known by ordinarily skilled in the art to provide a user interface to receive user input with regards to configuration.
The simulation environment 120 also comprises one or more libraries 240 to provide for the processing of images and at least a portion of the operations of the present invention described herein. Although described as libraries 240, the libraries 240 may take the form of any type of executable instructions capable of performing the operations described herein. In one embodiment, the simulation environment 120 uses a terrain implementation library 240 for providing a terrain processing engine, or terrain engine, for loading and processing geometric data representing various terrains and atmospheres, such as outside scenes. The terrain engine may receive the geometric data for a terrain in the form of an array of heights. In an exemplary embodiment, the terrain engine comprises a geo-mipmapping system, and includes trilinear mipmapping extensions as known by those ordinarily skilled in the art. In one embodiment, the terrain implementation library 240 is capable of loading and processing terrain data files (.ter) provided with the Terragen™ software manufactured by Planetside Software of Cheshire, United Kingdom.
In an exemplary embodiment, the libraries 240 include a portion of executable instructions from the Object Oriented Graphics Rendering Engine (OGRE) manufactured by The OGRE Project. OGRE is a scene-oriented, flexible 3D engine that uses underlying system libraries like Direct3D, DirectX, and OpenGL®. As such, the libraries 240 may include the Direct3D or DirectX SDK manufactured by Microsoft Corporation of Redmond, Wash., to provide an application programming interface (API) in the operating system to graphics and sounds functionality provided by the hardware of the computing device 102. In some embodiments, the libraries 240 include any application programming interfaces, APIs, supporting the OpenGL standards and specifications as known by those ordinarily skilled in the art.
Additionally, the libraries 240 may include any portion of the CG Toolkit manufactured by Nvidia, Inc. of Santa Clara, Calif., wherein Cg is a high level language for graphics programming. The libraries 240 may also include any portion of executable instructions manufactured by The Freetype Project, located at www.freetype.org, which is a high quality, portable font engine, and in other embodiments, may include any suitable font engine. Additionally, the libraries 240 may include any executable instructions of the Developer's Image Library (DevIL) manufactured by Denton Woods, located at http://openil.sourceforge.net. DevIL provides a programmer's library to develop applications with image loading capabilities. DevIL utilizes a simple and powerful, syntax to load, save, convert, manipulate, filter and display a wide variety of image formats.
The libraries 240 of the simulation environment 120 may include any programming related APIs and libraries, such as STLport manufactured by STLport Consulting of San Francisco, Calif., Xerces of the Apache XML Project provided by the Apache Software Foundation, Inc. of Forest Hill, Md., and any publicly available libraries authored by Beman Dawes and David Abrahams, located at www.boost.org. Additionally, to support file and data compression related functionality in the simulation environment 120, the libraries 240 may include any type of compression libraries such as the Zlib library provided by The GNU Project of the Free Software Foundation of Boston, Mass. Furthermore, the libraries 240 may include windowing and graphical widgets for graphics APIs and engines such as Crazy Eddie's GUI System, located at http://www.cegui.org.uk, which is a publicly available object orientated tool for building graphical user interface systems.
The simulation environment 120 comprises a simulation engine 220 and rendering mechanism 210. The simulation engine 220 provides the graphics processing 225 functionality and instructions of the present invention for image simulation and the rendering of the image 215 via the rendering mechanism 210. The rendering mechanism 210 includes means and mechanisms as known by those ordinarily skilled in the art to cause the rendering of the image 215 to the visual display device 114 of the computing device 102. In the rendering stage of graphics/image processing, typically performed by the graphics card/processor 105 in conjunction with the video adapter 107, the pixels are drawn to the video display device 114.
The graphics processing 225 portion of the simulation engine 220 may comprise one or more shader programs, such as a pixel shader program 230 and/or a vertex shader program 235. The terms “shaders” may be used instead of program or shader program to refer to the portions of executable instructions that program certain parts of the graphics processing pipeline. The computational frequency that may be supported in graphics related hardware, such as a graphics card/processor 105, is per vertex and per pixel/fragment. As such, there are two different kinds of shaders: vertex shaders 235 and pixel shaders 230. A pixel shader 230 provides graphics processing on a pixel basis, and a vertex shader 235 provides graphics processing on a vertex basis.
Pixel shaders 230 may also include or be referred to as fragment shaders. As known by those ordinarily skilled in the art, fragments are all the points of three-dimensional scene that are projected onto a two-dimensional xy-plane, such as in an OpenGL® based implementation. A fragment contains information such as position and texture coordinates, and several fragments can be added together when displayed to a pixel on the screen.
As known by those ordinarily skilled in the art, a vertex shader 235 is a set of graphics processing instructions used to add special effects to objects in a three-dimensional (3D) environment by performing mathematical operations on an object's vertex data. Objects in a 3D scene, such as those provided by the image 215 of the simulation environment 210, may be described using polygons such as triangles, which in turn are defined by their vertices. Vertex data refers to the data set identifying and/or describing the vertices of the triangles representing the 3D scene. A vertex shader 235 can change the position or any other attributes of a vertex. Vertex shaders 235 may get executed for each vertex that passes through the graphics processing pipeline.
Pixel shaders 230 as known by those ordinarily skilled in the art are graphics processing instructions that calculate effects on a per-pixel basis. In some embodiments, the pixel shader 230 receives as input computational results from a vertex shader 235, such as the vertex position. The pixel shader 230 uses input provided by the vertex shader 235 and any other attributes, such as user-defined attributes, generated or modified colors and texture coordinates, and combines the information to form a final color value that gets passed to the final stages of rendering. As such, per-pixel shading provides the lighting, color, and shading of each pixel. Pixel/fragment shaders 230 get executed for each pixel/fragment passing through the graphics processing pipeline for rendering.
With the graphics cards/processor 105 of the computing device 102 being programmable, the pixel shader 230 and vertex shader 235 can comprise customized executable instructions to provide desired graphics processing of vertex and pixel/fragment data associated with the image 215. In an exemplary embodiment, the simulation environment 210 provides at least a portion of the real-time execution of the realistic approximation of natural atmospheric lighting phenomena of the present invention via one or more vertex shaders 235 and/or pixel shaders 230.
The simulation environment 120, and any portion thereof, can be an application, module, library, software component, or any other type of computer program or executable instruction which is designed to and capable of executing the functionality of the simulation environment 120 as described herein. Additionally, the simulation environment 120, and any portion thereof, may be executed as an application, program, service, process, task, or any other form of execution unit known by those skilled in the art. Furthermore, the simulation environment 120, and any portion thereof, may be designed to run on any type of processor 104, 105 microprocessor, operating system, or computing device 102.
The simulation environment 120 can be capable of and configured to operate on and take advantage of different processors of the computing device 102. For example, the simulation environment 120 can run on a 32 bit processor of one computing device 102 and a 64 bit processor of another computing device 102′. Additionally, the simulation environment 120 can be capable of and configured to operate with and take advantage of different graphical cards/processors 105 of the computing device 102. For example, any shader program 230, 235 of the simulation engine 220 may be designed to operate on and take advantage of any type of graphical processor 105. Furthermore, the simulation environment 120 can operate on computing devices 102 that can be running on different processor architectures with different graphical processing cards and processors in addition to different operating systems. One ordinarily skilled in the art will recognize the various combinations of operating systems, processors, or graphical cards that can be running on the computing device 102. In summary, the simulation environment 120 may be deployed across a wide range of different computing devices, different operating systems, and different processors in various configurations. One ordinarily skilled in the art will appreciate the various ways the present invention may be practiced in a computing device.
In one aspect of the present invention, the image 215 provided by the simulation environment 120 comprises a realistic graphical and/or visual representation of an outdoor scene including a natural atmospheric environment.
The atmosphere 310 represented by the scene 300 of the image 215 may include the sky 315, a sun 320, one or more clouds 325, one or more celestial objects 340, and one or more types of atmospheric particles 330. The clouds 325 may be any type and/or any portion of a formation of a cloud. The atmosphere 310 may represent any portion of the atmosphere of the earth, or any other planet or orbiting celestial land mass. The celestial objects 340 may be any naturally occurring objects in the atmosphere, sky, or space, such as the sun, moon, a planet and a star. The atmosphere 310 generally represents air molecules, such as clean air molecules, that may be available in any portion of the sky 315 or atmosphere 310 of the scene 300. The atmosphere 310 may include any man-made objects such as aircraft or satellites. Additionally, the atmosphere 310 may include any flora, or any other type of animal or creature, either living or fictional. The atmospheric particles 330 represent portions of the atmosphere 310 other than air molecules, such as ice, rain, water droplets, crystals, snow, fog, haze, dust, smoke, pollutants, and any other particles, solid or otherwise, that may be an element of the atmosphere 310 and/or sky 315.
Although the scene 300 is generally described as a photo or near photo realistic representation of known and existing terrain 305 and atmosphere 310, the scene 300 may provide a photo or visual realistic representation of fictional terrain 305 and atmosphere 310. Instead of the terrain 305 and/or atmosphere 310 of the scene 300 of the image 215 being provided by terrain data related to actual measurements of terrain and atmospheric components related to the earth, the terrain 305 and/or atmosphere 310 may be generated or otherwise provided to realistically represent an imaginary scene 300. As such, the scene 300 may not be a scene of a terrain 305 and atmosphere 310 existing in the world but nevertheless may look as an actual existing terrain 305 and atmosphere 310 due to the photolistic or visual realism of the image 215.
In order to provide for photolistic realism or otherwise visually realistic representation of the scene 300, the effect of the physics of light and optics needs to be considered for the many objects of the terrain 305 and/or atmosphere 310, and the dynamic interactions between them. For example, the effect of light from the sun 320 and the sky 315 along with shadows casted by clouds 325 need to be considered to determine the color of a rendered object in the image 215 as seen by a viewer from a certain viewing position with respect to a view of the scene.
In another aspect, the present invention relates to the simulation and rendering of the natural atmospheric lighting phenomena associated with the scene 300 of the image 215, and any objects of the scene 300.
Scattering is the process by which small particles, such as atmospheric particles 330, suspended in a medium of a different index of refraction diffuse a portion of the incident light in all directions. Along with absorption, scattering is a major cause of the attenuation of light from the sun 320 and the sky 215 by the atmosphere 310. Scattering varies as a function of the ratio of the atmospheric particle 330 diameter to the wavelength of the light. As known by those ordinarily skilled in the art, Rayleigh scattering is the scattering of light by particles smaller than the wavelength of the light. Rayleigh scattering occurs when light travels in transparent solids and liquids, but is most prominently seen in gases. The amount of Rayleigh scattering that occurs to a beam, or ray, of light is dependent upon the size of the atmospheric particles 330 and the wavelength of the light. By Rayleigh's law, the intensity of scattered light varies inversely with the wavelength of the light.
A scattering of sunlight from atmospheric particles 330 is the reason why the light from the sky 315 is blue. The strong wavelength dependence of the scattering means that blue light is scattered much more than red light. In the atmosphere 310, this results in blue photons being scattered across the sky 314 to a greater extent than photons of a longer wavelength, and so one sees blue light coming from all regions of the sky 315 whereas the rest is still mainly coming directly from the sun 320. A notable exception occurs during sunrise and sunset. The light of the sun 320 passes through a much greater thickness of the atmosphere 310 to reach a viewer 350 on the ground. This extra distance causes multiple scatterings of blue light with relatively little scattering of red light. This is seen by the viewer 350 as a pronounced red-hued sky 315 in the direction towards the sun 320.
If the size of the atmospheric particles 330 are larger than the wavelength of light, the light is not separated and all wavelengths are scattered as by a cloud 325 which appears white. Scattering of light from the sky 315 and/or sun 320 from atmospheric particles 330 of about the same size, or larger, as the wavelength of the light is handled by the mathematical-physical theory of Mie's law. Under Mie's law, as one ordinarily skilled in the art will appreciate, the scattering of all atmospheric particle 330 diameters to light wavelength ratios are considered. One ordinarily skilled in the art will recognize and appreciate Mie and Rayleigh's law, and the natural atmospheric phenomenon 360 of light scattering described by the mathematical-physical theory of Mie and Rayleigh's law.
In association with the scene 300 and the image 215, a viewing position 352 of a viewer 350 is provided to determine a view 355 of the scene 300 provided by the image 215. The viewing position 352 of the viewer 350 may be determined to be at a certain height in relation to the terrain 305 and/or the atmosphere 310. The viewing position 253 may comprise a location, a height and/or orientation of the viewer 350 relative to the scene 300, such as any projected coordinate system used by the simulation environment 120. A line of sight 354 to a viewing object is formed from the viewing perspective of the viewing position 352 of the viewer 350 to a target object in the scene 300, such as any element of the terrain 305 and/or atmosphere 310. Changes in the viewing position 352 of the viewer 350 changes the view 355 of the scene 300 of the image 215.
As depicted in
Although natural atmospheric lighting phenomena 360 is generally discussed above in relation to atmospheric light scattering in view of Rayleigh and Mie scattering theories, natural atmospheric lighting phenomena 360 encompasses any of the physical and mathematical relationships of light and optics, and associated phenomenon thereof related to any element of the scene 300 represented by the image 215. Additionally, the systems and methods of the present invention takes into account the visual effects of sunlight attenuation by the atmosphere 310, such as the effects of a sunrise and sunset on the color of the sky 315 and any other element of the scene 300. Furthermore, the present invention considers the visual effects associated with clouds 325, such as the density and color of clouds, self-shadowing by clouds, illumination and lights of clouds along with shadows casted by clouds. One ordinarily skilled in the art will appreciate and recognize the many light associated phenomenon that may be taken into account for an outdoor scene used in practicing the operations of the present invention as described herein.
As a realistic representation, the image 215 represents a three-dimensional (3D) view of the outdoor scene 300. This 3D representation needs to be projected and rendered to a two-dimensional (2D) display of the visual display device 114 of the computing device 102.
To provides a realistic simulation and rendering of the scene 300, the colors of the triangle primitives 430 need to be determined to provide colors of the viewed object or element represented by the triangle primitive 430 such that the color is visually realistic in view of the simulation of the natural atmospheric lighting phenomena 360 occurring in the scene 430. In one embodiment, a color 450 for each vertex 440 of a triangle primitive 430 is determined and some form of color blending 460 is provided for a smooth transition of color between the vertices 440 of the triangle 430. For example, any form of color averaging or interpolation may be computed. Any suitable color blending technique known by one ordinarily skilled in the art may be used to color the primitive 430 used in the mesh 400 representation of the image 215.
In graphical processing, RGB color codes may be used to provide the colors associated with the triangle primitives 430. RGB color codes provide values for the primary colors of red, green, and blue which are mixed to display the color of pixels on a visual display device 114, such as a color monitor. Every color of emitted light can be created by combining the three colors of red, green, and blue in varying levels. Adding no color such as an RGB color code of (0,0,0) produces black, and adding 100 percent of all three colors, e.g., RGB color codes of (100, 100, 100) results in white. Furthermore, the color coding schemes of HLS (Hue, Luminance, Saturation) and/or HSV (Hue, Saturation, Values) as known by those skilled in the art may be used in practicing the present invention. As such, the color of a primitive 430, a rendered pixel, or an object of the scene 430 may be described also in terms of its brightness and/or intensity.
Alternatively, other color coding schemes may be used such as a CMY or CMYK color codes. CMY is a color space consisting of the subtractive primary colors of cyan, magenta, and yellow. These three subtractive primary colors are used in color negative printing, and some output devices, to produce a full gamut of color. CMYK is a cyan, magenta, yellow, and black color space. CMYK are the base colors used in printing processes and also a color mode used to define colors in a digital image. One ordinarily skilled in the art will recognize and appreciate the various color coding that may be used in practicing the present invention as described herein.
In one aspect, the present invention provides techniques for determining the color of the triangle primitives 430 of a mesh 400 to graphically render the scene 300 to realistically represent the natural atmospheric lighting phenomena 360. These techniques enable the graphical processing and rendering of the simulation of the natural atmospheric lighting phenomena 360 to occur at a real-time rate of greater than ten frames per second and upwards of 120 frames per second or more, depending on the computing device 102. Furthermore, these techniques not only provide for real-time rendering speeds but also provide for the photo realistic, near photo realistic, visually realistic or otherwise substantially realistic simulation of natural atmospheric lighting phenomena 360. As such, the present invention provides a simulation environment 120 that can simulate and render images 215 in real-time and in a continuous manner to show the realistic visual effects of natural atmospheric lighting phenomena 360 upon changes to elements of the image 215. For example, the viewing position 352 of the viewer 250 may change causing a different view 355 of the scene to be considered or a different line of sight 354 on an element of object being viewed. Additionally, a man-made object 345 may be positioned or moved through the scene 300 causing a change of the lighting effects of the scene 300 to be considered. Any of the elements of the terrain 305 and/or atmosphere 310 may be changed, such as the addition, deletion or modification of a portion of atmospheric particles 330. For example, the effect of rain, fog or haze may be added or deleted from the scene 300, or the density and/or pattern of such atmospheric particles 330 may be adjusted.
In an exemplary embodiment, the graphics processing pipeline depicted by illustrative method 500 is programmable via shaders 230, 235. As such, a vertex shader 255 of the graphics processing 225 portion of the simulation engine 220 may provide desired vertex processing operations at step 515 to provide for the realistic simulation and real-time rendering of the natural atmospheric lighting phenomena 360 of the present invention. Likewise, a pixel shader 230 may provide desired pixel/fragment processing operations at step 520 to provide for the realistic simulation and real-time rendering of the natural atmospheric lighting phenomena 360 of the present invention.
At step 525 of the illustrative method, the final colors 450 of each of the primitives 430 of the mesh 400 representation of the image 215 are rendered as pixels to a visual display device 114. Via the rendering mechanism 210, pixels are written and/or read to the frame buffer of the video adapter 107 of the computing device 102. There may be hundreds to thousand or more polygons for each frame of a scene 300 which must be updated and transmitted to the frame buffer. The frames are further processed, converted or transformed into suitable analog and or digital output signals of the visual display device 114. The rate of transfer to the frame buffer and/or visual display device 114 is known as frame rate and is measured in frames per second (fps). Each frame of a scene must be updated and transmitted through the frame buffer at a certain rate to give the illusion of movement.
Typically, movies at movie theaters are provided at a rate of 24 frames per second, and some television shows at 30 frames per second. The illusion of movement by the human eye can be seen at 10 frames per second or more, and typically, more fluid motion of a scene, at 24 to 30 frames per second or more. As known by ordinarily skilled in the art, blurring and sharpness of each frame of the scene 300 affects the perceived fluidity of the movement depicted in the simulation. Also, the level of details rendered in the scene 300 affects the frame rate per second needed to provide for fluid movement in a simulation. In general, the more frames per second, the smoother the simulation. One ordinarily skilled in the art will appreciate and recognize frames per second determinations and associated factors and considerations in the environment of the present invention.
The techniques of the realistic approximations of the natural atmospheric lighting phenomena 360 of the present invention will be discussed in detail below and generally in the context of
As discussed above with respect to natural atmospheric lighting phenomena 360, realistic simulation of skies 315 and atmospheres 310 relies on an approximation of the atmospheric light scattering phenomenon: Rayleigh scattering and Mie scattering. The techniques of the present invention approximates the most common visible effects of each of these types of scattering in a typical atmosphere 310, while allowing sufficient flexibility to go beyond the limitations of the scattering models. Furthermore, the approximations are very quick to compute to provide real-time rendering of multiple frames of a scene 300, such as the continuous rendering of a series of frames of a scene 300 for a simulation. In the discussion of the techniques of the present invention below, reference to an object or viewing object may be made. An object may be any element of the scene 300 represented by the image 215 in which the techniques of the present invention are desired to be applied.
Outscattering and in scattering phenomenon of atmospheric light scattering are approximated and calculated as an attenuation factor and an additive term, respectively. The attenuation factor provides an approximation of light from an object being scattered out of the viewing direction of a viewer 350 by atmosphere particles 330. The additive term provides an approximation of the atmospheric particles 330 scattering light into the viewing direction of the viewer 350. As will be discussed further below, the attenuation factor and additive term are used to modify the apparent color and brightness of any object in the scene 300.
At step 610 of the illustrative method, the constants for the Rayleigh component, rrayleigh, and the Mie components, rmie, for the scattering attenuation factor approximation 605 are obtained. In the simulation environment 120 of the present invention, an RGB value is specified for the Rayleigh and Mie components of the atmosphere 310. These constant values may be specified by a user via the configuration mechanism 250 of the simulation environment 120 or may be provided as default, suggested or recommended values in the simulation environment 120. In other embodiments, these constants may be set programmatically via any suitable programming means, such as an application programming interface (API). In accordance with one embodiment of the present invention, density is weighted differently according to the wavelength of light to simulate the effects of Rayleigh scattering. In another embodiment, weights for the Rayleigh and Mie component may be equal. For realistic results, the weights for Rayleigh scattering are highly biased towards blue, and green to a lesser extent.
At illustrative step 615, the cumulative density ρ for each color channel or wavelength is determined:
ρ=∫srrayleigh(s)ds+∫srmie(s)ds
In the scattering attenuation approximation 605 of the present invention, each integral is a user specified density multiplied by the length of the portion of the ray that travels through the atmosphere 310. However, more complex density functions can be used.
At step 620 of the illustrative method 600, the final attenuation factor, defined as the proportion of light from an object that reaches the viewer directly, is computed as:
Thaze=e—
This value is computed for multiple wavelengths, or for each of the RGB channels, with different values of ρ for each wavelength.
At step 710 of the illustrative method 700 of the present invention, the convergence color, Cconv is determined. The details of step 710 are depicted in the illustrated method 1100 of
Ohaze=(1−Thaze)Cconv
The convergence color, Cconv is based on the user's chosen horizon colors for the Rayleigh and Mie components, rrayleigh and rmie. However, it is also dependent on the lighting conditions and the viewing angle with respect to the direction of incident sunlight as described in detail below.
Ofinal=ThazeCobject+Ohaze
In one embodiment, for determining the color of the sky, the viewing object comprises a black background.
In the techniques of the present invention illustrated by methods 600, 700 and 800, the determination and value of Thaze is wavelength dependent. As such, these techniques provides for more realistic colors of objects and results in richer hue variations than with other methods, such as alpha blend operations known by one ordinarily skilled in the art.
In another aspect, the techniques of the present invention provide for colors of the effects of illumination upon the atmosphere 310. The techniques of the present invention consider at least two types of light source: sunlight and ambient (sky). Although ambient light affects the Rayleigh and Mie components of the atmosphere 310 equally, sunlight does not. The techniques described herein consider the convergence color of the Rayleigh and Mie components to form a weighted composition of the components using the relative densities of each.
At step 910 of the illustrative method 900, the horizon color CRayleigh for the Rayleigh component is obtained. The Rayleigh horizon color may be specified by any suitable means and/or mechanisms, such as by a user via the configuration mechanism 250 of the simulation environment 120. In some embodiments, CRayleigh comprises a blue-grey color. Furthermore, CRayleigh should not be confused with Rayleigh density. At step 915, the color and intensity of ambient light, Lambient, or other higher order illumination terms is obtained. The Lambient term may be considered a constant for any particular scene 300. As such, the Lambient term may be user specified via the simulation environment 120, or otherwise be set by any mechanism or means to provide a value suitable for representing the ambient component of light in the scene 300. At step 920, the color and intensity of sunlight, Lsun, is obtained (see step 1945 of
Cconvrayleigh=(Lsun+Lambient)Crayleigh
As such, the parameter Cconvrayleigh comprises the composite effects from sun and ambient light.
At step 1010 of the illustrative method 1000 of the present invention, the horizon color CMie for the Mie component is obtained. The Mie horizon color may be specified by any suitable means or mechanisms, such as by a user via the configuration mechanism 250 of the simulation environment 120. At step 1015, the angle φ, or phase angle, between the viewer 350 and the sunlight as viewed from the object is determined and/or obtained. The angle φ may be determined from a vector from the viewing position 352 and/or viewer 350 towards the sun 320 or incident sunlight in the scene 300.
At illustrative step 1020 of the present invention, intensify and sharpness values, κ and γ, are obtained. The intensity and sharpness value are adjustable values to control the intensity and sharpness of the “glow” around the sun 320 or the apparent sun of the scene 300. In some embodiments, these may be positive values that can be specified by a user via any suitable means or mechanisms, such as by the configuration mechanism 250 of the simulation environment 120. At step 1025, a value, c, is obtained to represent a minimum level of back scattering from an anti-solar direction. At step 1030, a value, {acute over (ε)}, is obtained that affects the minimum angle from the sun. In some embodiments, {acute over (ε)} is a small number.
At step 1035 of the illustrative method 1000 of the present invention, phase Φ is determined as a function of the viewing direction and the direction of incident sunlight as follows:
Φ(φ)=k·max({acute over (ε)},1−cos φ)−γ+c
At step 1040, the convergence color Cconvmie of a purely Mie atmosphere is calculated as:
Cconvmie=(ΦLsun+Lambient)Cmie
In accordance with this technique, the phase function is relatively quick to compute while appearing to give realistic and desirable results.
Cconv=(rrayleighCconvrayleigh+rmieCconvmie)/(rrayleigh+rmie)
As discussed above in conjunction with
In another aspect, the techniques of the present invention are directed towards the visually realistic appearance and real-time rendering of clouds 325 in a scene 300. In accordance with the cloud related techniques of the present invention, cloud appearance is primarily driven by a cloud density function discussed below. In an exemplary embodiment, the cloud density function is implemented as a pixel/fragment shader 230. The cloud appearance technique uses multiple tile-able cloud textures with independent scaling and weightings. This approach has multiples benefits including the following: 1) large cloud formations can be created with fine details and without the need for large, detailed textures; 2) distinct cloud patterns can be controlled at individual scales, and 3) sophisticated looking time-lapse effects are possible by scrolling individual textures.
At illustrative step 1220, a cloud density adjustable offset, c, is obtained. The cloud density adjustable offset may be user specified via the configuration mechanism 250 of the simulation environment 120. In other embodiments, the offset c may be programmatically set or otherwise be specified by the simulation environment 120. By changing the cloud density adjustable offset, while restricting the resulting p to non-negative values, the proportion of cloud-filled sky relative (ρ>0) to clear sky (ρ=0) can be adjusted interactively. In an exemplary embodiment, the offset is the sum of the adjustable offset, c, and a compensation term calculated by the simulation environment 120 of the present invention as described in conjunction with
ρ(x,y)=max[0,w1ρ1(x1,y1)+ . . . +wmρn(xn,yn)+c]
At step 1310 of the present invention, the illustrative method 1300 obtains weightings w1 . . . wn for each texture. At step 1215, the offset compensation term Cw is calculated as follows:
Cw=−0.5(w1+ . . . +wn).
In an exemplary embodiment, a constant value of −0.5 is used to determine the offset compensation term Cw. In other embodiments, other constant values may be suitable to use or may be used to provide a desired offset. At step 1320, a specified adjustable offset Cuser is obtained, such as user specified offset. The offset Cuser may be specified by any suitable mechanism or means, such as by a user via the configuration mechanism 250 of the simulation environment 120. At step 1325, a user adjusted and compensated offset, C, is determined by adding the user specified offset Cuser with the offset compensation term Cw. In one embodiment, the value of Cuser is used in the cloud density function 1205 at steps 1220 and 1125 of illustrative method 1200.
In one aspect of the present invention, the cloud density function 1205 is used to determine the opacity, a, of a cloud 325, as depicted by the illustrative method 1400 of
a=1−e−ρ
The cloud density ρ is physically based in that it is interpreted as an accurate model of the physical particles and/or a distance through the target medium. As such, the cloud opacity a calculated at step 1415 gives a much more desirable and realistic result than simply clamping ρ to the [0, 1] range.
However, an alternative approach can be use to determine cloud opacity that is quicker to compute and provides similar desirable results as compared to the opacity calculated at step 1415. This approach also avoids visibly undesirable results from a cloud density ρ value clamped at 1. Alternatively, after step 1410, the illustrative method 1400 may perform step 1420 and step 1425 instead of step 1415. At step 1430, a cloud opacity offset γ can be provided, specified, by the user and/or the simulation environment 120. In one embodiment, this cloud opacity offset has a value greater than 1, and in an exemplary embodiment, may beset to 2 for quick execution. At step 1425, the following cloud opacity a calculation is performed:
a=1−(1−ρ/γ)γ
In another aspect, the cloud related techniques of the present invention provides for the lighting of clouds. Cloud lighting is a color value, such as an RBG color code, that is multiplied by a current cloud color to give the cloud 325 a final color for rendering. In an exemplary embodiment, cloud lighting calculations consider both sunlight and ambient terms. In some embodiments, the ambient term is considered to be constant throughout the scene 300 on any particular frame. However, in other embodiments any suitable and adjustable offset or calculations may be used to represent the ambient term for cloud lighting. With respect to the sunlight term of cloud lighting, the sunlight term is related to the color and intensity of sunlight reaching the top of the cloud layer, self-shadowing effects of the cloud 325, and light scattering within the cloud 325.
(1−as)
At step 1520, a phase function Φ is determined to simulate anisotropic light scattering within the clouds. In an exemplary embodiment, the phase function is calculated in the vertex shader 235 for speed. In one embodiment, the phase function Φ is the same phase function calculation used for determining the Mie component of the atmosphere 310 as described by the illustrative method 1000 of
Sunlight term=(1−as)ΦLsun
TcloudhazeCcloud[(1−as)ΦLsun+Lambient]
However, to save computation in the pixel/fragment shader 230, an alternative method may be used as illustrated in
Instead of performing step 1625 of illustrative method 1600, in an alternative embodiment, steps 1630, 1635 and 1640 as illustrated in
Osuncloud=TcloudhazeCcloudΦLsun
At step 1635, the attenuated cloud color component Oambientcloud for the ambient term is computed as follows:
Oambientcloud=TcloudhazeCcLambient
In an exemplary embodiment, the Osuncloud Oambientcloud computations are performed in a vertex shader 235 prior to computing the final composite attenuated cloud color 1605 in the pixel/fragment shader 230 by the following calculation:
(1−as)Osuncloud+Oambientcloud
As such, the alternative expression of the attenuated cloud color comprises an approach wherein the attenuated cloud color components for the sunlight and ambient terms are computed separately in the vertex shader 235.
In another aspect, the techniques of the present invention consider the self-shadowing of clouds in the realistic simulation and real-time rendering of an outdoor scene 300 with clouds 325. In some embodiments, self shadowing is based on the integral of densities within the cloud 325 along a path towards the light source, such as the sun 325. In an exemplary embodiment as depicted in
as=1−e−kσ
or
as=1−(1−kσ/γ)γ
The above self-shadowing opacity 1705 calculations are similar to the illustrative method 1400 of
In a further aspect, the final color of a pixel/fragment for the sky 315 can be determined from a composition of the cloud opacity values related to the sun and ambient terms of the cloud coloring along with terms for the cloudless sky and haze.
At step 1820 of the illustrative method 1800, the in scattering additive term Ocloudhaze is calculated or otherwise provided to represent an approximation of the haze between the viewer 350 and the cloud 325. At step 1825, the additive term for atmospheric in scattering Ohaze as calculated in illustrative method 1700 of
Osky=(1−a)Ohaze+a((1−as)Osuncloud+Oambientcloud+Ocloudhaze).
The calculation at step 1840 is an alpha blend type operation which composites the cloud over the cloudless sky, Ohaze, which in an exemplary embodiments was computed in the vertex shader 235. The term Ocloudhaze accounts for the additive (in-scattering) contribution of haze that is between the viewer 350 and the cloud 325. As such, Ocloudhaze contributes to the visual realistic simulation of the appearance of clouds. In an exemplary embodiment, Ocloudhaze is computed in the vertex shader 325 along with Tcloudhaze.
As used in the illustrative methods 1600 and 1800 as discussed above, Tcloudhaze and Ocloudhaze are specific values for Thaze and Ohaze, respectively. The technique for calculating Thaze is discussed above in conjunction of illustrative method 600 of
In one embodiment, the present invention is related to techniques for the realistic simulation of shadows cast by clouds 325 onto other objects such as the terrain 305. The proportion of sunlight that is interrupted by a cloud 325 and prevented from reaching a certain point in the scene 300 is determined by sampling the cloud density function 1205 at the cloud layer's intersection with the ray from the point towards the sun. The cloud density function 1205 is described in detail above with respect to the illustrative method 1200 of
In an embodiment of the atmosphere 310 of the scene representing the Earth's atmosphere, the direct sunlight that reaches any point in the atmosphere 310 is dimmer and redder than the sunlight entering the upper atmosphere 310. This natural atmospheric lighting phenomenon is due to the Rayleigh and Mie scattering of light away from the direct path of the beam of light. This effect is most pronounced when the sun is low in the sky 315 because the light takes a longer path through the atmosphere 310. In one embodiment of this natural atmospheric lighting phenomenon, there is a grade of color and intensity with respect to altitude, often with a dramatic hue shift from white to yellow to red. A resulting consequence of this phenomenon is the rich color gradients one sees in the sky 315 at sunrise and sunset. This effect may also be referred to as the “sunrise” or “sunset” effect.
1) Due to the optical density of atmosphere 310, the lower atmosphere partially obscures the upper atmosphere. Therefore, the sunlight reaching the lower atmosphere is visually more important than the sunlight reaching the upper atmosphere.
2) The degree to which the lower atmosphere is visually more important than the upper atmosphere depends on the cumulative optical density of the lower atmosphere, and therefore is dependent on the observed angle above the horizon.
In an exemplary embodiment of the present invention, the visual consequences of the above assumptions for sunlight attenuation are well represented by choosing a single “dominant” point along the path being observed, that receives what is considered or desired to be the dominant color and intensity of sunlight. For observance paths close to the horizon, the chosen point along the path should be of lower altitude than for paths close to the zenith.
At step 1925, the atmosphere conditions constants, k and m, are obtained or otherwise provided. These constants are in some embodiments set to a value of 1, but can be adjusted to simulate some atmospheric conditions more accurately. In some embodiments, these constants are user specified via the configuration mechanism 250 of the simulation environment 120. At step 1903, the small number value {acute over (ε)} is obtained and/or provided to be used in the optical density calculation to prevent division by zero in the optical density calculation in the following step 1935.
At step 1935, the optical density of atmosphere above the dominant altitude is calculates as follows:
ρ(θ,θsunlight)=ρzenith/(max({acute over (ε)},k·max(0, sin θ)+m·sin θsunlight)
The above calculation provides a value of the optical density ρ that decreases with increasing angles above the horizon (>0) of either the observed point on the sky 315 or the incident sunlight. As both angles θ and θsunlight approach the value of 0, the optical density value produced tends towards infinity.
At step 1940 of the illustrative method 1900, a sunlight attenuation factor is then calculated from p as determined at step 1935. In an exemplary embodiment, the sunlight attention factor is calculated as e−ρ. Since the cumulative optical density ρ varies with the wavelength of light, the resulting attenuation factor approaches 0 at a rate that depends on the wavelength. Thus, the optical density ρ passes through a range of hues as it tends from white (where ρ=0) to black (where ρ=∞). Where optical density ρ is strongly blue or blue-green, for example due to atmospheric Rayleigh light scattering, the attenuation factor exhibits the red and orange hues that are desirable under such conditions. At illustrative step 1945 of the present invention, the final color of sunlight used to illuminate the atmosphere (not including ambient or higher order illumination) is determined using the optical density provided by step 1935:
Lsun=Lsun0·e−ρ
In another aspect, the techniques of the present invention consider sunlight attenuation from the atmosphere when the viewer 350 and the object being considered or viewed, such as the terrain 305, are relatively close or nearby.
(|object|/|sky|)
This ratio accounts for the relative closeness of the object and therefore the reduced altitude from which the angle θ is derived for use in the cumulative optical density ρ calculation. The technique of illustrative method 2000 replaces the term “k·max(0, sin θ)” in the cumulative optical density calculation illustrated at step 1935 of method 1900 with the following term:
(|object|)/(|sky|)·k·max(0, sin θ)
As such, the cumulative optical density ρ will be calculated for viewers 350 nearby objects to provide a visually realistic and real-time simulation of such conditions.
At step 2015 of the illustrative method 2000, a technique to determine the sunlight reaching other objects directly, such as clouds or terrain of a particular altitude, is depicted. At step 2015, the following variation of the optical density calculation is used:
ρ(θ,θsunlight)=((|object|/|sky|)·k·max(0, sin θ))/(max({acute over (ε)}, m·sin θsunlight)
As previously discussed, in some embodiments, the |object|/|sky| ratio is the vertical component of the viewer-object distance divided by the vertical component of the apparent viewer-sky distance. This means that for objects in the upper atmosphere ρ is small, while for objects close to the viewer, ρ is similar to that for the lower atmosphere.
In an exemplary embodiment, the techniques of the present invention discussed above are directed towards illustrative methods performed on a frequency of a vertex basis and/or pixel/fragment basis in a vertex shader 235 and/or pixel shader 230. As such, each of the techniques discussed above can be executed for each vertex and/or pixel needed to render the image 215 and thus the scene 300, including any visual effects from the natural atmospheric lighting phenomena 360. A representation of a scene 300 may have tens of thousands to hundreds of thousands or more polygons (e.g., triangles 430), and millions of pixels to process to render the desired image 215. This results in high number of executions of the techniques of the present invention to render a single instance of a scene 300. The present invention also re-executes the above techniques for each frame of a scene 300 in a multiple-frame simulation, such that the high numbers of executions are repeated for each frame.
In another aspect, the techniques of the present invention are applied when any element of the scene 330 is changed or is desired to be changed, or any factors driving the scene 300 are changed or are desired to be changed. For example, any of the following may cause the present invention to apply these techniques and render the image 215 using these techniques:
-
- 1) a change to the viewer 350, viewing position 352, view 355 and/or line of sight 354 associated with the scene 300, for example, from panning and/or zooming operations;
- 2) a change to any terrain 105 and/or atmosphere data used to generate the image 215;
- 3) a change in position, location, or orientation of any object in the scene 300, or any portion or element of the scene 300, and/or the movement of any object in the scene 300, such as simulating the movement of a man-made object through the scene 300;
- 4) a change in any characteristic, attribute or property of any object in the scene 300, or any portion or element of the scene 300, for example, change in brightness of the sun and/or density of atmospheric particles 330;
- 5) addition and/or deletion of any object, or portion or element of the scene 300; for example, adding/deleting types of atmospheric particles 330, clouds 325, sun 320, land mass 307, bodies of water 309, man-made structures and objects 345; and/or
- 6) a change in any specified constants or parameters, such as user specified constants/parameters used in some embodiments of the techniques of the present invention, for example, constants for the Rayleigh component, rrayleigh, and the Mie components, rmie;
The techniques of the present invention may be executed for all the polygons and pixels of the image 215 to realistically simulate the natural atmospheric lighting phenomena 360. As such, the techniques of the present invention executed through the graphics processing pipeline 500 determine a color 450 for each vertex 440 of a polygon primitive 430 and any associated pixels/fragments. The determined colors provided by the present invention represent the resulting visual effects from the natural atmospheric lighting and related phenomena 360 that may be present in the scene 300 represented by the image 215. Although the techniques of the present invention use approximations for such phenomena, the techniques provide images that are substantially similar to, comparable or equivalent to photographic representations of such phenomena using physically accurate models and calculations, and as such can be referred to as realistic approximations. That is, the colors rendered in an images 215 provided by the present invention are substantially similar to, comparable or equivalent to the colors that would be present in an actual photograph of such phenomena.
Using the systems and methods of the techniques of the present inventions, images 215 and simulations can provide visually realistic representations of sunlight in a scene 300 at any time of day, including from dawn to twilight. The present invention provides a solar lighting system that produces accurate shadows in the scene 300 along with bright sun flares and dramatically realistic sunsets and sunrises. With the cloud related techniques described above, the present invention can simulate a visually realistic representation of a wide range of cumulus and stratus cloud formations and the resulting cloud cover over a terrain 305. Additionally, the present invention provides a visually realistic representation of shadows cast by clouds 325 on the objects, e.g, 345, and terrain 205 of the scene 300. Furthermore, the present invention provides a realistic simulation of the visual effects from light scattering by the cloud cover, and also provides visually realistic simulation of water including accurate reflections, refractions, and turbulence.
Moreover, the techniques of the present invention not only provide visually realistic images 215 as described above but the present invention can render these images 215 in real-time. Even with a complex geometric representation of an image 215 comprising tens of thousands or more polygons, the techniques of the present invention can be computed and executed with real-time and higher frames rates per second. The simulation engine 220 can process and execute the techniques of the present invention at a rate to support the real-time rendering of frames of a simulated image 215 via the rendering mechanism 210.
In one example embodiment, the present invention can execute these techniques at a real-time rate of approximately 120 frames per second with an image 215 represented by approximately 80,000 polygons. In this example, the computing device 102 comprises a Pentium® 3.4 Ghz processor 104 with 1 gigabyte of ram, and the graphics card/processor 105 is an ATI Technology Radeon® X700 graphics card. The images 215 can be rendered at a 1024×768 resolution with 32-bit color to the visual display device 114. As such, the present invention provides very high frame rates per second, even on typically available or common computing devices 102 that far exceed minimum required speeds for real-time simulation.
In another aspect, the techniques of the present invention provide real-time visually realistic simulation of natural atmospheric lighting phenomena on a wide variety of screen resolutions of the visual display device 114 in combination with a variety of real-time frame rates. The techniques of the present invention can provide real-time images and simulation on visual display devices 114 with any of the following pixel screen resolutions: 160×160, 240×160, 320×240, 640×480, 800×600, 1152×864, 1280×720, 1280×768, 1280×960, 1280×1024, 1024×768, 1600×1280 and 2048×1536. In one embodiment, the techniques of the present invention can be executed at a rate of at least 10 frames per second with images 215 rendered at any of the above pixel screen resolutions. In another embodiment, the techniques of the present invention can be executed at a rate of at least at least 15 frames per second with images 215 rendered at any of the above pixel screen resolutions. In a further embodiment, the techniques of the present invention can be executed at a rate of at least 20 frames per second with images 215 rendered at any of the above pixel screen resolutions. In one embodiment, the techniques of the present invention can be executed at a rate of at least 24 frames per second with images 215 rendered at any of the above pixel screen resolutions. In another embodiment, the techniques of the present invention can be executed at a rate of at least at least 30 frames per second with images 215 rendered at any of the above pixel screen resolutions. In another embodiment, the techniques of the present invention can be executed at a rate of at least at least 35 frames per second with images 215 rendered at any of the above pixel screen resolutions. In some embodiments, the techniques of the present invention can be executed at a rate of at least at least 40, 50 or 60 frames per second with images 215 rendered at any of the above pixel screen resolutions. One ordinarily skilled in the art will appreciate and recognize that the techniques of the present invention can be executed at any pixel screen resolution supported by the video display device and at any frame rate for real-time rendering.
With the combination of the visual realism and real-time rendering speeds of the present invention, the simulation environment 120 can provide real-world outside scenes 300 for many applications, such as for games and entertainment related applications, and for training such as driving, flight, or military training tools. Simulations provided by the present invention will make the image synthesis process more intuitive for users and will immerse the user into a visually realistic real-world environment and scenario. This will greatly improve the user's experience with the application and make a more effective visual tool for simulation. Furthermore, because of the real-time rendering capability of the simulation environment 120, the techniques of the present invention can be applied interactively and instantly to develop and design real-world scenes for such applications.
In a further aspect, the present invention provides a simulation environment 120 for generating visually realistic scenes 300 interactively. The simulation environment 120 of the present invention provides user interfaces, such as the illustrative graphical user interfaces depicted in
In the illustrative atmosphere GUI 2100, the blue horizon brightness slider 2105 is used to set or adjust a color value mapping to the Crayleigh parameter used in illustrative method 900 of
In the illustrative lighting GUI 2100, the sunlight color slider 2205 sets or adjusts a color value mapped to the Lsun0 parameter used in the illustrative method 1900 at step 1945. In a similar manner, the ambient color slider 2215 sets or adjusts a color value mapped to the Lambient parameter used in various techniques of the present invention, such as illustrative methods 900, 1000 and 1600. The glow brightness slider 2220 sets or adjusts three real values mapped to form the parameters k, y, and {acute over (ε)} as used for the convergence color approximation of illustrative method 1000. For example purposes, the glow values provided by the glow brightness slider 2220 will be referred to as Glow[0], Glow[1], and Glow[2]. In an exemplary embodiment, the glow values forms the k, y, and {acute over (ε)} parameters in the following manner:
-
- k=Glow[0]−γ (Glow[0] is not mapped directly to k because it is raised to the power of Glow[2] after assignment.)
- −γ=Glow[2] (Glow[2] should be negative. In an exemplary embodiment, a negative value is used directly in the power function for efficiency, rather than performing a negation in the code.)
- {acute over (ε)}=Glow[1] (in some embodiments, about 0.001)
In another embodiment, the glow values may be used to form the k, y, and {acute over (ε)} as follows: - k=Glow[0]
- γ=Glow[2]
- {acute over (ε)}=Glow[1]
In some embodiments, the glow brightness slider 2220 also sets the value of backscattering constant c of step 1025 of illustrative method 1000 to a typical value of 0.25. In other embodiments, the lighting GUI 2200 could provide a slider control or other graphical user interface element to set or adjust the c parameter.
The time of day slider control 2210 controls and provide as value for the sun angle. In an exemplary embodiment, the sun angle is the declination of the sun above the eastern horizon and provides a normalized vector for the sun direction. In some cases, the sun angle can be greater than π/2 to give a westerly vector for the sun direction. The sun angle value provided by the time of day slider control 220 is used for providing a sun direction parameter for computing the θsunlight parameter value as described and used in illustrative methods 1900 and 2000. An x, y and z component of a sun direction parameter can be expressed in relation to the Sun angle, in an exemplary embodiment, as follows:
sunDirection.x=cos(θeast)*cos(SunAngle)
sunDirection.y=sin(SunAngle)
sunDirection.z=sin(θeast)*cos(SunAngle)
where θeast is an angle that defines the direction at which the sun rises.
The sun direction parameter as expressed above is used to compute the cos φ term used in the approximation equations of the present invention, such as used by illustrative method 1000 as step 1035.
In the illustrative atmosphere GUI 2300, the cloud color slider 2305 is used to set or adjust a color value mapping to the Ccloud parameter used in the techniques of the present invention, such as illustrated by method 1600. The cloud coverage slider 2305 sets or adjusts a value between 0 and 1 that maps to Cuser and is used to control the could density offset as determined in illustrative method 1300. The value from the cloud coverage slider 2305 is also used to factor the proportion of sunlight that is allowed to illuminate the atmosphere below the could layer as illustrated by method 1200 of
The cloud density 2310 and cloud detail 2320 sliders provide values to be used for the texture offsets and texture weightings in the cloud density function 1205 of
The x and y components are texture offsets, such that
(x1,y1)=(q1x,r1y)+(CloudPosDensity1.x,CloudPosDensity1.y)
(x2,y2)=(q2x,r2y)+(CloudPosDensity2.x,CloudPosDensity2.y)
where (q1 x, r1 y) and (q2 x, r2 y) are the scaled texture coordinates for textures 1 and 2 at the point being rendered (x, y).
The z components map to weightings for textures 1 and 2, such that:
w1=CloudPosDensity1.z
w2=CloudPosDensity2.z
In one embodiment (not shown), a slider may also be provided in the cloud GUI 2300 or any other GUI 2100, 2200 to allow the user to adjust the apparent vertical position of the atmosphere's horizon and gradient as well as the glow around the sun. This is determined by offsetting the vertical component of the ray towards the object being considered:
(γapparent−γviewer)=(γactual−γviewer)+|p−pviewer|·HorizonDrop
where HorizonDrop is the value provided by the slider, |p−pviewer| is the length of the ray, (γactual−γviewer) is the vertical component of the ray, and (γapparent−γviewer) is the vertical component of the apparent ray which is used by all subsequent atmosphere calculations, such as those performed in illustrative method 1000.
Although slider controls are used in the illustrative graphical user interface 2100, 2200 and 2300, any type of suitable user interface mechanism may be used, such as other types of graphical user interface widgets, configuration files, or data from a database. Additionally, the graphical user interfaces 2100, 2200 and 2300 could be combined into a single user interface, or separated further into more graphical user interfaces. Furthermore, other elements to the graphical user interfaces 2100, 2200 and 2300, and/or additional graphical user interfaces could be provided to allow the user to adjust any constant, parameter or other factor related to the techniques of the present invention described above to generate or create the desired scene 300 and image 215.
Many alterations and modifications may be made by those having ordinary skill in the art without departing from the spirit and scope of the invention. Therefore, it must be expressly understood that the illustrated embodiments have been shown only for the purposes of example and should not be taken as limiting the invention, which is defined by the following claims. These claims are to be read as including what they set forth literally and also those equivalent elements which are insubstantially different, even though not identical in other respects to what is shown and described in the above illustrations.
Claims
1. A method for approximating a realistic color of an object based on wavelength dependent approximations of atmospheric lighting phenomenon, the method comprising:
- (a) specifying, via a simulation engine executing on a device, a first RGB constant for a Raleigh scattering component of an atmosphere to be rendered on a display of the device;
- (b) specifying, via the simulation engine, a second RGB constant for a Mie scattering component of the atmosphere;
- (c) calculating, by the simulation engine, for each color channel, a cumulative density of particles of the atmosphere along a ray between a viewing position of an object and the object by summing a first result of a first integral of a corresponding color channel of the first RGB constant multiplied by a length of a portion of the ray intersecting the atmosphere and a second result of a second integral of the corresponding color channel of the second RGB constant multiplied by the length of the portion of the ray intersecting the atmosphere;
- (d) determining, by the simulation engine, an attenuation factor for each color channel by taking an exponential function of a negative of the cumulative density calculated for the corresponding color channel; and
- (e) rendering, by the simulation engine, a color for the object from atmospheric light scattering based on each attention factor of each color channel.
2. The method of claim 1, wherein step (a) further comprises specifying by a user, via the simulation engine, the first RGB constant.
3. The method of claim 1, wherein step (a) further comprises specifying by a user, via the simulation engine, the second RGB constant.
4. The method of claim 1, wherein step (a) further comprises applying a weight to one or more color channels of the first RGB constant.
5. The method of claim 1, wherein step (b) further comprises applying a weight to one or more color channels of the second RGB constant.
6. The method of claim 1, wherein step (d) further comprises determining, by the simulation engine, an additive term for each color channel by multiplying a convergence color by each color channel's attenuation factor subtracted from a value of one, the convergence color based on a user specified color for the Rayleigh and Mie components of the atmosphere.
7. The method of claim 6, wherein step (e) further comprises determining the color of the object by multiplying each color channel's attenuation factor by the corresponding color channel of the object's RGB value and adding to this result the additive term for the corresponding color channel.
8. The method of claim 6, further comprising determining, by the simulation engine, the convergence color by taking a weighted average of a user specified Rayleigh convergence color component and a user specified Mie convergence color component.
9. The method of claim 1, further comprising determining, by the simulation engine, the convergence color by taking a weighted average of a Rayleigh convergence color component and a Mie convergence color component according to relative densities of the Rayleigh convergence color component and thes Mie convergence color component.
10. A method for approximating a realistic appearance of clouds using a plurality of cloud textures with independent weightings, the method comprising:
- (a) obtaining, by a simulation engine executing on a device, a plurality of cloud textures to represent a cloud to be rendered on a display of the device, each of the plurality of cloud textures having a weighting attribute;
- (b) determining, by the simulation engine, a density of the cloud from an aggregate of cloud density values at each texture coordinate of each cloud texture weighted by the weighting attribute; and
- (c) rendering, by the simulation engine, the cloud on the display based on the determined density of the cloud.
11. The method of claim 10, wherein step (b) further comprises adding an offset value to the aggregate of the cloud density values.
12. The method of claim 11, wherein the offset value is adjustable by a user.
13. The method of claim 11, further comprising determining the offset value by applying a constant to a sum of the weighting attribute values.
14. The method of claim 10, wherein the cloud density value at a texture coordinate and a weighting attribute of a first cloud texture is independent from a cloud density value at a texture coordinate and a weighting attribute of a second cloud texture.
15. The method of claim 10, wherein tiling, by the simulation engine, the plurality of cloud textures to represent the cloud.
16. The method of claim 10, further comprising using, by the simulation engine, the determination of the density of the cloud from step (b) to determine an opacity of the cloud.
17. The method of claim 10, further comprising determining, by the simulation engine, an opacity of the cloud by taking an exponential function of a negative of the density of the cloud.
18. The method of claim 17, further comprising subtracting a result of the exponential function of a negative of the density of the cloud from a value of one to determine the opacity.
19. The method of claim 10, further comprising obtaining, by the simulation engine, a cloud opacity offset.
20. The method of claim 19, further comprising determining, by the simulating engine, the opacity by dividing the density of the could by the cloud opacity offset and subtracting from a value of one and taking this result and raising by a power of the cloud opacity offset.
Type: Application
Filed: Mar 12, 2010
Publication Date: Jul 1, 2010
Inventor: Matthew P. Fairclough (Ellesmere Port)
Application Number: 12/723,233
International Classification: G09G 5/02 (20060101); G09G 5/00 (20060101);