public override void PreRenderFrame(PipelineCamera cam, ref PipelineCommandData data) { texComponent = IPerCameraData.GetProperty(cam, (c) => new HistoryTexture(c.cam)); prevDepthData = IPerCameraData.GetProperty(cam, (cc) => new PreviousDepthData(new Vector2Int(cc.cam.pixelWidth, cc.cam.pixelHeight))); prevDepthData.targetObject = this; data.buffer.SetGlobalVector(ShaderIDs._LastJitter, texComponent.jitter); cam.cam.ResetProjectionMatrix(); ConfigureJitteredProjectionMatrix(cam.cam, ref texComponent.jitter); data.buffer.SetGlobalVector(ShaderIDs._Jitter, texComponent.jitter); }
public override void PreRenderFrame(PipelineCamera cam, ref PipelineCommandData data) { HistoryTexture.GetHistoryTexture getHis = new HistoryTexture.GetHistoryTexture { cam = cam.cam }; texComponent = IPerCameraData.GetProperty <HistoryTexture, HistoryTexture.GetHistoryTexture>(cam, getHis); PreviousDepthData.GetPreviousDepthData getDepthData = new PreviousDepthData.GetPreviousDepthData { currentSize = new Vector2Int(cam.cam.pixelWidth, cam.cam.pixelHeight) }; prevDepthData = IPerCameraData.GetProperty <PreviousDepthData, PreviousDepthData.GetPreviousDepthData>(cam, getDepthData); prevDepthData.targetObject = this; data.buffer.SetGlobalVector(ShaderIDs._LastJitter, texComponent.jitter); cam.cam.ResetProjectionMatrix(); ConfigureJitteredProjectionMatrix(cam.cam, ref texComponent.jitter); data.buffer.SetGlobalVector(ShaderIDs._Jitter, texComponent.jitter); }
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); }