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, CommandBuffer buffer) { HistoryTexture texComponent = IPerCameraData.GetProperty <HistoryTexture>(cam, GetHistoryTex); texComponent.UpdateProperty(cam); SetHistory(cam.cam, buffer, ref texComponent.historyTex, cam.targets.renderTarget); historyTex = texComponent.historyTex; //TAA Start const float kMotionAmplification_Blending = 100f * 60f; const float kMotionAmplification_Bounding = 100f * 30f; block.SetVector(ShaderIDs._Jitter, jitter); block.SetFloat(ShaderIDs._Sharpness, sharpness); block.SetVector(ShaderIDs._TemporalClipBounding, new Vector4(stationaryAABBScale, motionAABBScale, kMotionAmplification_Bounding, 0f)); block.SetVector(ShaderIDs._FinalBlendParameters, new Vector4(stationaryBlending, motionBlending, kMotionAmplification_Blending, 0f)); block.SetTexture(ShaderIDs._HistoryTex, historyTex); PostFunctions.RunPostProcess(ref cam.targets, buffer, ref data, taaFunction); }
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); }