From 8f5ab546ca5cf1afb10977a4dbcc604ccaed1941 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Thu, 9 Nov 2023 10:35:41 +0200 Subject: [PATCH] Fix #68: any material preview in URP tries to render splats --- package/Runtime/GaussianSplatURPFeature.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/Runtime/GaussianSplatURPFeature.cs b/package/Runtime/GaussianSplatURPFeature.cs index b0cc2c1b..d8fa4871 100644 --- a/package/Runtime/GaussianSplatURPFeature.cs +++ b/package/Runtime/GaussianSplatURPFeature.cs @@ -56,6 +56,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData } GSRenderPass m_Pass; + bool m_HasCamera; public override void Create() { @@ -67,16 +68,20 @@ public override void Create() public override void OnCameraPreCull(ScriptableRenderer renderer, in CameraData cameraData) { + m_HasCamera = false; var system = GaussianSplatRenderSystem.instance; if (!system.GatherSplatsForCamera(cameraData.camera)) return; CommandBuffer cmb = system.InitialClearCmdBuffer(cameraData.camera); m_Pass.m_Cmb = cmb; + m_HasCamera = true; } public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) { + if (!m_HasCamera) + return; m_Pass.m_Renderer = renderer; renderer.EnqueuePass(m_Pass); }