Example #1
0
        /// <summary>
        /// Renders outline. Do not use if not sure.
        /// </summary>
        public void RenderOutline(IOutlineSettings settings)
        {
            var mat   = _resources.OutlineMaterial;
            var props = _resources.GetProperties(settings);

            //_commandBuffer.SetSinglePassStereo(SinglePassStereoMode.Instancing);
            _commandBuffer.SetGlobalFloatArray(_resources.GaussSamplesId, _resources.GetGaussSamples(settings.OutlineWidth));

            if (_rtDimention == TextureDimension.Tex2DArray)
            {
                // HPass
                _commandBuffer.SetRenderTarget(_resources.TempTex, 0, CubemapFace.Unknown, -1);
                Blit(_resources.MaskTex, OutlineResources.OutlineShaderHPassId, mat, props);

                // VPassBlend
                _commandBuffer.SetRenderTarget(_rt, 0, CubemapFace.Unknown, -1);
                Blit(_resources.TempTex, OutlineResources.OutlineShaderVPassId, mat, props);
            }
            else
            {
                // HPass
                _commandBuffer.SetRenderTarget(_resources.TempTex, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store);
                Blit(_resources.MaskTex, OutlineResources.OutlineShaderHPassId, mat, props);

                // VPassBlend
                _commandBuffer.SetRenderTarget(_rt, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store);
                Blit(_resources.TempTex, OutlineResources.OutlineShaderVPassId, mat, props);
            }
        }
        private void RenderOutline(IOutlineSettings settings)
        {
            var mat   = _resources.OutlineMaterial;
            var props = _resources.GetProperties(settings);

            _commandBuffer.SetGlobalFloatArray(_resources.GaussSamplesId, _resources.GetGaussSamples(settings.OutlineWidth));

            // HPass
            _commandBuffer.SetRenderTarget(_hPassRtId, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store);
            Blit(_commandBuffer, _maskRtId, _resources, _hPassId, mat, props);

            // VPassBlend
            _commandBuffer.SetRenderTarget(_rt, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store);
            Blit(_commandBuffer, _hPassRtId, _resources, _vPassId, mat, props);
        }