Skip to content
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

Update Unity Version to 2021.3 LTS #63

Merged
merged 7 commits into from
Sep 29, 2023
Merged

Update Unity Version to 2021.3 LTS #63

merged 7 commits into from
Sep 29, 2023

Conversation

S20817
Copy link
Contributor

@S20817 S20817 commented Sep 21, 2023

作業概要

  • Unity2023でNovaShaderがエラーが吐くため、使えるように対応しました。
  • Unity2020がLTS対象から外されたため、NovaShaderのUnity Versionを2021.3.30 LTSに上げました。

作業項目

  • 2023からRTHandle対応が必須となっため、その周りの描画API対応をしました
  • 2021でRTHandle周りがまだ不完全のため、互換性を保つ対応をしました。
  • 2021から、冗長となった描画処理を簡潔化しました。
  • バージョンアップと伴うリソースのアップデート

確認

  • 2021、2022、2023それぞれEditorとRuntimeを確認して、問題なく実行できると確認しました。
  • 2020で使えなくなります。

Todo

  • RTHandle対応後に、ScreenDIstortionUVをつける場合、マテリアルGUI描画する時なぜかNullエラーが出てしまいます。原因まだ調査中で、Runtimeに影響しないため、とりあえず応急処置だけをしました。

@S20817 S20817 self-assigned this Sep 21, 2023
if (_applyDistortionShader == null || renderingData.cameraData.cameraType == CameraType.Reflection) return;
if (_applyDistortionShader == null
|| renderingData.cameraData.cameraType == CameraType.Reflection
|| renderingData.cameraData.cameraType == CameraType.Preview)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShaderGUI描画時のcameraTypeがPreviewで、その場合CameraColorTarget中身のRTが空になり、エラーになるので、それの回避判定を追加しました。

@S20817 S20817 marked this pull request as ready for review September 25, 2023 01:02
ConfigureTarget(_renderTargetRTHandle);
#else
ConfigureTarget(_renderTargetIdentifier);
#endif
ConfigureClear(ClearFlag.Color, Color.gray);
Copy link
Contributor

@CyTakayukiKiyohara CyTakayukiKiyohara Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@S20817
シーンの深度バッファをセットしなくなっているため、DISTORTIONの処理で深度テストが効かなくなってしまっています。
DISTORTIONはシーンに設置されている板ポリに遮蔽されている箇所に発生するのが正しい挙動だと思われますが、遮蔽されていなくても、DISTORTIONが起きるようになってしまっています。
添付している動画を参照してください。
(DistortionオブジェクトはMainCameraの下にあるので動かして確認してください。)

Bug-DistortedUvBufferPass.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、失念しました。深度バッファも必要ですね。修正してきます

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

2023-09-26.12.23.14.mov

@@ -41,15 +41,17 @@ public void Setup(RenderTargetIdentifier renderTargetIdentifier)
}
#endif

public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
Copy link
Contributor Author

@S20817 S20817 Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DepthTargetをFeatureを介して設定するよりもカメラから直接取得した方がいいと思うので、ConfigureTargetの処理をConfigureからOnCameraSetupに移動しました。

@S20817 S20817 merged commit 36f6d89 into main Sep 29, 2023
1 check passed
@S20817 S20817 deleted the feature/update2023 branch September 29, 2023 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants