public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { postContext.camera = cam.cam; postContext.command = data.buffer; postContext.bloomBufferNameID = -1; postContext.sourceFormat = RenderTextureFormat.ARGBHalf; var settings = profile.settings; postContext.autoExposureTexture = RuntimeUtilities.whiteTexture; postContext.bloomBufferNameID = -1; RenderTargetIdentifier source, dest; PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); postContext.source = source; postContext.destination = dest; postContext.logHistogram.Generate(postContext); foreach (var i in settings) { PostProcessEffectRenderer renderer; if (allEvents.TryGetValue(i.GetType(), out renderer)) { renderer.SetSettings(i); renderer.Render(postContext); } } ; data.buffer.BlitSRT(source, dest, postContext.uberSheet.material, 0, postContext.uberSheet.properties); if (postContext.bloomBufferNameID > -1) { data.buffer.ReleaseTemporaryRT(postContext.bloomBufferNameID); } }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { CommandBuffer buffer = data.buffer; texComponent.UpdateProperty(cam); SetHistory(cam.cam, buffer, ref texComponent.historyTex, cam.targets.renderTargetIdentifier); RenderTexture historyTex = texComponent.historyTex; //TAA Start const float kMotionAmplification_Blending = 100f * 60f; const float kMotionAmplification_Bounding = 100f * 30f; buffer.SetGlobalFloat(ShaderIDs._Sharpness, sharpness); buffer.SetGlobalVector(ShaderIDs._TemporalClipBounding, new Vector4(stationaryAABBScale, motionAABBScale, kMotionAmplification_Bounding, 0f)); buffer.SetGlobalVector(ShaderIDs._FinalBlendParameters, new Vector4(stationaryBlending, motionBlending, kMotionAmplification_Blending, 0f)); buffer.SetGlobalTexture(ShaderIDs._HistoryTex, historyTex); buffer.SetGlobalTexture(ShaderIDs._LastFrameDepthTexture, prevDepthData.SSR_PrevDepth_RT); buffer.SetGlobalTexture(ShaderIDs._LastFrameMotionVectors, texComponent.historyMV); buffer.SetGlobalMatrix(ShaderIDs._InvLastVp, proper.inverseLastViewProjection); RenderTargetIdentifier source, dest; PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); buffer.BlitSRT(source, dest, ShaderIDs._DepthBufferTexture, taaMat, 0); buffer.CopyTexture(dest, historyTex); buffer.CopyTexture(ShaderIDs._CameraMotionVectorsTexture, texComponent.historyMV); prevDepthData.UpdateCameraSize(new Vector2Int(cam.cam.pixelWidth, cam.cam.pixelHeight)); buffer.CopyTexture(ShaderIDs._CameraDepthTexture, 0, 0, prevDepthData.SSR_PrevDepth_RT, 0, 0); }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { postContext.camera = cam.cam; postContext.command = data.buffer; postContext.sourceFormat = RenderTextureFormat.ARGBHalf; var settings = profile.settings; postContext.autoExposureTexture = RuntimeUtilities.whiteTexture; postContext.bloomBufferNameID = -1; data.buffer.SetGlobalTexture(UnityEngine.Rendering.PostProcessing.ShaderIDs.AutoExposureTex, postContext.autoExposureTexture); int source, dest; PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); foreach (var i in settings) { PostProcessEffectRenderer renderer; if (allEvents.TryGetValue(i.GetType(), out renderer)) { postContext.source = source; postContext.destination = dest; renderer.SetSettings(i); renderer.Render(postContext); } } ; data.buffer.BlitSRT(source, dest, postContext.uberSheet.material, 0, postContext.uberSheet.properties); }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { if (!enabledPost || !cam.postProfile) { data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget); return; } #if UNITY_EDITOR if (!enableInEditor && RenderPipeline.renderingEditor) { data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget); return; } #endif NativeDictionary <ulong, ulong, PtrEqual> allSettings = new NativeDictionary <ulong, ulong, PtrEqual>(allPostEffects.Count, Unity.Collections.Allocator.Temp, new PtrEqual()); foreach (var i in cam.postProfile.settings) { allSettings.Add((ulong)MUnsafeUtility.GetManagedPtr(i.GetType()), (ulong)MUnsafeUtility.GetManagedPtr(i)); } postContext.camera = cam.cam; postContext.command = data.buffer; postContext.sourceFormat = RenderTextureFormat.ARGBHalf; postContext.autoExposureTexture = RuntimeUtilities.whiteTexture; postContext.bloomBufferNameID = -1; RenderTargetIdentifier source, dest; postContext.source = cam.targets.renderTargetIdentifier; postContext.destination = cam.targets.backupIdentifier; postContext.logHistogram.Generate(postContext); cyberGlitch.Render(data.buffer, ref cam.targets); foreach (var i in allPostEffects) { ulong settingsPtr; if (allSettings.Get((ulong)MUnsafeUtility.GetManagedPtr(i.type), out settingsPtr)) { PostProcessEffectSettings setting = MUnsafeUtility.GetObject <PostProcessEffectSettings>((void *)settingsPtr); if (i.needBlit && setting.active) { PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); postContext.source = source; postContext.destination = dest; } i.renderer.SetSettings(setting); i.renderer.Render(postContext); } } ; allSettings.Dispose(); // data.buffer.Blit(ShaderIDs._CameraMotionVectorsTexture, cam.cameraTarget); // data.buffer.BlitSRT(cam.cameraTarget, debugMat, 0); data.buffer.BlitSRT(cam.targets.renderTargetIdentifier, cam.cameraTarget, postContext.uberSheet.material, 0, postContext.uberSheet.properties); if (postContext.bloomBufferNameID > -1) { data.buffer.ReleaseTemporaryRT(postContext.bloomBufferNameID); } }
public void Render(CommandBuffer buffer, ref RenderTargets targets) { if (!enabled) { return; } buffer.SetGlobalConstantBuffer(constantBuffer, _CyberData, 0, sizeof(CyberSetData)); SetValue(); RenderTargetIdentifier source, dest; PipelineFunctions.RunPostProcess(ref targets, out source, out dest); buffer.Blit(source, dest, glitchMat); }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { if (!enabledPost) { data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget); return; } #if UNITY_EDITOR if (!enableInEditor && RenderPipeline.renderingEditor) { data.buffer.Blit(cam.targets.renderTargetIdentifier, cam.cameraTarget); return; } #endif postContext.camera = cam.cam; postContext.command = data.buffer; postContext.sourceFormat = RenderTextureFormat.ARGBHalf; postContext.autoExposureTexture = RuntimeUtilities.whiteTexture; postContext.bloomBufferNameID = -1; RenderTargetIdentifier source, dest; postContext.source = cam.targets.renderTargetIdentifier; postContext.destination = cam.targets.backupIdentifier; postContext.logHistogram.Generate(postContext); foreach (var i in allPostEffects) { PostProcessEffectSettings setting; if (allSettings.TryGetValue(i.type, out setting)) { if (i.needBlit && setting.active) { PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); postContext.source = source; postContext.destination = dest; } i.renderer.SetSettings(setting); i.renderer.Render(postContext); } } ; cyberColor.FrameUpdate(data.buffer); /*HizOcclusionData hizOccData; * hizOccData = IPerCameraData.GetProperty(cam, () => new HizOcclusionData()); * data.buffer.Blit(hizOccData.historyDepth, cam.cameraTarget);*/ //data.buffer.Blit(ShaderIDs._CameraMotionVectorsTexture, cam.cameraTarget); data.buffer.BlitSRT(cam.targets.renderTargetIdentifier, cam.cameraTarget, postContext.uberSheet.material, 0, postContext.uberSheet.properties); if (postContext.bloomBufferNameID > -1) { data.buffer.ReleaseTemporaryRT(postContext.bloomBufferNameID); } }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { RenderTargetIdentifier source, dest; PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); data.buffer.BlitSRT(source, dest, ShaderIDs._DepthBufferTexture, lightingMaterial, 0); data.buffer.BlitSRT(source, dest, ShaderIDs._DepthBufferTexture, lightingMaterial, 1); //Calculate CBDR DirLight(cam, ref data); PointLight(cam, ref data); //Calculate Lighting data.buffer.BlitSRTWithDepth(cam.targets.renderTargetIdentifier, ShaderIDs._DepthBufferTexture, lightingMaterial, 2); LightFilter.Clear(); }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { CommandBuffer buffer = data.buffer; handle.Complete(); kernelBuffer.SetData(kernel); kernel.Dispose(); buffer.SetGlobalFloat(ShaderIDs._SSSScale, SubsurfaceScaler); buffer.SetGlobalBuffer(ShaderIDs._Kernel, kernelBuffer); RenderTargetIdentifier source, dest; PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); buffer.BlitSRT(source, dest, ShaderIDs._DepthBufferTexture, mat, 0); PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); buffer.BlitSRT(source, dest, ShaderIDs._DepthBufferTexture, mat, 1); }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { #if UNITY_EDITOR if (!enableInEditor && RenderPipeline.renderingEditor) { data.buffer.Blit(cam.targets.renderTargetIdentifier, BuiltinRenderTextureType.CameraTarget); return; } #endif postContext.camera = cam.cam; postContext.command = data.buffer; postContext.bloomBufferNameID = -1; postContext.sourceFormat = RenderTextureFormat.ARGBHalf; var settings = profile.settings; postContext.autoExposureTexture = RuntimeUtilities.whiteTexture; postContext.bloomBufferNameID = -1; RenderTargetIdentifier source, dest; postContext.source = cam.targets.renderTargetIdentifier; postContext.destination = cam.targets.backupIdentifier; postContext.logHistogram.Generate(postContext); foreach (var i in settings) { PostEffect ef; if (allEvents.TryGetValue(i.GetType(), out ef)) { if (ef.needBlit && i.active) { PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); postContext.source = source; postContext.destination = dest; } ef.renderer.SetSettings(i); ef.renderer.Render(postContext); } } ; // data.buffer.Blit(cam.targets.renderTargetIdentifier, BuiltinRenderTextureType.CameraTarget); data.buffer.BlitSRT(cam.targets.renderTargetIdentifier, BuiltinRenderTextureType.CameraTarget, postContext.uberSheet.material, 0, postContext.uberSheet.properties); if (postContext.bloomBufferNameID > -1) { data.buffer.ReleaseTemporaryRT(postContext.bloomBufferNameID); } }
public override void FrameUpdate(PipelineCamera cam, ref PipelineCommandData data) { CommandBuffer buffer = data.buffer; HistoryTexture texComponent = IPerCameraData.GetProperty <HistoryTexture>(cam, (c) => new HistoryTexture(c.cam)); texComponent.UpdateProperty(cam); SetHistory(cam.cam, buffer, ref texComponent.historyTex, cam.targets.renderTargetIdentifier); historyTex = texComponent.historyTex; //TAA Start const float kMotionAmplification_Blending = 100f * 60f; const float kMotionAmplification_Bounding = 100f * 30f; buffer.SetGlobalFloat(ShaderIDs._Sharpness, sharpness); buffer.SetGlobalVector(ShaderIDs._TemporalClipBounding, new Vector4(stationaryAABBScale, motionAABBScale, kMotionAmplification_Bounding, 0f)); buffer.SetGlobalVector(ShaderIDs._FinalBlendParameters, new Vector4(stationaryBlending, motionBlending, kMotionAmplification_Blending, 0f)); buffer.SetGlobalTexture(ShaderIDs._HistoryTex, historyTex); int source, dest; PipelineFunctions.RunPostProcess(ref cam.targets, out source, out dest); buffer.BlitSRT(source, dest, taaMat, 0); buffer.CopyTexture(dest, historyTex); }