浏览代码

Fix issue with depth offset and velocity pass

/main
sebastienlagarde 7 年前
当前提交
52efe7dd
共有 1 个文件被更改,包括 16 次插入9 次删除
  1. 25
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassVelocity.hlsl

25
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassVelocity.hlsl


#endif // TESSELLATION_ON
float4 Frag(PackedVaryingsToPS packedInput) : SV_Target
void Frag( PackedVaryingsToPS packedInput,
out float4 outColor : SV_Target0
#ifdef _DEPTHOFFSET_ON
, out float outputDepth : SV_Depth
#endif
)
// Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled
bool forceNoMotion = unity_MotionVectorsParams.y == 0.0;
if (forceNoMotion)
return float4(0.0, 0.0, 0.0, 0.0);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
// input.positionSS is SV_Position

// TODO: How to allow overriden velocity vector from GetSurfaceAndBuiltinData ?
float2 velocity = CalculateVelocity(inputPass.positionCS, inputPass.previousPositionCS);
float4 outBuffer;
EncodeVelocity(velocity, outBuffer);
return outBuffer;
EncodeVelocity(velocity, outColor);
// Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled
bool forceNoMotion = unity_MotionVectorsParams.y == 0.0;
if (forceNoMotion)
outColor = float4(0.0, 0.0, 0.0, 0.0);
#ifdef _DEPTHOFFSET_ON
outputDepth = posInput.deviceDepth;
#endif
}
正在加载...
取消
保存