Graphics Reference
In-Depth Information
bsDesc.RenderTarget[0].AlphaBlendOperation =
BlendOperation.Add;
bsDesc.RenderTarget[0].SourceAlphaBlend = BlendOption.One;
bsDesc.RenderTarget[0].DestinationAlphaBlend =
BlendOption.One;
bsDesc.RenderTarget[0].BlendOperation = BlendOperation.Add;
bsDesc.RenderTarget[0].SourceBlend = BlendOption.One;
bsDesc.RenderTarget[0].DestinationBlend = BlendOption.One;
bsDesc.RenderTarget[0].RenderTargetWriteMask =
ColorWriteMaskFlags.All;
blendStateAdd = ToDispose(new BlendState(device, bsDesc));
As more lights overlap, it is quite possible for the accumulated
light value to exceed the maximum 1.0f supported by a UNorm
format. In order to support High Dynamic Range (HDR), a larger
bits-per-element format is required, and if you continue using a
UNorm format, scaling will also be necessary.
14. Next, we have our rasterizer states. These are required so that we can easily control
whether it is the front face or back face of the light volume that will be culled.
// Initialize rasterizer states
RasterizerStateDescription rsDesc = new
RasterizerStateDescription();
rsDesc.FillMode = FillMode.Solid;
rsDesc.CullMode = CullMode.Back;
rsCullBack = ToDispose(new RasterizerState(device, rsDesc));
rsDesc.CullMode = CullMode.Front;
rsCullFront = ToDispose(new RasterizerState(device, rsDesc));
15. We now need to create three depth stencil states.
// Initialize depth state
var dsDesc = new DepthStencilStateDescription();
dsDesc.IsStencilEnabled = false;
dsDesc.IsDepthEnabled = true;
// Less-than depth comparison
dsDesc.DepthComparison = Comparison.Less;
depthLessThan = ToDispose(new DepthStencilState(device, dsDesc));
// Greater-than depth comparison
dsDesc.DepthComparison = Comparison.Greater;
depthGreaterThan = ToDispose(new DepthStencilState(device,
dsDesc));
// Depth testing disabled
dsDesc.IsDepthEnabled = false;
depthDisabled = ToDispose(new DepthStencilState(device,
dsDesc));
 
Search WWH ::




Custom Search