Beispiel #1
0
    void OnPreRender()
    {
        if (hbaoShader == null || _hbaoCamera == null)
        {
            return;
        }

        _hbaoCamera.depthTextureMode |= DepthTextureMode.Depth;
        if (aoSettings.perPixelNormals == PerPixelNormals.Camera)
        {
            _hbaoCamera.depthTextureMode |= DepthTextureMode.DepthNormals;
        }

        CheckParameters();
        UpdateShaderProperties(2);
        UpdateShaderKeywords();

        bool prepareCommandBuffer = false;

        if (_integrationStage != generalSettings.integrationStage || _resolution != generalSettings.resolution || _displayMode != generalSettings.displayMode ||
            _renderingPath != _renderTarget.renderingPath || _hdr != _renderTarget.hdr || _width != _renderTarget.fullWidth || _height != _renderTarget.fullHeight ||
            _aoQuality != generalSettings.quality || _deinterleaving != generalSettings.deinterleaving || _useMultiBounce != aoSettings.useMultiBounce ||
            _colorBleedingEnabled != colorBleedingSettings.enabled || _blurAmount != blurSettings.amount)
        {
            _integrationStage = generalSettings.integrationStage;
            _resolution       = generalSettings.resolution;
            _displayMode      = generalSettings.displayMode;
            _renderingPath    = _renderTarget.renderingPath;
            _hdr                  = _renderTarget.hdr;
            _width                = _renderTarget.fullWidth;
            _height               = _renderTarget.fullHeight;
            _aoQuality            = generalSettings.quality;
            _deinterleaving       = generalSettings.deinterleaving;
            _useMultiBounce       = aoSettings.useMultiBounce;
            _colorBleedingEnabled = colorBleedingSettings.enabled;
            _blurAmount           = blurSettings.amount;

            prepareCommandBuffer = true;
            //Debug.Log("Should prepare command buffer!");
        }

        if (prepareCommandBuffer || _prepareInitialCommandBuffer)
        {
            ClearCommandBuffer();

            var cameraEvent = GetCameraEvent();
            if (generalSettings.deinterleaving == Deinterleaving._2x)
            {
                PrepareCommandBufferHBAODeinterleaved2x(cameraEvent);
            }
            else if (generalSettings.deinterleaving == Deinterleaving._4x)
            {
                PrepareCommandBufferHBAODeinterleaved4x(cameraEvent);
            }
            else
            {
                PrepareCommandBufferHBAO(cameraEvent);
            }

            _hbaoCamera.AddCommandBuffer(cameraEvent, _hbaoCommandBuffer);

            _prepareInitialCommandBuffer = false;
        }
    }
Beispiel #2
0
 public void SetDeinterleaving(Deinterleaving deinterleaving)
 {
     this.deinterleaving.Override(deinterleaving);
 }