Skip to content

Commit a88a065

Browse files
New DGI validity baking and ProbeVolume interface (#66)
* Added a button to Probe Volume to bake dynamic GI without the lightmapper. Then, validity is computed with the same rays that used for hits, so it only "sees" backfaces that are one voxel away or closer. * Simplified IProbeVolumeList by grouping all runtime data the pipeline may need to write to into ProbeVolumePipelineData and ProbeVolumePropagationPipelineData structs. * Replaced single dataUpdated on ProbeVolume with dataVersion on ProbeVolumeAsset to detect changes of baked data for already loaded volumes and keep baked lighting buffers, dynamic lighting buffers, atlas slot and content — all up to date regardless of the order they are used.
1 parent 9eb97e0 commit a88a065

File tree

11 files changed

+464
-426
lines changed

11 files changed

+464
-426
lines changed

com.unity.render-pipelines.high-definition/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Drawer.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ static void Drawer_BakeToolBar(SerializedProbeVolume serialized, Editor owner)
105105
{
106106
ProbeVolumeManager.BakeSelected();
107107
}
108+
if (GUILayout.Button(Styles.k_BakeDynamicGIOnlyText))
109+
{
110+
var targets = serialized.GetTargetObjects();
111+
for (int i = 0; i < targets.Length; i++)
112+
{
113+
var probeVolume = (ProbeVolume)targets[i];
114+
EditorUtility.DisplayProgressBar("Baking Dynamic GI", $"{i + 1}/{targets.Length} {probeVolume.name}", (i + 0.5f) / targets.Length);
115+
probeVolume.BakeDynamicGIOnly();
116+
}
117+
EditorUtility.ClearProgressBar();
118+
}
108119
GUILayout.EndHorizontal();
109120
}
110121

com.unity.render-pipelines.high-definition/Editor/Lighting/ProbeVolume/ProbeVolumeUI.Skin.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal static class Styles
1515
internal const string k_ProbesHeader = "Probes";
1616
internal const string k_BakingHeader = "Baking";
1717
internal const string k_BakeSelectedText = "Bake Selected";
18+
internal const string k_BakeDynamicGIOnlyText = "Bake Dynamic GI Only";
1819

1920
internal static readonly GUIContent[] s_Toolbar_Contents = new GUIContent[]
2021
{

com.unity.render-pipelines.high-definition/Editor/Lighting/ProbeVolume/SerializedProbeVolume.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,10 @@ internal void Apply()
106106
{
107107
m_SerializedObject.ApplyModifiedProperties();
108108
}
109+
110+
internal UnityEngine.Object[] GetTargetObjects()
111+
{
112+
return m_SerializedObject.targetObjects;
113+
}
109114
}
110115
}

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/DynamicGI/ProbeVolumeDynamicGI.cs

Lines changed: 97 additions & 72 deletions
Large diffs are not rendered by default.

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/DynamicGI/ProbeVolumeDynamicGIEditor.cs

Lines changed: 149 additions & 128 deletions
Large diffs are not rendered by default.

com.unity.render-pipelines.high-definition/Runtime/Lighting/ProbeVolume/IProbeVolumeList.cs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using static UnityEngine.Rendering.HighDefinition.VolumeGlobalUniqueIDUtils;
2-
31
namespace UnityEngine.Rendering.HighDefinition
42
{
53
interface IProbeVolumeList
@@ -9,45 +7,32 @@ interface IProbeVolumeList
97

108
bool IsAssetCompatible(int i);
119
bool IsDataAssigned(int i);
12-
bool IsDataUpdated(int i);
13-
void SetDataUpdated(int i, bool value);
10+
int GetDataVersion(int i);
11+
void IncrementDataVersion(int i);
1412

1513
Vector3 GetPosition(int i);
1614
Quaternion GetRotation(int i);
1715

18-
ref ProbeVolumeArtistParameters GetParameters(int i);
16+
ProbeVolumeArtistParameters GetParameters(int i);
1917

20-
VolumeGlobalUniqueID GetAtlasID(int i);
2118
ProbeVolume.ProbeVolumeAtlasKey ComputeProbeVolumeAtlasKey(int i);
22-
ProbeVolume.ProbeVolumeAtlasKey GetProbeVolumeAtlasKeyPrevious(int i);
23-
void SetProbeVolumeAtlasKeyPrevious(int i, ProbeVolume.ProbeVolumeAtlasKey key);
2419

2520
int GetDataSHL01Length(int i);
2621
int GetDataSHL2Length(int i);
27-
int GetDataValidityLength(int i);
2822
int GetDataOctahedralDepthLength(int i);
2923

3024
void SetDataOctahedralDepth(int i, ComputeBuffer buffer);
3125

3226
public void EnsureVolumeBuffers(int i);
33-
public void SetVolumeBuffers(int i);
34-
public ProbeVolumeBuffers GetVolumeBuffers(int i);
27+
public ref ProbeVolumePipelineData GetPipelineData(int i);
3528

3629
// Dynamic GI
37-
int GetProbeVolumeEngineDataIndex(int i);
38-
OrientedBBox GetProbeVolumeEngineDataBoundingBox(int i);
39-
ProbeVolumeEngineData GetProbeVolumeEngineData(int i);
40-
void ClearProbeVolumeEngineData(int i);
41-
void SetProbeVolumeEngineData(int i, int dataIndex, in OrientedBBox box, in ProbeVolumeEngineData data);
42-
OrientedBBox ConstructOBBEngineData(int i, Vector3 camOffset);
43-
ref ProbePropagationBuffers GetPropagationBuffers(int i);
30+
ref ProbeVolumePropagationPipelineData GetPropagationPipelineData(int i);
4431
bool HasNeighbors(int i);
4532
int GetHitNeighborAxisLength(int i);
4633
int GetNeighborAxisLength(int i);
4734
void SetHitNeighborAxis(int i, ComputeBuffer buffer);
4835
void SetNeighborAxis(int i, ComputeBuffer buffer);
49-
void SetLastSimulatedFrame(int i, int simulationFrameTick);
50-
int GetLastSimulatedFrame(int i);
5136

5237
#if UNITY_EDITOR
5338
public bool IsHiddenInScene(int i);

0 commit comments

Comments
 (0)