Beispiel #1
0
    void ApplyBloom(CommandBuffer _cmd, RenderTargetIdentifier _src)
    {
        int width  = Screen.width;
        int height = Screen.height;

        for (int i = 0; i < MAX_BLOOM_BUFFER_SIZE; ++i)
        {
            width  >>= 1;
            height >>= 1;

            _cmd.GetTemporaryRT(BloomBufferIDs[i], width, height, 0, FilterMode.Bilinear, RenderTextureFormat.DefaultHDR);
        }

        _cmd.Blit(_src, BloomBufferIDs[0], matBloom, 0);

        for (int i = 1; i < MAX_BLOOM_BUFFER_SIZE; ++i)
        {
            CmdBuff.Blit(BloomBufferIDs[0], BloomBufferIDs[i], matBloom, 1);
        }

        for (int i = MAX_BLOOM_BUFFER_SIZE - 1; 0 < i; --i)
        {
            CmdBuff.Blit(BloomBufferIDs[i], BloomBufferIDs[i - 1], matBloom, 2);
        }

        CmdBuff.Blit(BloomBufferIDs[0], _src, matBloom, 3);

        for (int i = 0; i < MAX_BLOOM_BUFFER_SIZE; ++i)
        {
            _cmd.ReleaseTemporaryRT(BloomBufferIDs[i]);
        }
    }
Beispiel #2
0
 void Flip(ScriptableRenderContext context, Camera camera)
 {
     //if (camera.cameraType == CameraType.Game)
     {
         ApplyBloom(CmdBuff, renderBuffers[0]);
         ApplyToneMapping(CmdBuff, renderBuffers[0], renderBuffers[1]);
         ApplyFXAA(CmdBuff, renderBuffers[1], renderBuffers[0]);
         CmdBuff.Blit(renderBuffers[0], BuiltinRenderTextureType.CameraTarget);
     }
 }