Skip to content

Add comments around transparent motion vector - camera only #6827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,9 @@ unsafe internal void UpdateShaderVariablesGlobalCB(ref ShaderVariablesGlobal cb,

cb._DeExposureMultiplier = m_AdditionalCameraData == null ? 1.0f : m_AdditionalCameraData.deExposureMultiplier;

// IMPORTANT NOTE: This checks if we have Movec and not Transparent Motion Vectors because in that case we need to write camera motion vectors
// for transparent objects, otherwise the transparent objects will look completely broken upon motion if Transparent Motion Vectors is off.
// If TransparentsWriteMotionVector the camera motion vectors are baked into the per object motion vectors.
cb._TransparentCameraOnlyMotionVectors = (frameSettings.IsEnabled(FrameSettingsField.MotionVectors) &&
!frameSettings.IsEnabled(FrameSettingsField.TransparentsWriteMotionVector)) ? 1 : 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2671,7 +2671,9 @@ public Texture2D ExportSkyToTexture(Camera camera)

static bool NeedMotionVectorForTransparent(FrameSettings frameSettings)
{
return frameSettings.IsEnabled(FrameSettingsField.TransparentsWriteMotionVector);
// IMPORTANT NOTE: This is not checking for Transparent Motion Vectors because we need to explicitly write camera motion vectors
// for transparent objects too, otherwise the transparent objects will look completely broken upon motion if Transparent Motion Vectors is off.
return frameSettings.IsEnabled(FrameSettingsField.MotionVectors);
}

/// <summary>
Expand Down