top of page
Search
krasamira1996

Windows 8.1 App Watch: Stencil



The stencil buffer enables or disables drawing to the rendering target surface on a pixel-by-pixel basis. At its most fundamental level, it enables applications to mask sections of the rendered image so that they are not displayed. Applications often use stencil buffers for special effects such as dissolves, decaling, and outlining.


Stencil buffer information is embedded in the z-buffer data. Your application can use the IDirect3D9::CheckDeviceFormat method to check for hardware stencil support, as shown in the following code example.




Windows 8.1 App Watch: Stencil



IDirect3D9::CheckDeviceFormat allows you to choose a device to create based on the capabilities of that device. In this case, devices that do not support 8-bit stencil buffers are rejected. Note that this is only one possible use for IDirect3D9::CheckDeviceFormat; for details see Determining Hardware Support (Direct3D 9).


Direct3D performs a test on the contents of the stencil buffer on a pixel-by-pixel basis. For each pixel in the target surface, it performs a test using the corresponding value in the stencil buffer, a stencil reference value, and a stencil mask value. If the test passes, Direct3D performs an action. The test is performed using the following steps.


The current pixel is written to the target surface if the stencil test passes, and is ignored otherwise. The default comparison behavior is to write the pixel, no matter how each bitwise operation turns out (D3DCMP_ALWAYS). You can change this behavior by changing the value of the D3DRS_STENCILFUNC render state, passing a member of the D3DCMPFUNC enumerated type to identify the desired comparison function.


Your application can customize the operation of the stencil buffer. It can set the comparison function, the stencil mask, and the stencil reference value. It can also control the action that Direct3D takes when the stencil test passes or fails. For more information, see Stencil Buffer State (Direct3D 9).


DepthEnable and StencilEnable enable (and disable) depth and stencil testing. Set DepthEnable to FALSE to disable depth testing and prevent writing to the depth buffer. Set StencilEnable to FALSE to disable stencil testing and prevent writing to the stencil buffer (when DepthEnable is FALSE and StencilEnable is TRUE, the depth test always passes in the stencil operation).


An array of render-target views may be passed into ID3D11DeviceContext::OMSetRenderTargets, however all of those render-target views will correspond to a single depth stencil view. The render target array in Direct3D 11 is a feature that enables an application to render onto multiple render targets simultaneously at the primitive level. Render target arrays offer increased performance over individually setting render targets with multiple calls to ID3D11DeviceContext::OMSetRenderTargets (essentially the method employed in Direct3D 9).


Your application can use the stencil buffer to composite 2D or 3D images onto a 3D scene. A mask in the stencil buffer is used to occlude an area of the rendering target surface. Stored 2D information, such as text or bitmaps, can then be written to the occluded area. Alternately, your application can render additional 3D primitives to the stencil-masked region of the rendering target surface. It can even render an entire scene.


To solve this problem, use a stencil to mask the section of the back primitive where the decal will appear. Turn off z-buffering and render the image of the front primitive into the masked-off area of the render-target surface.


If your application does two render passes - one to generate the stencil mask and second to apply the stencil mask to the image, but with the primitives slightly smaller on the second pass - the resulting image will contain only the primitive's outline. The application can then fill the stencil-masked area of the image with a solid color, giving the primitive an embossed look.


If the stencil mask is the same size and shape as the primitive you are rendering, the resulting image contains a hole where the primitive should be. Your application can then fill the hole with black to produce a silhouette of the primitive.


Shadow Volumes are used for drawing shadows with the stencil buffer. The application computes the shadow volumes cast by occluding geometry, by computing the silhouette edges and extruding them away from the light into a set of 3D volumes. These volumes are then rendered twice into the stencil buffer.


The first render draws forward-facing polygons, and increments the stencil-buffer values. The second render draws the back-facing polygons of the shadow volume, and decrements the stencil buffer values. Normally, all incremented and decremented values cancel each other out. However, the scene was already rendered with normal geometry causing some pixels to fail the z-buffer test as the shadow volume is rendered. Values left in the stencil buffer correspond to pixels that are in the shadow. These remaining stencil-buffer contents are used as a mask, to alpha-blend a large, all-encompassing black quad into the scene. With the stencil buffer acting as a mask, the result is to darken pixels that are in the shadows.


This means that the shadow geometry is drawn twice per light source, hence putting pressure on the vertex throughput of the GPU. The two-sided stencil feature has been designed to mitigate this situation. In this approach, there are two sets of stencil state (named below), one set each for the front-facing triangles and the other for the back-facing triangles. This way, only a single pass is drawn per shadow volume, per light.


An inactive depth-stencil buffer can be read by a shader as a texture. An application that reads a depth-stencil buffer as a texture renders in two passes, the first pass writes to the depth-stencil buffer and the second pass reads from the buffer. This allows a shader to compare depth or stencil values previously written to the buffer against the value for the pixel currrently being rendered. The result of the comparison can be used to create effects such as shadow mapping or soft particles in a particle system.


In addition a shader resource view needs to be created for the depth buffer using a D3D11_SHADER_RESOURCE_VIEW_DESC structure and ID3D11Device::CreateShaderResourceView. The shader resource view will use a typed format such as DXGI_FORMAT_R32_FLOAT that is the equivalent to the typeless format specified when the depth-stencil resource was created.


In the second render pass the ID3D11DeviceContext::OMSetRenderTargets function is used to set the depth-stencil view to NULL or a different depth-stencil resource and the shader resource view is passed to the shader using ID3D11EffectShaderResourceVariable::SetResource. This allows the shader to look up the depth values calculated in the first rendering pass. Note that a transformation will need to be applied to retrieve depth values if the point of view of the first render pass is different from the second render pass. For example, if a shadow mapping technique is being used the first render pass will be from the perspective of a light source while the second render pass will from the viewer's perspective.


Please read through the Getting Started document before proceeding. After downloading the stencils, please review the included instructions to get the most out of your Visio experience. For information on working with the New Visio Methodology, review these instructions.


To manage OS patches and software updates with instant clones, you use the push-image operation. Because the provisioning of instant clones takes so little time, it is not necessary to plan for maintenance windows.


Stencil automatically turns any image you can find, make or take into a custom template in seconds. Simply find or capture a photo, set the contrast or invert, and transform it into a stencil that is forever at your disposal.


Apparently, I was enjoying my birthday too much to notice that Microsoft released the New Office Visio Stencils. This stencil contains more than 300 icons to help you create visual representations of Microsoft Office or Microsoft Office 365 deployments including Microsoft Exchange Server 2013, Microsoft Lync Server 2013, and Microsoft SharePoint Server 2013.


The tools palette is great, very easy to read and find what you need with the icon and a short description. The tips under the tools is very helpful, especially for new users with a description and how to use the tools on that palette.Love the new look of the Sketchbook. So clean and easy to see the blocks and quilts. The ability to resize the Sketchbook windows is wonderful.The new feature that calculates how many fat quarters required to make a quilt in the yardage calculation makes it so easy to use fat quarter collections or even small amounts of fabric in my stash.Same wonderful program with a fresh new look and some added features. Easier to use and learn.


Direct3D is a graphics application programming interface (API) for Microsoft Windows. Part of DirectX, Direct3D is used to render three-dimensional graphics in applications where performance is important, such as games. Direct3D uses hardware acceleration if it is available on the graphics card, allowing for hardware acceleration of the entire 3D rendering pipeline or even only partial acceleration. Direct3D exposes the advanced graphics capabilities of 3D graphics hardware, including Z-buffering,[1] W-buffering,[2] stencil buffering, spatial anti-aliasing, alpha blending, color blending, mipmapping, texture blending,[3][4] clipping, culling, atmospheric effects, perspective-correct texture mapping, programmable HLSL shaders[5] and effects.[6] Integration with other DirectX technologies enables Direct3D to deliver such features as video mapping, hardware 3D rendering in 2D overlay planes, and even sprites, providing the use of 2D and 3D graphics in interactive media ties. 2ff7e9595c


0 views0 comments

Recent Posts

See All

Baixe o apk do Snaptube 2023

Como baixar vídeos do YouTube em 2023: um guia completo O YouTube é a plataforma de compartilhamento de vídeo mais popular do mundo, com...

Comments


bottom of page