Skip to content

Ignore hybrid duplicated reflection probes during light baking #4663

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 3 commits into from
Jun 7, 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 @@ -314,6 +314,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Make LitTessellation and LayeredLitTessellation fallback on Lit and LayeredLit respectively in DXR.
- Display an info box and disable MSAA asset entry when ray tracing is enabled.
- Changed light reset to preserve type.
- Ignore hybrid duplicated reflection probes during light baking.

## [11.0.0] - 2020-10-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ IScriptableBakedReflectionSystemStageNotifier handle
var probe = (HDProbe)EditorUtility.InstanceIDToObject(instanceId);
var cacheFile = GetGICacheFileForHDProbe(states[index].probeBakingHash);

if (string.IsNullOrEmpty(probe.gameObject.scene.path))
continue;

Assert.IsTrue(File.Exists(cacheFile));

var bakedTexturePath = HDBakingUtilities.GetBakedTextureFilePath(probe);
Expand All @@ -296,6 +299,9 @@ IScriptableBakedReflectionSystemStageNotifier handle
var index = toBakeIndicesList.GetUnchecked(i);
var instanceId = states[index].instanceID;
var probe = (HDProbe)EditorUtility.InstanceIDToObject(instanceId);
if (string.IsNullOrEmpty(probe.gameObject.scene.path))
continue;

var bakedTexturePath = HDBakingUtilities.GetBakedTextureFilePath(probe);
AssetDatabase.ImportAsset(bakedTexturePath);
ImportAssetAt(probe, bakedTexturePath);
Expand All @@ -309,6 +315,9 @@ IScriptableBakedReflectionSystemStageNotifier handle
var index = toBakeIndicesList.GetUnchecked(i);
var instanceId = states[index].instanceID;
var probe = (HDProbe)EditorUtility.InstanceIDToObject(instanceId);
if (string.IsNullOrEmpty(probe.gameObject.scene.path))
continue;

var bakedTexturePath = HDBakingUtilities.GetBakedTextureFilePath(probe);
var bakedTexture = AssetDatabase.LoadAssetAtPath<Texture>(bakedTexturePath);
Assert.IsNotNull(bakedTexture, "The baked texture was imported before, " +
Expand Down Expand Up @@ -393,6 +402,9 @@ public static bool BakeProbes(IEnumerable<HDProbe> bakedProbes)
// Render and write the result to disk
foreach (var probe in bakedProbes)
{
if (string.IsNullOrEmpty(probe.gameObject.scene.path))
continue;

var bakedTexturePath = HDBakingUtilities.GetBakedTextureFilePath(probe);
var planarRT = HDRenderUtilities.CreatePlanarProbeRenderTarget((int)probe.resolution, probeFormat);
RenderAndWriteToFile(probe, bakedTexturePath, cubeRT, planarRT);
Expand All @@ -408,6 +420,9 @@ public static bool BakeProbes(IEnumerable<HDProbe> bakedProbes)
AssetDatabase.StartAssetEditing();
foreach (var probe in bakedProbes)
{
if (string.IsNullOrEmpty(probe.gameObject.scene.path))
continue;

var bakedTexturePath = HDBakingUtilities.GetBakedTextureFilePath(probe);
AssetDatabase.ImportAsset(bakedTexturePath);
ImportAssetAt(probe, bakedTexturePath);
Expand All @@ -418,6 +433,9 @@ public static bool BakeProbes(IEnumerable<HDProbe> bakedProbes)
AssetDatabase.StartAssetEditing();
foreach (var probe in bakedProbes)
{
if (string.IsNullOrEmpty(probe.gameObject.scene.path))
continue;

var bakedTexturePath = HDBakingUtilities.GetBakedTextureFilePath(probe);

// Get or create the baked texture asset for the probe
Expand Down