From dd334465c2ec8d7d154d0fc0f2ec2fd20d0b9f74 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Mon, 26 Apr 2021 16:33:14 +0200 Subject: [PATCH 1/5] Skip adding the LOD's renderer to the checked renderer if it's null --- .../Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs index 1a32a5ae97e..7cf13638ddf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs @@ -492,6 +492,7 @@ internal void BuildRayTracingAccelerationStructure(HDCamera hdCamera) for (int rendererIdx = 0; rendererIdx < currentLOD.renderers.Length; ++rendererIdx) { Renderer currentRenderer = currentLOD.renderers[rendererIdx]; + if(currentRenderer == null) continue; // Add this fella to the renderer list // Unfortunately, we need to check that this renderer was not already pushed into the list (happens if the user uses the same mesh renderer // for two LODs) From c1fe9a650f16b17e3395b9d7b10ec77e00fa301a Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Mon, 26 Apr 2021 17:01:07 +0200 Subject: [PATCH 2/5] changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index a0f0029cc18..6187eb97549 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -159,6 +159,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed CustomPassUtils scaling issues when used with RTHandles allocated from a RenderTexture. - Fixed ResourceReloader that was not call anymore at pipeline construction - Fixed undo of some properties on light editor. +- Fixed issue with RAS build fail when LOD was missing a renderer ### Changed - Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard From 8b713f79446acf2da0566a1c25d5378accf7b422 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Tue, 27 Apr 2021 11:51:14 +0200 Subject: [PATCH 3/5] Add LODgroup missing renderer to "check scene content for ray tracing" --- .../HDRenderPipelineMenuItems.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs index 5a46e678b4a..bc1958efe72 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs @@ -476,6 +476,7 @@ static void CheckSceneContentForRayTracing(MenuCommand menuCommand) // Flag that holds bool generalErrorFlag = false; var rendererArray = UnityEngine.GameObject.FindObjectsOfType(); + var lodGroupArray = UnityEngine.GameObject.FindObjectsOfType(); List materialArray = new List(32); ReflectionProbe reflectionProbe = new ReflectionProbe(); @@ -573,10 +574,31 @@ static void CheckSceneContentForRayTracing(MenuCommand menuCommand) if (!singleSided && hasSingleSided) { - Debug.LogWarning("The object " + currentRenderer.name + " has both double sided and single sided sub-meshes. The double sided flag will be ignored."); + Debug.LogWarning("The object " + currentRenderer.name + " has both double sided and single sided sub-meshes. All materials will be considered double-sided for ray-traced effects."); generalErrorFlag = true; } } + + //Check if one LOD is missing a renderer + for (var i = 0; i < lodGroupArray.Length; i++) + { + // Grab the current LOD group + LODGroup lodGroup = lodGroupArray[i]; + LOD[] lodArray = lodGroup.GetLODs(); + for (int lodIdx = 0; lodIdx < lodArray.Length; ++lodIdx) + { + + LOD currentLOD = lodArray[lodIdx]; + for (int rendererIdx = 0; rendererIdx < currentLOD.renderers.Length; ++rendererIdx) + { + if(currentLOD.renderers[rendererIdx] == null) + { + Debug.LogWarning("The LOD Group " + lodGroup.gameObject.name + " has at least one missing renderer in its children."); + generalErrorFlag = true; + } + } + } + } if (!generalErrorFlag) { From 894b1a8e9f8a7b4140aa9bc06e07f6d44c4a20b8 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Tue, 27 Apr 2021 15:31:10 +0200 Subject: [PATCH 4/5] formatting test --- .../Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs index 7cf13638ddf..1eb9162e3a2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs @@ -492,7 +492,8 @@ internal void BuildRayTracingAccelerationStructure(HDCamera hdCamera) for (int rendererIdx = 0; rendererIdx < currentLOD.renderers.Length; ++rendererIdx) { Renderer currentRenderer = currentLOD.renderers[rendererIdx]; - if(currentRenderer == null) continue; + if(currentRenderer == null) continue; + // Add this fella to the renderer list // Unfortunately, we need to check that this renderer was not already pushed into the list (happens if the user uses the same mesh renderer // for two LODs) From 2836598b5cec5f13e1991e608f66769d1b5a0d78 Mon Sep 17 00:00:00 2001 From: Remi Chapelain Date: Tue, 27 Apr 2021 15:33:22 +0200 Subject: [PATCH 5/5] formatting --- .../Editor/RenderPipeline/HDRenderPipelineMenuItems.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs index bc1958efe72..71dd1126b1e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDRenderPipelineMenuItems.cs @@ -476,7 +476,7 @@ static void CheckSceneContentForRayTracing(MenuCommand menuCommand) // Flag that holds bool generalErrorFlag = false; var rendererArray = UnityEngine.GameObject.FindObjectsOfType(); - var lodGroupArray = UnityEngine.GameObject.FindObjectsOfType(); + var lodGroupArray = UnityEngine.GameObject.FindObjectsOfType(); List materialArray = new List(32); ReflectionProbe reflectionProbe = new ReflectionProbe();