|
|
|
|
|
|
public Camera camera; |
|
|
|
public uint taaFrameIndex; |
|
|
|
public Vector2 taaFrameRotation; |
|
|
|
public Vector4 depthBufferParam; |
|
|
|
public Vector4 depthBufferParams; |
|
|
|
|
|
|
|
public PostProcessRenderContext postprocessRenderContext; |
|
|
|
|
|
|
|
|
|
|
public bool isFirstFrame { get; private set; } |
|
|
|
|
|
|
|
// Ref: An Efficient Depth Linearization Method for Oblique View Frustums, Eq. 6.
|
|
|
|
// TODO: pass this as "_DepthBufferParam" if the projection matrix is oblique.
|
|
|
|
// TODO: pass this as "_DepthBufferParams" if the projection matrix is oblique.
|
|
|
|
public Vector4 invProjParam |
|
|
|
{ |
|
|
|
get |
|
|
|
|
|
|
// http://www.humus.name/temp/Linearize%20depth.txt
|
|
|
|
if (reverseZ) |
|
|
|
{ |
|
|
|
depthBufferParam = new Vector4(-1 + f/n, 1, -1/f + 1/n, 1/f); |
|
|
|
depthBufferParams = new Vector4(-1 + f/n, 1, -1/f + 1/n, 1/f); |
|
|
|
depthBufferParam = new Vector4(1 - f/n, f/n, 1/f - 1/n, 1/n); |
|
|
|
depthBufferParams = new Vector4(1 - f/n, f/n, 1/f - 1/n, 1/n); |
|
|
|
} |
|
|
|
|
|
|
|
frustum = Frustum.Create(viewProjMatrix, depth_0_1, reverseZ); |
|
|
|
|
|
|
cmd.SetGlobalFloat( HDShaderIDs._DetViewMatrix, detViewMatrix); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._ScreenSize, screenSize); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._ScreenToTargetScale, scaleBias); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._DepthBufferParam, depthBufferParam); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._DepthBufferParams, depthBufferParams); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._InvProjParam, invProjParam); |
|
|
|
cmd.SetGlobalVector(HDShaderIDs._TaaFrameRotation, taaFrameRotation); |
|
|
|
cmd.SetGlobalVectorArray(HDShaderIDs._FrustumPlanes, frustumPlaneEquations); |
|
|
|