protected override void Init(PipelineResources res)
        {
            uberBlock       = new MaterialPropertyBlock();
            finalizerAction = null;
            renderAction    = null;
            PostFunctions.InitSharedData(ref sharedData, resources);
            uberAction = (ref PipelineCommandData data, CommandBuffer buffer, RenderTexture source, RenderTexture dest) =>
            {
                buffer.SetRenderTarget(dest);
                buffer.BlitSRT(uberBlock, source, dest, sharedData.uberMaterial, 0);
            };
            var settingList = profile.settings;

            foreach (var i in settingList)
            {
                allSettings.Add(i.GetType(), i);
            }
            PostProcessEffectSettings currentSetting;

            if (allSettings.TryGetValue(typeof(ColorGrading), out currentSetting))
            {
                ColorGradingFunction.InitializeColorGrading(currentSetting as ColorGrading, ref colorGradingData, resources.computeShaders.lut3DBaker);
                finalizerAction += () => ColorGradingFunction.Finalize(ref colorGradingData, sharedData.uberMaterial);
                renderAction    += (ref PipelineCommandData useless) => ColorGradingFunction.PrepareRender(ref colorGradingData, ref sharedData);
            }
        }
 protected override void Init(PipelineResources resources)
 {
     taaMat      = new Material(resources.taaShader);
     taaFunction = (ref PipelineCommandData data, CommandBuffer buffer, RenderTargetIdentifier source, RenderTargetIdentifier dest) =>
     {
         buffer.BlitSRT(source, dest, taaMat, 0);
         buffer.CopyTexture(dest, historyTex);
     };
 }
示例#3
0
 protected override void Init(PipelineResources resources)
 {
     block       = new MaterialPropertyBlock();
     taaMat      = new Material(resources.taaShader);
     taaFunction = (ref PipelineCommandData data, CommandBuffer buffer, RenderTexture source, RenderTexture dest) =>
     {
         buffer.BlitSRT(block, source, dest, taaMat, 0);
         buffer.Blit(dest, historyTex);
     };
 }
示例#4
0
        public void ProcessAction(PostProcessAction action, Model model, Technique technique, IEntity entity)
        {
            var tDesc = GetTextureDescription((int)(width * action.Scale), (int)(height * action.Scale));

            commands.Add(new PostProcessCommand(services, technique, model.Meshes[0],
                                                entity, tDesc, action.OutputRule)
            {
                Name = action.Technique
            });
        }
示例#5
0
        public void Run(object input)
        {
            if (ProcessFunction == null)
            {
                throw new NotImplementedException("The ProcessFunction delegate must be implemented!");
            }
            PreProcessAction?.Invoke();
            DateTime initialTime = DateTime.Now;

            _result = ProcessFunction(input);
            DateTime endingTime = DateTime.Now;

            _elapsedTime = endingTime - initialTime;
            PostProcessAction?.Invoke();
        }
示例#6
0
 public void ProcessAction(PostProcessAction action, IEnumerable <Command> sceneCommands, string filter)
 {
     if (action.AssetName == Param.Engine)
     {
         switch (action.Technique)
         {
         case Param.EngineActions.RenderSceneToTexture:
             var filteredCommands = String.IsNullOrEmpty(filter) ? sceneCommands : FilterCommands(sceneCommands, filter);
             var tDesc            = GetTextureDescription((int)(width * action.Scale), (int)(height * action.Scale));
             var command          = new RenderSceneToTextureCommand(services, filteredCommands, tDesc);
             commands.Add(command);
             break;
         }
     }
 }
        public static void RunPostProcess(ref RenderTargets targets, CommandBuffer buffer, ref PipelineCommandData data, PostProcessAction renderFunc)
        {
            renderFunc(ref data, buffer, targets.renderTargetIdentifier, targets.backupIdentifier);
            RenderTargetIdentifier back = targets.backupIdentifier;

            targets.backupIdentifier       = targets.renderTargetIdentifier;
            targets.renderTargetIdentifier = back;
        }
        public static void RunPostProcess(ref RenderTargets targets, CommandBuffer buffer, ref PipelineCommandData data, PostProcessAction renderFunc)
        {
            RenderTexture source = targets.renderTarget;
            RenderTexture dest   = targets.backupTarget;

            renderFunc(ref data, buffer, source, dest);
            targets.renderTarget = dest;
            targets.backupTarget = source;
            RenderTargetIdentifier back = targets.backupIdentifier;

            targets.backupIdentifier       = targets.renderTargetIdentifier;
            targets.renderTargetIdentifier = back;
        }