This invention generally relates to computer graphics and animation such as used in films, videos, and games, and which is typically computer implemented, and more specifically to the problem in animation of volume rendering, that is depicting volumetric effects.
Volume rendering is a technique used to display a two dimensional projection of a three-dimensional discretely sampled data set, in computer graphics. Usually the data is acquired in a regular pattern, with each volume picture element (voxel) represented by a single value. One must define a camera location in space relative to the volume. A direct volume renderer requires every data sample to be mapped to opacity and a color. Known rendering techniques include ray casting, splatting, shear warp, and texture mapping.
Volumetric effects (e.g., dust, fire, etc) are common in computer-implemented animation. These effects typically employ a physical or procedural simulator (to generate the effect) and a volume renderer. Volume rendering is also useful in medical imaging, where 3D scans of biological tissue are common. The two most popular computer-based approaches to volume rendering are splatting and ray marching. In splatting, the color and opacity of the volume is computed at discrete points. This can be done by sampling a voxel grid (optionally with interpolation), or by directly using particles as the volume representation. Every volume element is “splatted” on to the viewing surface in back to front order. These points are then typically rendered as overlapping circles (disks) with Gaussian falloff of opacity at their edges. Rendering hardware (processors) may be used to accelerate splatting.
In ray marching, rays are cast through the image plane into the volume. Opacity and color are then calculated at discrete locations along each ray and summed into the associated pixel (picture element). In ray casting, the image is projected by casting (light) rays through the volume. The ray starts at the center of the projection of the camera and passes through the image pixel on the imaginary image plane in between the camera and the volume to be rendered. The ray is sampled at regular intervals throughout the volume. Ray marching can be slow, but many optimization schemes have been developed, including faster grid interpolation and skipping of empty space.
In accordance with this disclosure, a combination of splatting and ray marching is used, in order to employ the strength of each for computer implemented animation for games, video, feature films, medical imaging, etc. This is perhaps up to an order of magnitude faster in terms of computer processing than is conventional ray marching with motion blur, with results of comparable quality. Ray marching typically samples the volume to be depicted in a pixel-ray-based manner. Thus the sample density corresponds to camera proximity. Ray marching focuses on the volume detail closest to the camera and thus captures the most important detail. In contrast, splatting uses a regular or stochastic sampling of the entire volume. Ray marching often produces higher quality renders and may be faster if splatting densely samples the volume.
The present combination of these is a rendering method and associated apparatus. In accordance with the method, the voxel grid is ray marched with a particle generated for each sample. The particles are then rendered by splatting. For each pixel, a single ray is cast from the camera location through the center of that pixel. Next, one marches along that ray from one point to another point in space. A particle is generated at each step along the ray. This is done using interpolation. That is, for instance 8 equally spaced point values are typically interpolated at a minimum (tri-linear) interpolation or as many as 64 point values for tri-cubic interpolation (see below). The particles represent contributions to individual pixels. Each pixel is rendered as a pixel-size square or using a splat primitive such as a Gaussian disk. The particles can either be rendered one at a time as they are generated during ray marching or alternatively can be rendered in a batch. Motion blur is rendered by splatting the particle multiple times over the velocity vector.
This process has generally been found to be very useful for depicting volumetric visual effects such as fire, dust and smoke. The image quality provided is very high.
Typically this process is carried out via computer software (code) executed on a conventional computer such as a workstation type computer as used in the computer animation field. This process thereby is embodied in a computer program. Coding such a computer program in light of this disclosure would be routine. Any suitable programming language may be used. Some aspects of the process may be embodied in computer hardware.
“Voxel” is a combination of the words volumetric and pixel and is well known in the animation field as referring to a volume element representing a value on a regular grid in 3-dimensional space. It is analogous to a pixel which represents 2-dimensional image data. In the computer animation field, rendering is a process of generating an image from a model by means of computer programs. The models are descriptions of 3-dimensional objects in a defined language or data structure. A model typically contains geometry, viewpoint, texture, lighting and shading information. The image is typically a digital image or raster graphics image. Rendering is typically the last major step in assembling an animation film or video, giving the final appearance to the models and animation. It is used, for instance, in video games, simulators, movie and television special effects.
The present method is directed to a combination of two popular volume rendering schemes. This is appealing because existing knowledge of and systems for volume rendering can be leveraged in implementing and utilizing this technique. The method can be implemented employing a conventional ray marcher and particle renderer. The method executes quickly while producing high-quality images. Ray-based sampling requires fewer samples than traditional splatting for high-quality rendering because ray marching focuses on the nearest (and likely most important) detail. The present method generates and splats particles because it has empirically proven to be a very fast and effective mechanism for motion blur and depth of field. (Depth of field refers to the focus of objects in a scene at various depths.) A single ray per pixel is sufficient, due to the use of motion blur and particles with diameter greater than one pixel.
Strengths of the present method include generality, fast rendering, high image quality, accurate 3D motion blur, depth of field, ease of implementation, adaptive volume sampling density according to camera proximity since rays disperse, and the option to utilize rendering “hardware” (a special purpose computer graphics card) for splatting. The method can also be applied to volumetric effects that are represented by particles rather than a voxel grid. Also provided is a software tool that conventionally generates a voxel grid by projecting the particles into the voxel grid. This is useful since volume renders tend to be richer (providing a better quality image) than are direct particle renders with Gaussian splats.
a and 1b show a comparison of voxel grid sampling, showing in
a shows how a particle, currently at position p with velocity v, moves towards position p′ in the next frame, and
a and 3b show fire rendered with conventional ray marching (and no motion blur), and
a and 4b show large-scale fire effects with volumetric smoke.
a and 6b show a torch.
Splatting and ray marching, as known in the field, have contrasting strengths and weaknesses, as summarized here:
Ray marching samples the volume in a pixel-ray-based manner (see
Another distinction between these volume rendering methods is motion blur. Note that providing motion blur is challenging in volume rendering, because correct blur requires that the velocity within the volume be taken into account. For example, a stationary volume may internally represent a turbulent fluid. This motion will only be blurred if internal velocity is considered. Fortunately it is simple to achieve accurate 3D motion blur in splatting (see
This disclosure is directed to such a hybrid volume rendering method combining ray marching and splatting, retaining many of their unique strengths. The method includes:
In the ray marching, for each pixel P, a single ray R is cast from the (notional) camera position C through the center of the pixel where R.o is the ray origin and R.d is the ray direction:
R.{right arrow over (o)}=C.position, R.{right arrow over (d)}=unit(P.center−C.position), R(t)=R.{right arrow over (o)}+R.{right arrow over (d)}·t, (1)
where t is a parameter along the ray. This ray is intersected with the voxel grid bounding box to determine the entry and exit points, at locations t0 and t1 respectively. To simplify intersection and marching, one applies the inverse grid transformation to the ray.
Next one marches along the ray from t0 to t1. Specifically, increment t=t+Δt where Δt is a constant that may be set by the user. One can set Δt such that about 150 steps (increments) are taken along rays that directly penetrate the volume.
A particle is generated at each step along the ray. The particle inherits the interpolated attributes (position, color, opacity, and velocity) of the voxel grid defined at that exact point R(t) in the voxel grid. One may utilize a choice of fast tri-linear (linear in dimensions X, Y, Z), tri-quadratic, or tri-cubic interpolation between voxels. The interpolation order is selected by the user (animator) per grid attributes. While non-linear interpolation is notably more computationally expensive than simple linear interpolation, higher order interpolation helps achieve sufficient visual quality for feature film production. This is especially true of velocity since it controls motion blur.
The present non-linear interpolation is based on the unique quadratic/cubic polynomial that interpolates three or four equally-spaced values. The polynomial equation may be derived through matrix inversion. The quadratic and cubic equations are reasonably simple and fast to execute on a computer processor. As an example, a quadratic interpolation f is:
ƒ(p)=d[0]+p*((2−p)*d[2])*d[0]+(1−p)*d[2])*0.5) (2)
where p is the position of the particle and d[ ] is the equally-spaced data to interpolate. The interpolation is executed in three passes, in dimensions xyz order for those 3 dimensions in space. Thus this equation is evaluated 13 times for each grid attribute to interpolate: 9 times in x, 3 times in y, and 1 time in z.
Nearly all computer processing time in the present method is spent in interpolation since particle splatting is so fast computationally. To minimize grid sampling, one can use two simple optimizations. First, precompute those voxel neighborhoods that have (nearly) zero opacity and skip over them. Second, terminate the ray if full opacity has been reached. The present method provides high-quality renders with only one ray per pixel, which helps keep the number of grid samples down.
In splatting, the particles represent contributions to individual pixels. As such, it is possible to render them by merely adding them to the associated pixels. However, this simple method may not be sufficient since the particles will move to non-pixel-center locations during motion blur. However, the method does not need elaborate splatting (e.g., Gaussian disks).
Each particle is rendered as a pixel-sized square or rectangle. Its contribution to a given pixel is modulated by the fraction of the pixel the particle covers. This weight w is easy to compute by this equation:
w(l,p)=max(1−abs(l,x−p,x))*max(1−abs(l:y−p.y)), (3)
where p is the position of the particle and l the center of the pixel, and assuming the pixel extends over a unit range in dimensions x and y. Alternatively, particle rendering can be performed on conventional rendering hardware (processors) using simple primitives. Note that particle diameter can be increased to achieve fast and easy noise filtering such as Gaussian disks.
The particles can either be rendered one at a time as they are generated during ray marching, or alternatively can be rendered in batch. Immediate rendering is preferable as less computer memory is utilized. However, ordered rendering (e.g., back-to-front) is useful in some circumstances and requires batch rendering. Fortunately, the particles are very “light” (requiring little memory)—one example successfully uses up to 35 million particles per frame. The order of particles along each ray can be utilized to speed up sorting.
Motion blur is rendered by splatting the particle multiple times over the velocity vector, where the total opacity equals the opacity of the original particle (see
Illumination of hazy volume media is difficult to compute since incoming light is attenuated by partially opaque regions of the volume. Self-shadowing may be computed by shooting shadow rays and integrating attenuation, but this is slow to process. There is a known technique known as “light volume” for reusing illumination calculations. Specifically, illumination is computed for the center point of each voxel. Illumination at an arbitrary point in the volume is then approximated through interpolation. This can speed up rendering when multiple samples are taken per voxel.
However, light volumes have limitations. First, there is no speed/quality tradeoff that can be adjusted by the animator since the illumination information is always the same resolution as the voxel grid. Second, there may be no clear way to store in memory the light volume for certain volume representations, such as spheres filled with noise (a pseudo-random pattern which gives the appearance of a natural texture. An example of such noise is called “Perlin Noise” in the field.). Third, the illumination of every voxel is computed before rendering. This is computationally wasteful since portions of the volume may not be rendered due to 0 opacity or lying outside the camera frustum.
The present approach therefore utilizes a modified form of the light volume technique. The present approach provides a speed/quality tradeoff adjustable by the animator that works with any volume representation and only computes lighting in necessary regions of the volume.
This is done by decoupling the light volume from the voxel grid. Specifically one creates a distinct voxel grid (herein after referred to as the “light grid”) whose resolution is specified by the animator. Upon creation, the light grid is aligned and oriented with the volume data bounding box. (A bounding box is a representation of the extent of the volume.) In other words, the light grid precisely fits the volume data whatever the volume data representation may be. The light grid is initialized in order to contain no illumination information. One also allocates an array of binary flags (indicators), one flag per voxel, which denote whether illumination in the voxel's entire neighborhood has been computed. (The neighborhood is defined by the surrounding points used for the interpolation. For a tri-linear interpolation it is the 8 points defining the voxel edges.) This is useful for quickly determining if light voxels need to be illuminated. The neighboring block is the same width as the grid interpolation filter which is the mechanism of the interpolation used to define the volume attributes at any point in space. The grid illuminations is computed and stored on demand. Then illumination at the sample point p is quickly approximated through grid interpolation.
In feature film production, any given frame is rendered many times during the animation process. Thus it is useful to provide animators with software tools that provide both fast/lower quality renders and slow/high quality renders, in other words a tradeoff between speed and quality. The choice of light grid resolution provides the animator with a simple approach to adjust speed/quality. The animator may also be provided with a choice of tri-linear, tri-quadratic and tri-cubic interpolation for the light grid, as explained above. The calculation of light grid illumination on demand speeds up rendering overall since there is no wasted computation.
The present methods can be used for volumetric visual effects in feature animated films. These effects include fire, dust, and smoke, Examples of such effects are shown in
As can be seen in these examples, the image quality is very high. All of these exemplary images were rendered with only one ray per pixel, and approximately 150 samples (increments) per ray. This technique is very fast—on a 3 GHz speed computer processor, rendering an HDTV (high definition television)—resolution image of motion-blurred fire takes approximately one minute per frame of the image. Also, the technique utilizes little computer memory if the particles are rendered when they are generated rather than being buffered and rendered in batch.
The importance and effectiveness of motion blur is demonstrated in
In one example, one uses a default light grid size of 1753 which requires approximately 61.3 MB of memory. This memory requirement is further reduced if the volume is rectangular (not cubic), such as 100×174×100. This relatively small size has empirically been determined to be effective for producing renders virtually indistinguishable from renders produced using exhaustive shadow rays. Exemplary images produced using this technique are shown in
Further examples show the effectiveness of the present method for a wide variety of volumetric media. For example, it depicts highly transparent and incandescent fluids such as fire, and thick smoke with self-shadowing. Thus
There is a visual limitation of the motion blur produced by this technique. This is very slightly visible in
This disclosure is illustrative and not limiting; further modifications will be apparent to one skilled in the art in light of this disclosure and are intended to fall within the scope of the appended claims.
This application claims priority to U.S. Provisional Application No. 60/899,676, filed Feb. 5, 2007, and U.S. Provisional Application No. 60/900,570, filed Feb. 8, 2007, both incorporated herein by reference in their entirety.
Number | Date | Country | |
---|---|---|---|
60899676 | Feb 2007 | US | |
60900570 | Feb 2007 | US |