青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Shadow volume

http://en.wikipedia.org/wiki/Shadow_volume

Shadow volumes are a technique used in 3D computer graphics to add shadows to a rendered scene. They were first proposed by Frank Crow in 1977[1] as the geometry describing the 3D shape of the region occluded from a light source. A shadow volume divides the virtual world in two: areas that are in shadow and areas that are not.

The stencil buffer implementation of shadow volumes is generally considered among the most practical general purpose real-time shadowing techniques utilizing the capabilities of modern 3D graphics hardware. It has been popularized by the computer game Doom 3, and a particular variation of the technique used in this game has become known as Carmack's Reverse (see depth fail below).

This technique as well as shadow mapping has become popular real-time shadowing techniques. The main advantage of shadow volumes is that they are accurate to the pixel (though many implementations have a minor self-shadowing problem along the silhouette edge, see construction below), whereas the accuracy of a shadow map depends on the texture memory allotted to it as well as the angle at which the shadows are cast (at some angles, the accuracy of a shadow map unavoidably suffers). However, the shadow volume technique requires the creation of shadow geometry, which can be CPU intensive (depending on the implementation). The advantage of shadow mapping is that it is often faster, the reason for which is that shadow volume polygons are often very large in terms of screen space and require a lot of fill time (especially for convex objects), whereas shadow maps do not have this limitation.

Contents

[hide]

[edit] Construction

In order to construct a shadow volume, project a ray from the light through each vertex in the shadow casting object to some point (generally at infinity). These projections will together form a volume; any point inside that volume is in shadow, everything outside is lit by the light.

For a polygonal model, the volume is usually formed by classifying each face in the model as either facing toward the light source or facing away from the light source. The set of all edges that connect a toward-face to an away-face form the silhouette with respect to the light source. The edges forming the silhouette are extruded away from the light to construct the faces of the shadow volume. This volume must extend over the range of the entire visible scene; often the dimensions of the shadow volume are extended to infinity to accomplish this (see optimization below.) To form a closed volume, the front and back end of this extrusion must be covered. These coverings are called "caps". Depending on the method used for the shadow volume, the front end may be covered by the object itself, and the rear end may sometimes be omitted (see depth pass below).

There is also a problem with the shadow where the faces along the silhouette edge are relatively shallow. In this case, the shadow an object casts on itself will be sharp, revealing its polygonal facets, whereas the usual lighting model will have a gradual change in the lighting along the facet. This leaves a rough shadow artifact near the silhouette edge which is difficult to correct. Increasing the polygonal density will minimize the problem, but not eliminate it. If the front of the shadow volume is capped, the entire shadow volume may be offset slightly away from the light to remove any shadow self-intersections within the offset distance of the silhouette edge (this solution is more commonly used in shadow mapping).

The basic steps for forming a shadow volume are:

  1. Find all silhouette edges (edges which separate front-facing faces from back-facing faces)
  2. Extend all silhouette edges in the direction away from the light-source
  3. Add a front-cap and/or back-cap to each surface to form a closed volume (may not be necessary, depending on the implementation used)
Illustration of shadow volumes. The image above at left shows a scene shadowed using shadow volumes. At right, the shadow volumes are shown in wireframe. Note how the shadows form a large conical area pointing away from the light source (the bright white point).

[edit] Stencil buffer implementations

After Crow, Tim Heidmann showed in 1991 how to use the stencil buffer to render shadows with shadow volumes quickly enough for use in real time applications. There are three common variations to this technique, depth pass, depth fail, and exclusive-or, but all of them use the same process:

  1. Render the scene as if it were completely in shadow.
  2. For each light source:
    1. Using the depth information from that scene, construct a mask in the stencil buffer that has holes only where the visible surface is not in shadow.
    2. Render the scene again as if it were completely lit, using the stencil buffer to mask the shadowed areas. Use additive blending to add this render to the scene.

The difference between these three methods occurs in the generation of the mask in the second step. Some involve two passes, and some only one; some require less precision in the stencil buffer. (These algorithms function well in both OpenGL and Direct3D.)

Shadow volumes tend to cover large portions of the visible scene, and as a result consume valuable rasterization time (fill time) on 3D graphics hardware. This problem is compounded by the complexity of the shadow casting objects, as each object can cast its own shadow volume of any potential size onscreen. See optimization below for a discussion of techniques used to combat the fill time problem.

[edit] Depth pass

Heidmann proposed that if the front surfaces and back surfaces of the shadows were rendered in separate passes, the number of front faces and back faces in front of an object can be counted using the stencil buffer. If an object's surface is in shadow, there will be more front facing shadow surfaces between it and the eye than back facing shadow surfaces. If their numbers are equal, however, the surface of the object is not in shadow. The generation of the stencil mask works as follows:

  1. Disable writes to the depth and colour buffers.
  2. Use back-face culling.
  3. Set the stencil operation to increment on depth pass (only count shadows in front of the object).
  4. Render the shadow volumes (because of culling, only their front faces are rendered).
  5. Use front-face culling.
  6. Set the stencil operation to decrement on depth pass.
  7. Render the shadow volumes (only their back faces are rendered).

After this is accomplished, all lit surfaces will correspond to a 0 in the stencil buffer, where the numbers of front and back surfaces of all shadow volumes between the eye and that surface are equal.

This approach has problems when the eye itself is inside a shadow volume (for example, when the light source moves behind an object). From this point of view, the eye sees the back face of this shadow volume before anything else, and this adds a −1 bias to the entire stencil buffer, effectively inverting the shadows. This can be remedied by adding a "cap" surface to the front of the shadow volume facing the eye, such as at the front clipping plane. There is another situation where the eye may be in the shadow of a volume cast by an object behind the camera, which also has to be capped somehow to prevent a similar problem. In most common implementations, because properly capping for depth-pass can be difficult to accomplish, the depth-fail method (see below) may be licensed for these special situations. Alternatively one can give the stencil buffer a +1 bias for every shadow volume the camera is inside, though doing the detection can be slow.

There is another potential problem if the stencil buffer does not have enough bits to accommodate the number of shadows visible between the eye and the object surface, because it uses saturation arithmetic. (If they used arithmetic overflow instead, the problem would be insignificant.)

Depth pass testing is also known as z-pass testing, as the depth buffer is often referred to as the z-buffer.

[edit] Depth fail

Around 2000, several people discovered that Heidmann's method can be made to work for all camera positions by reversing the depth. Instead of counting the shadow surfaces in front of the object's surface, the surfaces behind it can be counted just as easily, with the same end result. This solves the problem of the eye being in shadow, since shadow volumes between the eye and the object are not counted, but introduces the condition that the rear end of the shadow volume must be capped, or shadows will end up missing where the volume points backward to infinity.

  1. Disable writes to the depth and colour buffers.
  2. Use front-face culling.
  3. Set the stencil operation to increment on depth fail (only count shadows behind the object).
  4. Render the shadow volumes.
  5. Use back-face culling.
  6. Set the stencil operation to decrement on depth fail.
  7. Render the shadow volumes.

The depth fail method has the same considerations regarding the stencil buffer's precision as the depth pass method. Also, similar to depth pass, it is sometimes referred to as the z-fail method.

William Bilodeau and Michael Songy discovered this technique in October 1998, and presented the technique at Creativity, a Creative Labs developer's conference, in 1999[1]. Sim Dietrich presented this technique at a Creative Labs developer's forum in 1999 [2]. A few months later, William Bilodeau and Michael Songy filed a US patent application for the technique the same year, US patent 6384822, entitled "Method for rendering shadows using a shadow volume and a stencil buffer" issued in 2002. John Carmack of id Software independently discovered the algorithm in 2000 during the development of Doom 3 [3]. Since he advertised the technique to the larger public, it is often known as Carmack's Reverse.

Bilodeau and Songy assigned their patent ownership rights to Creative Labs. Creative Labs, in turn, granted id Software a license to use the invention free of charge in exchange for future support of EAX technology. [4]

[edit] Exclusive-Or

Either of the above types may be approximated with an Exclusive-Or variation, which does not deal properly with intersecting shadow volumes, but saves one rendering pass (if not fill time), and only requires a 1-bit stencil buffer. The following steps are for the depth pass version:

  1. Disable writes to the depth and colour buffers.
  2. Set the stencil operation to XOR on depth pass (flip on any shadow surface).
  3. Render the shadow volumes.

[edit] Optimization

  • One method of speeding up the shadow volume geometry calculations is to utilize existing parts of the rendering pipeline to do some of the calculation. For instance, by using homogeneous coordinates, the w-coordinate may be set to zero to extend a point to infinity. This should be accompanied by a viewing frustum that has a far clipping plane that extends to infinity in order to accommodate those points, accomplished by using a specialized projection matrix. This technique reduces the accuracy of the depth buffer slightly, but the difference is usually negligible. Please see SIGGRAPH 2002 paper Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated Rendering, C. Everitt and M. Kilgard, for a detailed implementation.
  • Rasterization time of the shadow volumes can be reduced by using an in-hardware scissor test to limit the shadows to a specific onscreen rectangle.
  • NVIDIA has implemented a hardware capability called the depth bounds test that is designed to remove parts of shadow volumes that do not affect the visible scene. (This has been available since the GeForce FX 5900 model.) A discussion of this capability and its use with shadow volumes was presented at the Game Developers Conference in 2005. [5]
  • Since the depth-fail method only offers an advantage over depth-pass in the special case where the eye is within a shadow volume, it is preferable to check for this case, and use depth-pass wherever possible. This avoids both the unnecessary back-capping (and the associated rasterization) for cases where depth-fail is unnecessary, as well as the problem of appropriately front-capping for special cases of depth-pass.

[edit] See also

[edit] External links

[edit] Regarding depth-fail patents

[edit] References

  1. ^ Crow, Franklin C: "Shadow Algorithms for Computer Graphics", Computer Graphics (SIGGRAPH '77 Proceedings), vol. 11, no. 2, 242-248.

posted on 2008-09-26 17:24 zmj 閱讀(1682) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久精品国产精品亚洲| 日韩一区二区精品视频| 麻豆成人小视频| 欧美一区二区视频网站| 久久成人免费视频| 久久久久久国产精品mv| 久久综合精品国产一区二区三区| 麻豆av一区二区三区久久| 欧美福利视频| 国产精品theporn88| 国产精品一区免费视频| 激情六月婷婷久久| 亚洲国产欧美不卡在线观看| 一本色道久久88综合日韩精品 | 狠狠综合久久| 亚洲人成7777| 欧美亚洲一级| 欧美激情一区二区三级高清视频 | 欧美日韩精品一二三区| 国产精品影视天天线| 亚洲国产岛国毛片在线| 亚洲综合二区| 免费成人高清| 亚洲制服丝袜在线| 欧美精品v日韩精品v国产精品| 国产女人18毛片水18精品| 亚洲人成精品久久久久| 久久久久国产精品厨房| 亚洲精品中文字幕在线观看| 久久精品女人| 国产精品亚洲激情| 夜夜爽99久久国产综合精品女不卡| 久久精品2019中文字幕| 亚洲片在线观看| 亚洲一区国产视频| 欧美精品在线视频| 亚洲国产成人91精品| 性欧美在线看片a免费观看| 亚洲激情视频在线观看| 久久久久久婷| 国产一区二区三区精品久久久| 一区二区三区四区在线| 亚洲第一级黄色片| 久久精品人人做人人爽| 国产欧美精品国产国产专区| 亚洲一区二区在线播放| 亚洲国产一区二区在线| 看欧美日韩国产| 国产亚洲一区二区三区在线观看| 亚洲砖区区免费| 9人人澡人人爽人人精品| 欧美va亚洲va国产综合| 欧美国产亚洲视频| a91a精品视频在线观看| 久久精品日韩欧美| 亚洲综合三区| 国产精品久久77777| 在线一区二区三区四区五区| 亚洲国产女人aaa毛片在线| 久久在精品线影院精品国产| 加勒比av一区二区| 免费不卡视频| 欧美91福利在线观看| 亚洲国产成人精品女人久久久| 免费亚洲婷婷| 老鸭窝毛片一区二区三区| 亚洲国产精品久久久久秋霞不卡 | 亚洲黄色影院| 欧美剧在线观看| 夜夜精品视频一区二区| 一本色道久久| 国产伦精品一区二区三区视频黑人| 午夜免费在线观看精品视频| 亚洲欧美在线观看| 国内揄拍国内精品久久| 麻豆av福利av久久av| 免费亚洲电影在线| 亚洲天堂成人在线观看| 午夜激情综合网| 欲色影视综合吧| 亚洲日本aⅴ片在线观看香蕉| 欧美日韩视频第一区| 午夜精品一区二区在线观看 | 一本大道av伊人久久综合| 亚洲精品小视频在线观看| 欧美无砖砖区免费| 久久久久青草大香线综合精品| 麻豆成人小视频| 亚洲女女女同性video| 久久精品午夜| 亚洲午夜未删减在线观看| 欧美在线亚洲一区| 一区二区三区四区五区在线| 亚久久调教视频| 夜夜嗨av一区二区三区网站四季av| 亚洲欧美影音先锋| 99精品国产99久久久久久福利| 亚洲欧美综合| 一本综合久久| 麻豆九一精品爱看视频在线观看免费| 一区二区三区久久| 久久午夜国产精品| 亚洲欧美综合国产精品一区| 美女国产一区| 久久精品人人做人人综合| 欧美日韩国产经典色站一区二区三区| 久久精品二区三区| 国产精品ⅴa在线观看h| 欧美激情第10页| 久久精品一本| 久久国内精品视频| 在线观看视频欧美| 国产精品99久久99久久久二8| 亚洲风情亚aⅴ在线发布| 亚洲伊人伊色伊影伊综合网| 亚洲开发第一视频在线播放| 久久精品夜色噜噜亚洲a∨| 性欧美精品高清| 欧美日韩精品一区二区在线播放| 美女视频黄 久久| 国产午夜一区二区三区| 亚洲一区二区三区精品在线观看| 亚洲免费观看在线观看| 久久在线免费视频| 久久夜色精品国产| 国产亚洲精品福利| 午夜精品视频一区| 西西人体一区二区| 国产精品日日摸夜夜添夜夜av| 99国产成+人+综合+亚洲欧美| 亚洲欧洲一区二区在线播放| 久久中文久久字幕| 免费久久久一本精品久久区| 樱桃成人精品视频在线播放| 久久av在线看| 久久女同精品一区二区| 国内精品美女av在线播放| 欧美一区二区精品久久911| 久久精品国产亚洲精品| 国产亚洲精品久久久久婷婷瑜伽| 性伦欧美刺激片在线观看| 欧美与黑人午夜性猛交久久久| 国产精品亚洲视频| 欧美一级欧美一级在线播放| 久久天天躁夜夜躁狠狠躁2022| 精品69视频一区二区三区| 久久久久看片| 欧美黄色影院| 亚洲图片欧美日产| 国产欧美日本一区二区三区| 欧美在线国产| 亚洲第一偷拍| 亚洲一区二区精品视频| 国产欧美日韩一区| 久久综合伊人| 99亚洲精品| 久久人人看视频| 亚洲免费精品| 国产精品天美传媒入口| 久久久欧美精品sm网站| 亚洲精品国精品久久99热一| 午夜一区不卡| 怡红院精品视频在线观看极品| 欧美91大片| 亚洲综合色在线| 欧美xart系列高清| 中文精品视频| 黄色资源网久久资源365| 久久综合色一综合色88| 日韩视频在线一区| 久久久xxx| 一区二区三区国产精品| 国产综合色产| 欧美精品一区二区三区蜜臀| 亚洲你懂的在线视频| 亚洲国产成人久久| 欧美一区在线视频| 亚洲精品久久视频| 国产精品欧美经典| 你懂的成人av| 亚洲午夜激情免费视频| 久久一区二区三区国产精品| 欧美77777| 香蕉久久夜色精品国产使用方法| 国产亚洲精品久久久| 欧美欧美午夜aⅴ在线观看| 亚洲综合不卡| 亚洲国产日韩欧美在线99| 性欧美精品高清| 9l国产精品久久久久麻豆| 国产精品综合不卡av| 狼人社综合社区| 欧美一区三区二区在线观看| 99国产一区| 亚洲国产女人aaa毛片在线| 久久免费视频网站| 欧美中文在线观看| 亚洲欧美日韩精品久久奇米色影视 | 在线精品一区二区| 国产欧美va欧美不卡在线|