public StencilLightRenderer(int renderOrder, int renderLayer, RenderTexture renderTexture) : base(renderOrder, null) { RenderLayer = renderLayer; RenderTexture = renderTexture; _primitiveBatch = new PrimitiveBatch(); // create our material used for texture lights that only writes where the stencil is 0 and is additive Material = Material.StencilRead(0); Material.BlendState = new BlendState { ColorSourceBlend = Blend.SourceAlpha, ColorDestinationBlend = Blend.One, AlphaSourceBlend = Blend.SourceAlpha, AlphaDestinationBlend = Blend.One }; // create our stencil for writing our occluders, only writing to the stencil buffer _depthStencilState = new DepthStencilState { StencilEnable = true, StencilFunction = CompareFunction.Always, StencilPass = StencilOperation.Replace, ReferenceStencil = 1, DepthBufferEnable = false, }; _stencilOnlyBlendState = new BlendState { ColorWriteChannels = ColorWriteChannels.None }; }
public StencilLightRenderer(int renderOrder, int renderLayer) : base(renderOrder, null) { RenderLayer = renderLayer; _primitiveBatch = new PrimitiveBatch(); Material = Material.StencilRead(0); Material.BlendState = new BlendState { ColorSourceBlend = Blend.SourceAlpha, ColorDestinationBlend = Blend.One, AlphaSourceBlend = Blend.SourceAlpha, AlphaDestinationBlend = Blend.One }; _depthStencilState = new DepthStencilState { StencilEnable = true, StencilFunction = CompareFunction.Always, StencilPass = StencilOperation.Replace, ReferenceStencil = 1, DepthBufferEnable = false, }; _stencilOnlyBlendState = new BlendState { ColorWriteChannels = ColorWriteChannels.None }; }