Skip to content

Commit

Permalink
cameraType == Previewの場合、DistortionPassを追加しないように
Browse files Browse the repository at this point in the history
  • Loading branch information
S20817 committed Sep 25, 2023
1 parent f5e5ff7 commit a584a72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 0 additions & 7 deletions Assets/Nova/Runtime/Core/Scripts/ApplyDistortionPass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData
}

#if UNITY_2022_1_OR_NEWER
// todo:後で詳しくGUI周りを調査する
// マテリアルGUI描画時、なぜかここがNullでエラーが出てしまうので、とりあえずNullチェックを入れる
// ランタイム実行に影響がない
if (renderingData.cameraData.renderer.cameraColorTargetHandle.rt == null)
{
return;
}
var source = renderingData.cameraData.renderer.cameraColorTargetHandle.nameID;
#else
var source = renderingData.cameraData.renderer.cameraColorTarget;
Expand Down
5 changes: 4 additions & 1 deletion Assets/Nova/Runtime/Core/Scripts/ScreenSpaceDistortion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public override void Create()

public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
if (_applyDistortionShader == null || renderingData.cameraData.cameraType == CameraType.Reflection) return;
if (_applyDistortionShader == null
|| renderingData.cameraData.cameraType == CameraType.Reflection
|| renderingData.cameraData.cameraType == CameraType.Preview)
return;

var distortedUvBufferFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf)
? RenderTextureFormat.RGHalf
Expand Down

0 comments on commit a584a72

Please sign in to comment.