Two-sided stencil testing system and method

Computer graphics processing and selective visual display system – Computer graphics processing – Attributes

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C345S612000

Reexamination Certificate

active

06778189

ABSTRACT:

FIELD OF THE INVENTION
The present invention relates to computer graphics processing, and more particularly to stencil testing.
BACKGROUND OF THE INVENTION
A major objective in graphics rendering is to produce images that are so realistic that the observer believes the image is real. A fundamental difficulty in achieving total visual realism is the complexity of accurately representing real world visual effects. A scene can include a wide variety of textures, subtle color gradations, reflections, translucency, etc.
One important way to make images more realistic is to determine how objects in a scene cast shadows and then represent these shadows in the rendered image. Shadows enhance the realism of an image because they give a two-dimensional image a three-dimensional feel.
The addition of shadows to the rendering of a complex model can greatly enhance the understanding of that model's geometry. The human visual system uses shadows as a cue for depth and shape. Consequently, shadows are very useful for conveying the three dimensional nature of rendered objects and for adding realism to computer generated scenes.
Prior art
FIG. 1
illustrates a scene
100
where shadowing is needed during processing in a graphics pipeline. As shown in
FIG. 1
, a particular scene
100
includes a light source
104
, a light obstructing surface
102
, and a plurality of objects
106
. Due to the relative orientation of the light source
104
, objects
106
and surface
102
, a shadow should be shown on certain objects
106
where the surface
102
obstructs light from the light source
104
.
The utilization of shadow volumes is a technique by which a graphics pipeline may determine which objects
106
in the scene
100
should be rendered with a shadow. In particular, a shadow bit is maintained for each pixel in a frame buffer which indicates whether the objects
106
are in or out of the shadow projected by the surface
102
.
Since the shadow volume technique takes place in a frame buffer of a graphics pipeline, it may be referred to as an image space algorithm. While shadowing may be trivial in a scene with one obstructing surface
102
, rendering may be complicated when multiple overlapping obstructing surfaces
102
exist.
Prior art
FIG. 2
illustrates a scene
200
where shadowing is complicated by the involvement of multiple intersecting overlapping surfaces
102
. In such more complex environments, a technique of “counting” is employed. As shown in Prior art
FIG. 2
, a plurality of obstructing surfaces
102
cast a plurality of shadow volumes each defined by a plurality of boundary primitives
202
.
Such boundary primitives
202
are either front-facing or back-facing with respect to how they are viewed. In the context of the present description, a primitive is front-facing or back-facing based on whether the area of the primitive in screen space is positive or negative, or the ordering of vertices of the primitive is clockwise or counterclockwise. Note Prior art
FIG. 2
where front-facing and back-facing primitives are designated with an “F” and “B,” respectively.
Prior art
FIG. 3
illustrates a method
300
for counting shadow volumes, in accordance with the prior art. Initially, in operation
302
, a depth buffer and a stencil buffer are cleared after which the scene
200
is rendered with the light source
102
disabled during a first rendering pass. Once this pass is rendered, the color of all pixels in the frame buffer is as if every pixel were in shadow with respect to the light. Note operation
304
. It should, be noted that such operation affords a depth state of a closest object in the scene
200
.
Next, in operation
306
, primitives constituting the geometry of the scene's shadow volumes are drawn in the scene
200
during a second rendering pass. During the second pass, no color depth buffer writes take place in order to prevent disturbing results of the first rendering pass. Further, any back-facing shadow volume primitives are culled. For the remaining front-facing primitives, a per-pixel stencil value is incremented for each boundary between an eye position
206
and a subject object
204
. This is accomplished by incrementing the per-pixel stencil value whenever the depth test passes. Since there are three front-facing primitive boundaries, such stencil value has the value of +3 after operation
306
.
Next, in operation
308
, shadow volume primitives are again drawn in the scene during a third rendering pass. Similar to the second pass, no color depth buffer writes take place in order to prevent disturbing results of the previous rendering passes. In operation
308
, any front-facing primitives are culled. For the remaining back-facing primitives, a per-pixel stencil value is decremented for each boundary between the eye position
206
and the subject object
204
. This is accomplished by decrementing the per-pixel stencil value whenever the depth test passes. Since there are three back-facing primitive boundaries, such stencil value has the value of “0” after operation
306
.
The scene may then be rendered again during a fourth rendering pass in operation
310
. During the fourth rendering pass, the light source
102
is enabled. Color writes are re-enabled for this rendering pass. Moreover, pixels are only updated if it is determined that the pixel is outside a shadow volume, as indicated by the stencil value being equal to “0.” In the case of object
204
of Prior art
FIG. 2
, such associated pixels would be updated to show light. However, in the case of object
206
, no light would be shown since the stencil value would be +2 so the stencil test fails which leaves the pixel unchanged from the initial shadowed rendering pass, etc.
One problem that results from the method
300
of Prior art
FIG. 3
stems from the fact that the shadow volumes must be rendered twice during operations
306
and
308
. The requirement that these rendering passes be separate operations
306
and
308
is prompted by the fact that traditional stencil value testing can not distinguish between front-facing and back-facing primitives. As such, the front-facing and back-facing primitives must be handled separately, in different rendering passes. This results in an efficiency problem that causes lower performance during graphics processing.
DISCLOSURE OF THE INVENTION
A system, method and computer program product are provided for two-sided stencil testing during graphics processing. Initially, primitives are received to be processed in a graphics processing pipeline. In use, it is then determined whether the graphics processing pipeline is operating with same-sided stencil testing enabled.
If same-sided stencil testing is not enabled, the primitives are passed without same-sided stencil testing and without two-sided stencil testing. If, on other hand, same-sided stencil testing is enabled, it is determined whether the graphics processing pipeline is operating with two-sided stencil testing enabled.
If the two-sided stencil testing is enabled and the same-sided stencil testing is enabled, two-sided stencil testing is performed on the primitives. If, on the other hand, the two-sided stencil testing is disabled and the same-sided stencil testing is enabled, same-sided stencil testing is performed on the primitives.
In one embodiment, the two-sided stencil testing may include determining whether the primitives are front-facing primitives or back-facing primitives. Further, stencil testing may be performed on the front-facing primitives utilizing a front set of stencil states. In a similar manner, the stencil testing may be performed on the back-facing primitives utilizing a back set of stencil states.
As an option, the front-facing primitives and back-facing primitives may include front-facing polygon primitives and back-facing polygon primitives, respectively. The front-facing primitives may also include front-facing non-polygon primitives. Moreover, the front-facing non-polygon primitives may include points, lines, bitmaps, and:image rectangles.
In one aspect of the pres

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Two-sided stencil testing system and method does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Two-sided stencil testing system and method, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Two-sided stencil testing system and method will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3274005

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.