Skip to content

Skip adding the LOD's renderer to the checked renderer if it's null #4313

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

Merged
merged 6 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed null reference exception in Raytracing SSS volume component.
- Fixed artifact appearing when diffuse and specular normal differ too much for eye shader with area lights
- Fixed LightCluster debug view for ray tracing.
- 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ static void CheckSceneContentForRayTracing(MenuCommand menuCommand)
// Flag that holds
bool generalErrorFlag = false;
var rendererArray = UnityEngine.GameObject.FindObjectsOfType<Renderer>();
var lodGroupArray = UnityEngine.GameObject.FindObjectsOfType<LODGroup>();
List<Material> materialArray = new List<Material>(32);
ReflectionProbe reflectionProbe = new ReflectionProbe();

Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +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;

// 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)
Expand Down