Skip to content

Commit 0b71f0d

Browse files
authored
Bugfix: Check if intensity zero and and if so skip the distortion pass entirely (#72)
1 parent 8cf0949 commit 0b71f0d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

com.unity.perception/Runtime/GroundTruth/LensDistortionCrossPipelinePass.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,14 @@ public bool SetLensDistortionShaderParameters()
130130
if(targetCamera == null)
131131
return false;
132132

133-
if(targetCamera.GetUniversalAdditionalCameraData().renderPostProcessing == false && lensDistortionOverride.HasValue == false)
133+
var UACD = targetCamera.GetUniversalAdditionalCameraData();
134+
135+
if(UACD.renderPostProcessing == false && lensDistortionOverride.HasValue == false)
136+
return false;
137+
138+
if (m_lensDistortion.active == false)
134139
return false;
140+
135141
#else
136142
return false;
137143
#endif
@@ -153,6 +159,10 @@ public bool SetLensDistortionShaderParameters()
153159
mult.y = Mathf.Max(m_lensDistortion.yMultiplier.value, 1e-4f);
154160
scale = 1.0f / m_lensDistortion.scale.value;
155161
}
162+
else
163+
{
164+
return false;
165+
}
156166
}
157167

158168
float amount = 1.6f * Mathf.Max(Mathf.Abs(intensity * 100.0f), 1.0f);

0 commit comments

Comments
 (0)