浏览代码

Merge pull request #1783 from Unity-Technologies/HDRP/staging

merge Hdrp/staging
/main
GitHub 7 年前
当前提交
de2e6ea2
共有 63 个文件被更改,包括 2459 次插入911 次删除
  1. 16
      com.unity.render-pipelines.core/CoreRP/Textures/TextureCache.cs
  2. 3
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  3. 11
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs
  4. 5
      com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs
  5. 111
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs
  6. 223
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
  7. 49
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
  8. 10
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs
  9. 115
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  10. 19
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs
  11. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Drawers.cs
  12. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/ReflectionMenuItem.cs
  13. 85
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs
  14. 44
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedPlanarReflectionProbe.cs
  15. 116
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
  16. 36
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs
  17. 66
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs
  18. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs
  19. 38
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs
  20. 97
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedInfluenceVolume.cs
  21. 12
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedProxyVolume.cs
  22. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs
  23. 81
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/HDRISky/HDRISkyEditor.cs
  24. 10
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/SkySettingsEditor.cs
  25. 10
      com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
  26. 13
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs
  27. 52
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  28. 116
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  29. 28
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  30. 34
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs
  31. 80
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs
  32. 233
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs
  33. 42
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ProxyVolume.cs
  34. 32
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs
  35. 11
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ShapeType.cs
  36. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  37. 1
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs
  38. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset
  39. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/RenderPipelineResources.cs
  40. 2
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISky.shader
  41. 21
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISkyRenderer.cs
  42. 2
      com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs
  43. 31
      com.unity.render-pipelines.high-definition/HDRP/Sky/SkySettings.cs
  44. 3
      com.unity.render-pipelines.high-definition/HDRP/Sky/VisualEnvironment.cs
  45. 16
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDAdditionalReflectionDataEditor.cs
  46. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDAdditionalReflectionDataEditor.cs.meta
  47. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky.meta
  48. 1001
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs.orig
  49. 75
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs.orig
  50. 8
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky.meta
  51. 88
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader
  52. 9
      com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader.meta
  53. 42
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs
  54. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs.meta
  55. 32
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs
  56. 11
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs.meta
  57. 9
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader.meta
  58. 63
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs
  59. 11
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs.meta
  60. 81
      com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader
  61. 8
      com.unity.render-pipelines.high-definition/HDRP/Sky/AtmosphericScattering.meta

16
com.unity.render-pipelines.core/CoreRP/Textures/TextureCache.cs


{
}
bool TextureHasMipmaps(Texture texture)
{
var crt = texture as CustomRenderTexture;
if (texture is Texture2D)
return ((Texture2D)texture).mipmapCount > 1;
else if (crt is CustomRenderTexture)
return ((CustomRenderTexture)texture).useMipMap;
return false;
}
public override void TransferToSlice(CommandBuffer cmd, int sliceIndex, Texture texture)
{
var mismatch = (m_Cache.width != texture.width) || (m_Cache.height != texture.height);

}
else
{
cmd.CopyTexture(texture, 0, m_Cache, sliceIndex);
if (TextureHasMipmaps(texture))
cmd.CopyTexture(texture, 0, m_Cache, sliceIndex);
else
Debug.LogWarning("The texture '" + texture + "' should have mipmaps to be handeled by the cookie texture array");
}
}

3
com.unity.render-pipelines.high-definition/CHANGELOG.md


- Added LightLayers support (Base on mask from renderers name RenderingLayers and mask from light name LightLayers - if they match, the light apply) - cost an extra GBuffer in deferred (more bandwidth)
- When LightLayers is enabled, the AmbientOclusion is store in the GBuffer in deferred path allowing to avoid double occlusion with SSAO. In forward the double occlusion is now always avoided.
- Added the possibility to add an override transform on the camera for volume interpolation
- Added desired lux intensity and auto multiplier for HDRI sky
- Added an option to disable light by type in the debug menu
- Added gradient sky
### Fixed
- Fixed an issue with PreIntegratedFGD texture being sometimes destroyed and not regenerated causing rendering to break

11
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs


{
var list = new List<DebugUI.Widget>();
list.Add(new DebugUI.Foldout
{
displayName = "Show Light By Type",
children = {
new DebugUI.BoolField { displayName = "Show Directional Lights", getter = () => lightingDebugSettings.showDirectionalLight, setter = value => lightingDebugSettings.showDirectionalLight = value },
new DebugUI.BoolField { displayName = "Show Punctual Lights", getter = () => lightingDebugSettings.showPunctualLight, setter = value => lightingDebugSettings.showPunctualLight = value },
new DebugUI.BoolField { displayName = "Show Area Lights", getter = () => lightingDebugSettings.showAreaLight, setter = value => lightingDebugSettings.showAreaLight = value },
new DebugUI.BoolField { displayName = "Show Reflection Probe", getter = () => lightingDebugSettings.showReflectionProbe, setter = value => lightingDebugSettings.showReflectionProbe = value },
}
});
list.Add(new DebugUI.EnumField
{
displayName = "Shadow Debug Mode",

5
com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs


public float debugExposure = 0.0f;
public bool showPunctualLight = true;
public bool showDirectionalLight = true;
public bool showAreaLight = true;
public bool showReflectionProbe = true;
public LightLoop.TileClusterDebug tileClusterDebug = LightLoop.TileClusterDebug.None;
public LightLoop.TileClusterCategoryDebug tileClusterDebugByCategory = LightLoop.TileClusterCategoryDebug.Punctual;
}

111
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs


using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline

return;
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();
var mat = reflectionProbe.transform.localToWorldMatrix;
Gizmos_Influence(reflectionProbe, reflectionData, e, true);
InfluenceVolumeUI.DrawGizmos(e.m_UIState.influenceVolume, reflectionData.influenceVolume, mat, InfluenceVolumeUI.HandleType.Base, InfluenceVolumeUI.HandleType.All);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Standard, true);
InfluenceVolumeUI.DrawGizmos(e.m_UIState.influenceVolume, reflectionData.influenceVolume, mat, InfluenceVolumeUI.HandleType.Influence, InfluenceVolumeUI.HandleType.All);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Normal, true);
InfluenceVolumeUI.DrawGizmos(e.m_UIState.influenceVolume, reflectionData.influenceVolume, mat, InfluenceVolumeUI.HandleType.InfluenceNormal, InfluenceVolumeUI.HandleType.All);
break;
default:
InfluenceVolumeUI.DrawGizmos(e.m_UIState.influenceVolume, reflectionData.influenceVolume, mat, InfluenceVolumeUI.HandleType.None, InfluenceVolumeUI.HandleType.Base);
break;
}
}

if (!e.sceneViewEditing)
return;
//Gizmos_Influence(reflectionProbe, reflectionData, e, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Standard, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Normal, false);
DrawVerticalRay(reflectionProbe.transform);
}
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;
Gizmo6FacesBoxContained box;
Vector3 boxCenterOffset;
Vector3 boxSizeOffset;
float sphereRadiusOffset;
Color color;
switch (type)
{
default:
case InfluenceType.Standard:
{
box = e != null ? e.m_UIState.alternativeBoxBlendHandle : null;
boxCenterOffset = a.boxBlendCenterOffset;
boxSizeOffset = a.boxBlendSizeOffset;
sphereRadiusOffset = a.sphereBlendRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
break;
}
case InfluenceType.Normal:
{
box = e != null ? e.m_UIState.alternativeBoxBlendNormalHandle : null;
boxCenterOffset = a.boxBlendNormalCenterOffset;
boxSizeOffset = a.boxBlendNormalSizeOffset;
sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
break;
}
}
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
switch (a.influenceShape)
{
case ShapeType.Box:
{
Gizmos.color = color;
if (e != null) // e == null may occure when editor have still not been created at selection while the tool is not used for this part
{
box.DrawHull(isEdit);
}
else
{
if (isEdit)
Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
else
Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
}
break;
}
case ShapeType.Sphere:
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
break;
}
}
Gizmos.matrix = mat;
Gizmos.color = col;
}
static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
switch (a.influenceShape)
{
case ShapeType.Box:
{
Gizmos.color = k_GizmoThemeColorExtentFace;
e.m_UIState.alternativeBoxInfluenceHandle.DrawHull(isEdit);
break;
}
case ShapeType.Sphere:
{
Gizmos.color = k_GizmoThemeColorExtentFace;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius);
break;
}
}
Gizmos.matrix = mat;
Gizmos.color = col;
DrawVerticalRay(reflectionProbe.transform);
}
static void DrawVerticalRay(Transform transform)

223
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs


using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEditor.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{

if (!s.sceneViewEditing)
return;
var mat = p.target.transform.localToWorldMatrix;
EditorGUI.BeginChangeCheck();
switch (EditMode.editMode)

Handle_InfluenceEditing(s, p, o);
InfluenceVolumeUI.DrawHandles_EditBase(s.influenceVolume, p.targetData.influenceVolume, o, mat, p.targetData);
Handle_InfluenceFadeEditing(s, p, o, InfluenceType.Standard);
InfluenceVolumeUI.DrawHandles_EditInfluence(s.influenceVolume, p.targetData.influenceVolume, o, mat, p.targetData);
Handle_InfluenceFadeEditing(s, p, o, InfluenceType.Normal);
InfluenceVolumeUI.DrawHandles_EditInfluenceNormal(s.influenceVolume, p.targetData.influenceVolume, o, mat, p.targetData);
break;
// Origin editing
case EditMode.SceneViewEditMode.ReflectionProbeOrigin:

if (EditorGUI.EndChangeCheck())
Repaint();
}
static void Handle_InfluenceFadeEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o, InfluenceType influenceType)
{
Gizmo6FacesBoxContained alternativeBlendBox;
SphereBoundsHandle sphereHandle;
Vector3 probeBlendDistancePositive, probeBlendDistanceNegative;
Color color;
switch (influenceType)
{
default:
case InfluenceType.Standard:
{
alternativeBlendBox = s.alternativeBoxBlendHandle;
sphereHandle = s.sphereBlendHandle;
probeBlendDistancePositive = sp.targetData.blendDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendDistanceNegative;
color = k_GizmoThemeColorInfluenceBlend;
break;
}
case InfluenceType.Normal:
{
alternativeBlendBox = s.alternativeBoxBlendNormalHandle;
sphereHandle = s.sphereBlendNormalHandle;
probeBlendDistancePositive = sp.targetData.blendNormalDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendNormalDistanceNegative;
color = k_GizmoThemeColorInfluenceNormalBlend;
break;
}
}
var mat = Handles.matrix;
var col = Handles.color;
Handles.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(sp.target);
switch ((ShapeType)sp.influenceShape.enumValueIndex)
{
case ShapeType.Box:
{
alternativeBlendBox.center = sp.target.center - (probeBlendDistancePositive - probeBlendDistanceNegative) * 0.5f;
alternativeBlendBox.size = sp.target.size - probeBlendDistancePositive - probeBlendDistanceNegative;
alternativeBlendBox.container.center = sp.target.center;
alternativeBlendBox.container.size = sp.target.size;
EditorGUI.BeginChangeCheck();
alternativeBlendBox.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection Probe Influence");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe Influence");
var center = sp.target.center;
var influenceSize = sp.target.size;
var diff = 2 * (alternativeBlendBox.center - center);
var sum = influenceSize - (alternativeBlendBox.size);
var positive = (sum - diff) * 0.5f;
var negative = (sum + diff) * 0.5f;
var blendDistancePositive = Vector3.Max(Vector3.zero, Vector3.Min(positive, influenceSize));
var blendDistanceNegative = Vector3.Max(Vector3.zero, Vector3.Min(negative, influenceSize));
probeBlendDistancePositive = blendDistancePositive;
probeBlendDistanceNegative = blendDistanceNegative;
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
}
case ShapeType.Sphere:
{
sphereHandle.center = sp.target.center;
sphereHandle.radius = Mathf.Clamp(sp.targetData.influenceSphereRadius - probeBlendDistancePositive.x, 0, sp.targetData.influenceSphereRadius);
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
Handles.color = color;
sphereHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection influence volume");
Undo.RecordObject(sp.targetData, "Modified Reflection influence volume");
var influenceRadius = sp.targetData.influenceSphereRadius;
var blendRadius = sphereHandle.radius;
var blendDistance = Mathf.Clamp(influenceRadius - blendRadius, 0, influenceRadius);
probeBlendDistancePositive = Vector3.one * blendDistance;
probeBlendDistanceNegative = probeBlendDistancePositive;
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
}
}
Handles.matrix = mat;
Handles.color = col;
switch (influenceType)
{
default:
case InfluenceType.Standard:
{
sp.blendDistancePositive.vector3Value = probeBlendDistancePositive;
sp.blendDistanceNegative.vector3Value = probeBlendDistanceNegative;
//save advanced/simplified saved data
if (sp.editorAdvancedModeEnabled.boolValue)
{
sp.editorAdvancedModeBlendDistancePositive.vector3Value = probeBlendDistancePositive;
sp.editorAdvancedModeBlendDistanceNegative.vector3Value = probeBlendDistanceNegative;
}
else
{
sp.editorSimplifiedModeBlendDistance.floatValue = probeBlendDistancePositive.x;
}
break;
}
case InfluenceType.Normal:
{
sp.blendNormalDistancePositive.vector3Value = probeBlendDistancePositive;
sp.blendNormalDistanceNegative.vector3Value = probeBlendDistanceNegative;
//save advanced/simplified saved data
if (sp.editorAdvancedModeEnabled.boolValue)
{
sp.editorAdvancedModeBlendNormalDistancePositive.vector3Value = probeBlendDistancePositive;
sp.editorAdvancedModeBlendNormalDistanceNegative.vector3Value = probeBlendDistanceNegative;
}
else
{
sp.editorSimplifiedModeBlendNormalDistance.floatValue = probeBlendDistancePositive.x;
}
break;
}
}
sp.Apply();
}
static void Handle_InfluenceEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o)
{
var mat = Handles.matrix;
var col = Handles.color;
Handles.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(sp.target);
switch ((ShapeType)sp.influenceShape.enumValueIndex)
{
case ShapeType.Box:
{
s.alternativeBoxInfluenceHandle.center = sp.target.center;
s.alternativeBoxInfluenceHandle.size = sp.target.size;
EditorGUI.BeginChangeCheck();
s.alternativeBoxInfluenceHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection Probe AABB");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe AABB");
Vector3 center;
Vector3 size;
center = s.alternativeBoxInfluenceHandle.center;
size = s.alternativeBoxInfluenceHandle.size;
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref size);
sp.target.center = center;
sp.target.size = size;
//ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
}
case ShapeType.Sphere:
{
s.sphereInfluenceHandle.center = sp.target.center;
s.sphereInfluenceHandle.radius = sp.targetData.influenceSphereRadius;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
s.sphereInfluenceHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection Probe AABB");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe AABB");
var center = sp.target.center;
var influenceRadius = s.sphereInfluenceHandle.radius;
var radius = Vector3.one * influenceRadius;
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref radius);
influenceRadius = radius.x;
sp.targetData.influenceSphereRadius = influenceRadius;
//ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
}
}
Handles.matrix = mat;
Handles.color = col;
}
static void Handle_OriginEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o)

49
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs


using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;

m_AdditionalDataSerializedObject = new SerializedObject(additionalData);
m_SerializedHdReflectionProbe = new SerializedHDReflectionProbe(serializedObject, m_AdditionalDataSerializedObject);
m_UIState.owner = this;
m_UIState.Reset(
m_SerializedHdReflectionProbe,
Repaint);
m_UIState.Reset(m_SerializedHdReflectionProbe, Repaint);
foreach (var t in targets)
{

p.Apply();
HideAdditionalComponents(false);
//HideAdditionalComponents(false);
HDReflectionProbeUI.DoShortcutKey(p, this);
}

}
}
static void InspectColorsGUI()
{
EditorGUILayout.LabelField("Color Theme", EditorStyles.largeLabel);
k_GizmoThemeColorExtent = EditorGUILayout.ColorField("Extent", k_GizmoThemeColorExtent);
k_GizmoThemeColorExtentFace = EditorGUILayout.ColorField("Extent Face", k_GizmoThemeColorExtentFace);
k_GizmoThemeColorInfluenceBlend = EditorGUILayout.ColorField("Influence Blend", k_GizmoThemeColorInfluenceBlend);
k_GizmoThemeColorInfluenceBlendFace = EditorGUILayout.ColorField("Influence Blend Face", k_GizmoThemeColorInfluenceBlendFace);
k_GizmoThemeColorInfluenceNormalBlend = EditorGUILayout.ColorField("Influence Normal Blend", k_GizmoThemeColorInfluenceNormalBlend);
k_GizmoThemeColorInfluenceNormalBlendFace = EditorGUILayout.ColorField("Influence Normal Blend Face", k_GizmoThemeColorInfluenceNormalBlendFace);
k_GizmoThemeColorProjection = EditorGUILayout.ColorField("Projection", k_GizmoThemeColorProjection);
k_GizmoThemeColorProjectionFace = EditorGUILayout.ColorField("Projection Face", k_GizmoThemeColorProjectionFace);
k_GizmoThemeColorDisabled = EditorGUILayout.ColorField("Disabled", k_GizmoThemeColorDisabled);
k_GizmoThemeColorDisabledFace = EditorGUILayout.ColorField("Disabled Face", k_GizmoThemeColorDisabledFace);
EditorGUILayout.Space();
}
switch ((ShapeType)sp.influenceShape.enumValueIndex)
switch ((InfluenceShape)sp.influenceVolume.shape.enumValueIndex)
case ShapeType.Box:
case InfluenceShape.Box:
var maxBlendDistance = HDReflectionProbeEditorUtility.CalculateBoxMaxBlendDistance(s, sp, o);
sp.targetData.blendDistancePositive = Vector3.Min(sp.targetData.blendDistancePositive, maxBlendDistance);
sp.targetData.blendDistanceNegative = Vector3.Min(sp.targetData.blendDistanceNegative, maxBlendDistance);
sp.targetData.blendNormalDistancePositive = Vector3.Min(sp.targetData.blendNormalDistancePositive, maxBlendDistance);
sp.targetData.blendNormalDistanceNegative = Vector3.Min(sp.targetData.blendNormalDistanceNegative, maxBlendDistance);
var maxBlendDistance = sp.influenceVolume.boxSize.vector3Value;
sp.targetData.influenceVolume.boxBlendDistancePositive = Vector3.Min(sp.targetData.influenceVolume.boxBlendDistancePositive, maxBlendDistance);
sp.targetData.influenceVolume.boxBlendDistanceNegative = Vector3.Min(sp.targetData.influenceVolume.boxBlendDistanceNegative, maxBlendDistance);
sp.targetData.influenceVolume.boxBlendNormalDistancePositive = Vector3.Min(sp.targetData.influenceVolume.boxBlendNormalDistancePositive, maxBlendDistance);
sp.targetData.influenceVolume.boxBlendNormalDistanceNegative = Vector3.Min(sp.targetData.influenceVolume.boxBlendNormalDistanceNegative, maxBlendDistance);
case ShapeType.Sphere:
case InfluenceShape.Sphere:
var maxBlendDistance = Vector3.one * HDReflectionProbeEditorUtility.CalculateSphereMaxBlendDistance(s, sp, o);
sp.targetData.blendDistancePositive = Vector3.Min(sp.targetData.blendDistancePositive, maxBlendDistance);
sp.targetData.blendDistanceNegative = Vector3.Min(sp.targetData.blendDistanceNegative, maxBlendDistance);
sp.targetData.blendNormalDistancePositive = Vector3.Min(sp.targetData.blendNormalDistancePositive, maxBlendDistance);
sp.targetData.blendNormalDistanceNegative = Vector3.Min(sp.targetData.blendNormalDistanceNegative, maxBlendDistance);
var maxBlendDistance = Vector3.one * sp.influenceVolume.sphereRadius.floatValue;
sp.targetData.influenceVolume.boxBlendDistancePositive = Vector3.Min(sp.targetData.influenceVolume.boxBlendDistancePositive, maxBlendDistance);
sp.targetData.influenceVolume.boxBlendDistanceNegative = Vector3.Min(sp.targetData.influenceVolume.boxBlendDistanceNegative, maxBlendDistance);
sp.targetData.influenceVolume.boxBlendNormalDistancePositive = Vector3.Min(sp.targetData.influenceVolume.boxBlendNormalDistancePositive, maxBlendDistance);
sp.targetData.influenceVolume.boxBlendNormalDistanceNegative = Vector3.Min(sp.targetData.influenceVolume.boxBlendNormalDistanceNegative, maxBlendDistance);
break;
}
}

10
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs


size = b.size;
return true;
}
public static float CalculateSphereMaxBlendDistance(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor o)
{
return p.influenceSphereRadius.floatValue;
}
public static Vector3 CalculateBoxMaxBlendDistance(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor o)
{
return p.boxSize.vector3Value * 0.5f;
}
}
}

115
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs


using CED = CoreEditorDrawer<HDReflectionProbeUI, SerializedHDReflectionProbe>;
using _ = CoreEditorUtils;
public partial class HDReflectionProbeUI
internal partial class HDReflectionProbeUI
{
static HDReflectionProbeUI()
{

SectionProxyVolumeSettings,
SectionInfluenceVolumeSettings,
CED.Select(
(s, d, o) => s.influenceVolume,
(s, d, o) => d.influenceVolume,
InfluenceVolumeUI.SectionFoldoutShape
),
SectionInfluenceProxyMismatch,
SectionCaptureSettings,
SectionAdditionalSettings,

"Proxy Volume",
(s, p, o) => s.isSectionExpandedProxyVolume,
FoldoutOption.Indent,
CED.Action(Drawer_ProxyVolume)
CED.Action(Drawer_ProxyVolume),
CED.space,
CED.Action(Drawer_ProjectionSettings)
);
public static readonly CED.IDrawer SectionInfluenceVolumeSettings = CED.FoldoutGroup(

CED.space,
CED.Action(Drawer_InfluenceShape),
CED.space,
CED.Action(Drawer_InfluenceAreas),
CED.space,
CED.Action(Drawer_InfluenceSettings)
CED.Action(Drawer_InfluenceAreas)
);
public static readonly CED.IDrawer SectionInfluenceProxyMismatch = CED.Action(Drawer_InfluenceProxyMissmatch);

if (p.proxyVolumeComponent.objectReferenceValue != null)
{
var proxy = (ReflectionProxyVolumeComponent)p.proxyVolumeComponent.objectReferenceValue;
if ((int)proxy.proxyVolume.shapeType != p.influenceShape.enumValueIndex)
if ((int)proxy.proxyVolume.shape != p.influenceVolume.shape.enumValueIndex)
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",
MessageType.Error,

static void Drawer_InfluenceBoxSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
bool advanced = p.editorAdvancedModeEnabled.boolValue;
var maxBlendDistance = HDReflectionProbeEditorUtility.CalculateBoxMaxBlendDistance(s, p, owner);
bool advanced = p.influenceVolume.editorAdvancedModeEnabled.boolValue;
var maxBlendDistance = p.boxSize.vector3Value * 0.5f;
EditorGUILayout.BeginHorizontal();
Drawer_AdvancedBlendDistance(

{
CoreEditorUtils.DrawVector6(
CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."),
p.boxSideFadePositive, p.boxSideFadeNegative, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
p.influenceVolume.boxSideFadePositive, p.influenceVolume.boxSideFadeNegative, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
SerializedProperty blendDistancePositive = isNormal ? p.blendNormalDistancePositive : p.blendDistancePositive;
SerializedProperty blendDistanceNegative = isNormal ? p.blendNormalDistanceNegative : p.blendDistanceNegative;
SerializedProperty editorAdvancedModeBlendDistancePositive = isNormal ? p.editorAdvancedModeBlendNormalDistancePositive : p.editorAdvancedModeBlendDistancePositive;
SerializedProperty editorAdvancedModeBlendDistanceNegative = isNormal ? p.editorAdvancedModeBlendNormalDistanceNegative : p.editorAdvancedModeBlendDistanceNegative;
SerializedProperty editorSimplifiedModeBlendDistance = isNormal ? p.editorSimplifiedModeBlendNormalDistance : p.editorSimplifiedModeBlendDistance;
SerializedProperty blendDistancePositive = isNormal ? p.influenceVolume.boxBlendNormalDistancePositive : p.influenceVolume.boxBlendDistancePositive;
SerializedProperty blendDistanceNegative = isNormal ? p.influenceVolume.boxBlendNormalDistanceNegative : p.influenceVolume.boxBlendDistanceNegative;
SerializedProperty editorAdvancedModeBlendDistancePositive = isNormal ? p.influenceVolume.editorAdvancedModeBlendNormalDistancePositive : p.influenceVolume.editorAdvancedModeBlendDistancePositive;
SerializedProperty editorAdvancedModeBlendDistanceNegative = isNormal ? p.influenceVolume.editorAdvancedModeBlendNormalDistanceNegative : p.influenceVolume.editorAdvancedModeBlendDistanceNegative;
SerializedProperty editorSimplifiedModeBlendDistance = isNormal ? p.influenceVolume.editorSimplifiedModeBlendNormalDistance : p.influenceVolume.editorSimplifiedModeBlendDistance;
if (p.editorAdvancedModeEnabled.boolValue)
if (p.influenceVolume.editorAdvancedModeEnabled.boolValue)
{
EditorGUI.BeginChangeCheck();
CoreEditorUtils.DrawVector6(

static void Drawer_InfluenceSphereSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
var maxBlendDistance = HDReflectionProbeEditorUtility.CalculateSphereMaxBlendDistance(s, p, owner);
var maxBlendDistance = p.influenceVolume.sphereRadius.floatValue;
var blendDistance = p.blendDistancePositive.vector3Value.x;
var blendDistance = p.influenceVolume.boxBlendDistancePositive.vector3Value.x;
EditorGUI.showMixedValue = p.blendDistancePositive.hasMultipleDifferentValues;
EditorGUI.showMixedValue = p.influenceVolume.boxBlendDistancePositive.hasMultipleDifferentValues;
p.blendDistancePositive.vector3Value = Vector3.one * blendDistance;
p.blendDistanceNegative.vector3Value = Vector3.one * blendDistance;
p.influenceVolume.boxBlendDistancePositive.vector3Value = Vector3.one * blendDistance;
p.influenceVolume.boxBlendDistanceNegative.vector3Value = Vector3.one * blendDistance;
}
if (GUILayout.Button(toolbar_Contents[1], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{

var blendNormalDistance = p.blendNormalDistancePositive.vector3Value.x;
var blendNormalDistance = p.influenceVolume.boxBlendNormalDistancePositive.vector3Value.x;
EditorGUI.showMixedValue = p.blendNormalDistancePositive.hasMultipleDifferentValues;
EditorGUI.showMixedValue = p.influenceVolume.boxBlendNormalDistancePositive.hasMultipleDifferentValues;
p.blendNormalDistancePositive.vector3Value = Vector3.one * blendNormalDistance;
p.blendNormalDistanceNegative.vector3Value = Vector3.one * blendNormalDistance;
p.influenceVolume.boxBlendNormalDistancePositive.vector3Value = Vector3.one * blendNormalDistance;
p.influenceVolume.boxBlendNormalDistanceNegative.vector3Value = Vector3.one * blendNormalDistance;
}
if (GUILayout.Button(toolbar_Contents[2], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{

{
GUILayout.FlexibleSpace();
bool advanced = p.editorAdvancedModeEnabled.boolValue;
bool advanced = p.influenceVolume.editorAdvancedModeEnabled.boolValue;
if (p.editorAdvancedModeEnabled.boolValue ^ advanced)
if (p.influenceVolume.editorAdvancedModeEnabled.boolValue ^ advanced)
p.editorAdvancedModeEnabled.boolValue = advanced;
p.influenceVolume.editorAdvancedModeEnabled.boolValue = advanced;
p.blendDistancePositive.vector3Value = p.editorAdvancedModeBlendDistancePositive.vector3Value;
p.blendDistanceNegative.vector3Value = p.editorAdvancedModeBlendDistanceNegative.vector3Value;
p.blendNormalDistancePositive.vector3Value = p.editorAdvancedModeBlendNormalDistancePositive.vector3Value;
p.blendNormalDistanceNegative.vector3Value = p.editorAdvancedModeBlendNormalDistanceNegative.vector3Value;
p.influenceVolume.boxBlendDistancePositive.vector3Value = p.influenceVolume.editorAdvancedModeBlendDistancePositive.vector3Value;
p.influenceVolume.boxBlendDistanceNegative.vector3Value = p.influenceVolume.editorAdvancedModeBlendDistanceNegative.vector3Value;
p.influenceVolume.boxBlendNormalDistancePositive.vector3Value = p.influenceVolume.editorAdvancedModeBlendNormalDistancePositive.vector3Value;
p.influenceVolume.boxBlendNormalDistanceNegative.vector3Value = p.influenceVolume.editorAdvancedModeBlendNormalDistanceNegative.vector3Value;
p.blendDistanceNegative.vector3Value = p.blendDistancePositive.vector3Value = Vector3.one * p.editorSimplifiedModeBlendDistance.floatValue;
p.blendNormalDistanceNegative.vector3Value = p.blendNormalDistancePositive.vector3Value = Vector3.one * p.editorSimplifiedModeBlendNormalDistance.floatValue;
p.influenceVolume.boxBlendDistanceNegative.vector3Value = p.influenceVolume.boxBlendDistancePositive.vector3Value = Vector3.one * p.influenceVolume.editorSimplifiedModeBlendDistance.floatValue;
p.influenceVolume.boxBlendNormalDistanceNegative.vector3Value = p.influenceVolume.boxBlendNormalDistancePositive.vector3Value = Vector3.one * p.influenceVolume.editorSimplifiedModeBlendNormalDistance.floatValue;
}
p.Apply();
}

static void Drawer_InfluenceShape(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = p.influenceShape.hasMultipleDifferentValues;
EditorGUILayout.PropertyField(p.influenceShape, CoreEditorUtils.GetContent("Shape"));
EditorGUI.showMixedValue = p.influenceVolume.shape.hasMultipleDifferentValues;
EditorGUILayout.PropertyField(p.influenceVolume.shape, CoreEditorUtils.GetContent("Shape"));
s.SetShapeTarget(p.influenceShape.intValue);
s.SetShapeTarget(p.influenceVolume.shape.intValue);
switch ((ShapeType)p.influenceShape.enumValueIndex)
switch ((InfluenceShape)p.influenceVolume.shape.enumValueIndex)
case ShapeType.Box:
case InfluenceShape.Box:
case ShapeType.Sphere:
case InfluenceShape.Sphere:
Drawer_InfluenceShapeSphereSettings(s, p, owner);
break;
}

static void Drawer_InfluenceShapeSphereSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(p.influenceSphereRadius, CoreEditorUtils.GetContent("Radius"));
EditorGUILayout.PropertyField(p.influenceVolume.sphereRadius, CoreEditorUtils.GetContent("Radius"));
if (GUILayout.Button(toolbar_Contents[0], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeBox, GetBoundsGetter(p)(), owner);

static void Drawer_InfluenceAreas(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
if (s.IsSectionExpandedShape(ShapeType.Box).value)
if (s.IsSectionExpandedShape(InfluenceShape.Box).value)
if (s.IsSectionExpandedShape(ShapeType.Sphere).value)
if (s.IsSectionExpandedShape(InfluenceShape.Sphere).value)
static void Drawer_InfluenceSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
static void Drawer_ProjectionSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.boxProjection, CoreEditorUtils.GetContent("Parallax Correction|Parallax Correction causes reflections to appear to change based on the object's position within the probe's box, while still using a single probe as the source of the reflection. This works well for reflections on objects that are moving through enclosed spaces such as corridors and rooms. Setting Parallax Correction to False and the cubemap reflection will be treated as coming from infinitely far away. Note that this feature can be globally disabled from Graphics Settings -> Tier Settings"));
}

GUILayout.EndHorizontal();
}
static public void Drawer_ToolBarButton(int buttonIndex, Editor owner, params GUILayoutOption[] styles)
{
if (GUILayout.Button(toolbar_Contents[buttonIndex], styles))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[buttonIndex], GetBoundsGetter(owner)(), owner);
}
}
static Func<Bounds> GetBoundsGetter(SerializedHDReflectionProbe p)
{
return () =>

{
var rp = (ReflectionProbe)targetObject;
var b = rp.bounds;
bounds.Encapsulate(b);
}
return bounds;
};
}
static Func<Bounds> GetBoundsGetter(Editor o)
{
return () =>
{
var bounds = new Bounds();
foreach (Component targetObject in o.targets)
{
var rp = targetObject.transform;
var b = rp.position;
bounds.Encapsulate(b);
}
return bounds;

19
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs


using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Rendering;
using UnityEditor.Experimental.Rendering.HDPipeline;
using UnityEngine.Events;
public partial class HDReflectionProbeUI : BaseUI<SerializedHDReflectionProbe>
internal partial class HDReflectionProbeUI : BaseUI<SerializedHDReflectionProbe>
static readonly int k_ReflectionInfluenceShapeCount = Enum.GetValues(typeof(ShapeType)).Length;
static readonly int k_ReflectionInfluenceShapeCount = Enum.GetValues(typeof(InfluenceShape)).Length;
public InfluenceVolumeUI influenceVolume = new InfluenceVolumeUI();
[Flags]
public enum Operation

operations = 0;
SetModeTarget(data.mode.hasMultipleDifferentValues ? -1 : data.mode.intValue);
SetShapeTarget(data.influenceShape.hasMultipleDifferentValues ? -1 : data.influenceShape.intValue);
SetShapeTarget(data.influenceVolume.shape.hasMultipleDifferentValues ? -1 : data.influenceVolume.shape.intValue);
influenceVolume.Update();
base.Update();
}

GetReflectionProbeModeBool(i).target = i == value;
}
public AnimBool IsSectionExpandedShape(ShapeType value)
public AnimBool IsSectionExpandedShape(InfluenceShape value)
{
return m_AnimBools[k_AnimBoolSingleFieldCount + k_ReflectionProbeModeCount + (int)value];
}

AnimBool GetReflectionInfluenceShapeBool(int i)
{
return m_AnimBools[k_AnimBoolSingleFieldCount + k_ReflectionProbeModeCount + i];
}
public override void Reset(SerializedHDReflectionProbe data, UnityAction repaint)
{
influenceVolume.Reset(data.influenceVolume, repaint);
base.Reset(data, repaint);
}
}
}

6
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Drawers.cs


CED.Select(
(s, d, o) => s.influenceVolume,
(s, d, o) => d.influenceVolume,
InfluenceVolumeUI.SectionFoldoutShape
InfluenceVolumeUI.SectionFoldoutShapePlanar
),
CED.Action(Drawer_DifferentShapeError),
SectionFoldoutCaptureSettings,

static void Drawer_DifferentShapeError(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
var proxy = d.proxyVolumeReference.objectReferenceValue as ReflectionProxyVolumeComponent;
if (proxy != null && (int)proxy.proxyVolume.shapeType != d.influenceVolume.shapeType.enumValueIndex)
if (proxy != null && (int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex)
{
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",

if (d.proxyVolumeReference.objectReferenceValue != null)
{
var proxy = (ReflectionProxyVolumeComponent)d.proxyVolumeReference.objectReferenceValue;
if ((int)proxy.proxyVolume.shapeType != d.influenceVolume.shapeType.enumValueIndex)
if ((int)proxy.proxyVolume.shape != d.influenceVolume.shape.enumValueIndex)
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",
MessageType.Error,

4
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/ReflectionMenuItem.cs


Selection.activeObject = plane;
var planarProbe = plane.AddComponent<PlanarReflectionProbe>();
planarProbe.influenceVolume.boxBaseSize = new Vector3(10, 0.01f, 10);
planarProbe.influenceVolume.boxSize = new Vector3(10, 0.01f, 10);
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
var material = hdrp != null ? hdrp.GetDefaultMirrorMaterial() : null;

var parent = menuCommand.context as GameObject;
var go = CoreEditorUtils.CreateGameObject(parent, "Planar Reflection");
var planarProbe = go.AddComponent<PlanarReflectionProbe>();
planarProbe.influenceVolume.boxBaseSize = new Vector3(1, 0.01f, 1);
planarProbe.influenceVolume.boxSize = new Vector3(1, 0.01f, 1);
// Ensure it gets re-parented if this was a context click (otherwise does nothing)
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
// Register the creation in the undo system

85
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs


using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
public class SerializedHDReflectionProbe
internal class SerializedHDReflectionProbe
{
internal ReflectionProbe target;
internal HDAdditionalReflectionData targetData;

internal SerializedProperty nearClip;
internal SerializedProperty farClip;
internal SerializedProperty boxProjection;
internal SerializedProperty influenceShape;
internal SerializedProperty influenceSphereRadius;
internal SerializedProperty useSeparateProjectionVolume;
internal SerializedProperty boxReprojectionVolumeSize;
internal SerializedProperty boxReprojectionVolumeCenter;
internal SerializedProperty sphereReprojectionVolumeRadius;
internal SerializedProperty blendDistancePositive;
internal SerializedProperty blendDistanceNegative;
internal SerializedProperty blendNormalDistancePositive;
internal SerializedProperty blendNormalDistanceNegative;
internal SerializedProperty boxSideFadePositive;
internal SerializedProperty boxSideFadeNegative;
internal SerializedProperty editorAdvancedModeBlendDistancePositive;
internal SerializedProperty editorAdvancedModeBlendDistanceNegative;
internal SerializedProperty editorSimplifiedModeBlendDistance;
internal SerializedProperty editorAdvancedModeBlendNormalDistancePositive;
internal SerializedProperty editorAdvancedModeBlendNormalDistanceNegative;
internal SerializedProperty editorSimplifiedModeBlendNormalDistance;
internal SerializedProperty editorAdvancedModeEnabled;
internal SerializedProperty proxyVolumeComponent;
internal SerializedProperty proxyVolumeComponent;
internal SerializedInfluenceVolume influenceVolume;
proxyVolumeComponent = addso.Find((HDAdditionalReflectionData d) => d.proxyVolume);
influenceVolume = new SerializedInfluenceVolume(addso.Find((HDAdditionalReflectionData d) => d.influenceVolume));
target = (ReflectionProbe)so.targetObject;
targetData = target.GetComponent<HDAdditionalReflectionData>();

boxProjection = so.FindProperty("m_BoxProjection");
legacyBlendDistance = so.FindProperty("m_BlendDistance");
influenceShape = addso.Find((HDAdditionalReflectionData d) => d.influenceShape);
influenceSphereRadius = addso.Find((HDAdditionalReflectionData d) => d.influenceSphereRadius);
useSeparateProjectionVolume = addso.Find((HDAdditionalReflectionData d) => d.useSeparateProjectionVolume);
boxReprojectionVolumeSize = addso.Find((HDAdditionalReflectionData d) => d.boxReprojectionVolumeSize);
boxReprojectionVolumeCenter = addso.Find((HDAdditionalReflectionData d) => d.boxReprojectionVolumeCenter);
sphereReprojectionVolumeRadius = addso.Find((HDAdditionalReflectionData d) => d.sphereReprojectionVolumeRadius);
blendDistancePositive = addso.Find((HDAdditionalReflectionData d) => d.blendDistancePositive);
blendDistanceNegative = addso.Find((HDAdditionalReflectionData d) => d.blendDistanceNegative);
blendNormalDistancePositive = addso.Find((HDAdditionalReflectionData d) => d.blendNormalDistancePositive);
blendNormalDistanceNegative = addso.Find((HDAdditionalReflectionData d) => d.blendNormalDistanceNegative);
boxSideFadePositive = addso.Find((HDAdditionalReflectionData d) => d.boxSideFadePositive);
boxSideFadeNegative = addso.Find((HDAdditionalReflectionData d) => d.boxSideFadeNegative);
editorAdvancedModeBlendDistancePositive = addso.FindProperty("editorAdvancedModeBlendDistancePositive");
editorAdvancedModeBlendDistanceNegative = addso.FindProperty("editorAdvancedModeBlendDistanceNegative");
editorSimplifiedModeBlendDistance = addso.FindProperty("editorSimplifiedModeBlendDistance");
editorAdvancedModeBlendNormalDistancePositive = addso.FindProperty("editorAdvancedModeBlendNormalDistancePositive");
editorAdvancedModeBlendNormalDistanceNegative = addso.FindProperty("editorAdvancedModeBlendNormalDistanceNegative");
editorSimplifiedModeBlendNormalDistance = addso.FindProperty("editorSimplifiedModeBlendNormalDistance");
editorAdvancedModeEnabled = addso.FindProperty("editorAdvancedModeEnabled");
//handle data migration from before editor value were saved
if(editorAdvancedModeBlendDistancePositive.vector3Value == Vector3.zero
&& editorAdvancedModeBlendDistanceNegative.vector3Value == Vector3.zero
&& editorSimplifiedModeBlendDistance.floatValue == 0f
&& editorAdvancedModeBlendNormalDistancePositive.vector3Value == Vector3.zero
&& editorAdvancedModeBlendNormalDistanceNegative.vector3Value == Vector3.zero
&& editorSimplifiedModeBlendNormalDistance.floatValue == 0f
&& (blendDistancePositive.vector3Value != Vector3.zero
|| blendDistanceNegative.vector3Value != Vector3.zero
|| blendNormalDistancePositive.vector3Value != Vector3.zero
|| blendNormalDistanceNegative.vector3Value != Vector3.zero))
{
Vector3 positive = blendDistancePositive.vector3Value;
Vector3 negative = blendDistanceNegative.vector3Value;
//exact advanced
editorAdvancedModeBlendDistancePositive.vector3Value = positive;
editorAdvancedModeBlendDistanceNegative.vector3Value = negative;
//aproximated simplified
editorSimplifiedModeBlendDistance.floatValue = Mathf.Max(positive.x, positive.y, positive.z, negative.x, negative.y, negative.z);
positive = blendNormalDistancePositive.vector3Value;
negative = blendNormalDistanceNegative.vector3Value;
//exact advanced
editorAdvancedModeBlendNormalDistancePositive.vector3Value = positive;
editorAdvancedModeBlendNormalDistanceNegative.vector3Value = negative;
//aproximated simplified
editorSimplifiedModeBlendNormalDistance.floatValue = Mathf.Max(positive.x, positive.y, positive.z, negative.x, negative.y, negative.z);
//display old data
editorAdvancedModeEnabled.boolValue = true;
Apply();
}
proxyVolumeComponent = addso.Find((HDAdditionalReflectionData d) => d.proxyVolume);
}
public void Update()

//InfluenceVolume does not have Update. Add it here if it have in the futur.
// Set the legacy blend distance to 0 so the legacy culling system use the probe extent
legacyBlendDistance.floatValue = 0;

44
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedPlanarReflectionProbe.cs


namespace UnityEditor.Experimental.Rendering.HDPipeline
{
public class SerializedPlanarReflectionProbe
internal class SerializedPlanarReflectionProbe
public SerializedObject serializedObject;
internal SerializedObject serializedObject;
public SerializedProperty proxyVolumeReference;
public SerializedReflectionProxyVolumeComponent reflectionProxyVolume;
internal SerializedProperty proxyVolumeReference;
internal SerializedReflectionProxyVolumeComponent reflectionProxyVolume;
public SerializedInfluenceVolume influenceVolume;
internal SerializedInfluenceVolume influenceVolume;
public SerializedProperty captureLocalPosition;
public SerializedProperty captureNearPlane;
public SerializedProperty captureFarPlane;
public SerializedProperty capturePositionMode;
public SerializedProperty captureMirrorPlaneLocalPosition;
public SerializedProperty captureMirrorPlaneLocalNormal;
public SerializedProperty weight;
public SerializedProperty multiplier;
public SerializedProperty mode;
public SerializedProperty refreshMode;
public SerializedProperty customTexture;
internal SerializedProperty captureLocalPosition;
internal SerializedProperty captureNearPlane;
internal SerializedProperty captureFarPlane;
internal SerializedProperty capturePositionMode;
internal SerializedProperty captureMirrorPlaneLocalPosition;
internal SerializedProperty captureMirrorPlaneLocalNormal;
internal SerializedProperty weight;
internal SerializedProperty multiplier;
internal SerializedProperty mode;
internal SerializedProperty refreshMode;
internal SerializedProperty customTexture;
public SerializedProperty overrideFieldOfView;
public SerializedProperty fieldOfViewOverride;
internal SerializedProperty overrideFieldOfView;
internal SerializedProperty fieldOfViewOverride;
public SerializedFrameSettings frameSettings;
internal SerializedFrameSettings frameSettings;
public PlanarReflectionProbe target { get { return serializedObject.targetObject as PlanarReflectionProbe; } }
internal PlanarReflectionProbe target { get { return serializedObject.targetObject as PlanarReflectionProbe; } }
public bool isMirrored
internal bool isMirrored
{
get
{

}
}
public SerializedPlanarReflectionProbe(SerializedObject serializedObject)
internal SerializedPlanarReflectionProbe(SerializedObject serializedObject)
{
this.serializedObject = serializedObject;

116
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs


partial class InfluenceVolumeUI
{
//[TODO: planar / non planar will be redone in next PR]
public static readonly CED.IDrawer SectionFoldoutShapePlanar;
public static readonly CED.IDrawer FieldShape = CED.Action(Drawer_FieldShapeType);
public static readonly CED.IDrawer SectionShapeBox = CED.Action(Drawer_SectionShapeBox);
public static readonly CED.IDrawer SectionShapeSphere = CED.Action(Drawer_SectionShapeSphere);
public static readonly CED.IDrawer SectionShapeBoxPlanar = CED.Action((s, p, o) => Drawer_SectionShapeBox(s,p,o,false,false));
public static readonly CED.IDrawer SectionShapeBox = CED.Action((s, p, o) => Drawer_SectionShapeBox(s, p, o, true, true));
public static readonly CED.IDrawer SectionShapeSpherePlanar = CED.Action((s, p, o) => Drawer_SectionShapeSphere(s, p, o, false, false));
public static readonly CED.IDrawer SectionShapeSphere = CED.Action((s, p, o) => Drawer_SectionShapeSphere(s, p, o, true, true));
SectionFoldoutShapePlanar = CED.Group(
CED.FoldoutGroup(
"Influence Volume",
(s, d, o) => s.isSectionExpandedShape,
FoldoutOption.Indent,
CED.Action(Drawer_InfluenceAdvancedSwitch),
CED.space,
CED.Action(Drawer_FieldShapeType),
CED.FadeGroup(
(s, d, o, i) => s.IsSectionExpanded_Shape((InfluenceShape)i),
FadeOption.None,
SectionShapeBoxPlanar,
SectionShapeSpherePlanar
)
)
);
SectionFoldoutShape = CED.Group(
CED.FoldoutGroup(
"Influence Volume",

CED.space,
CED.Action(Drawer_FieldShapeType),
CED.FadeGroup(
(s, d, o, i) => s.IsSectionExpanded_Shape((ShapeType)i),
(s, d, o, i) => s.IsSectionExpanded_Shape((InfluenceShape)i),
FadeOption.None,
SectionShapeBox,
SectionShapeSphere

static void Drawer_FieldShapeType(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o)
{
EditorGUILayout.PropertyField(d.shapeType, _.GetContent("Shape Type"));
EditorGUILayout.PropertyField(d.shape, _.GetContent("Shape Type"));
}
static void Drawer_InfluenceAdvancedSwitch(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor owner)

d.editorAdvancedModeEnabled.boolValue = advanced;
if (advanced)
{
d.boxInfluencePositiveFade.vector3Value = d.editorAdvancedModeBlendDistancePositive.vector3Value;
d.boxInfluenceNegativeFade.vector3Value = d.editorAdvancedModeBlendDistanceNegative.vector3Value;
d.boxInfluenceNormalPositiveFade.vector3Value = d.editorAdvancedModeBlendNormalDistancePositive.vector3Value;
d.boxInfluenceNormalNegativeFade.vector3Value = d.editorAdvancedModeBlendNormalDistanceNegative.vector3Value;
d.boxBlendDistancePositive.vector3Value = d.editorAdvancedModeBlendDistancePositive.vector3Value;
d.boxBlendDistanceNegative.vector3Value = d.editorAdvancedModeBlendDistanceNegative.vector3Value;
d.boxBlendNormalDistancePositive.vector3Value = d.editorAdvancedModeBlendNormalDistancePositive.vector3Value;
d.boxBlendNormalDistanceNegative.vector3Value = d.editorAdvancedModeBlendNormalDistanceNegative.vector3Value;
d.boxInfluenceNegativeFade.vector3Value = d.boxInfluencePositiveFade.vector3Value = Vector3.one * d.editorSimplifiedModeBlendDistance.floatValue;
d.boxInfluenceNormalNegativeFade.vector3Value = d.boxInfluenceNormalPositiveFade.vector3Value = Vector3.one * d.editorSimplifiedModeBlendNormalDistance.floatValue;
d.boxBlendDistanceNegative.vector3Value = d.boxBlendDistancePositive.vector3Value = Vector3.one * d.editorSimplifiedModeBlendDistance.floatValue;
d.boxBlendNormalDistanceNegative.vector3Value = d.boxBlendNormalDistancePositive.vector3Value = Vector3.one * d.editorSimplifiedModeBlendNormalDistance.floatValue;
}
d.Apply();
}

static void Drawer_SectionShapeBox(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o)
static void Drawer_SectionShapeBox(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o, bool drawOffset, bool drawNormal)
var maxFadeDistance = d.boxBaseSize.vector3Value * 0.5f;
var maxFadeDistance = d.boxSize.vector3Value * 0.5f;
EditorGUILayout.PropertyField(d.boxBaseSize, _.GetContent("Box Size"));
EditorGUILayout.PropertyField(d.boxSize, _.GetContent("Box Size"));
//offset have no meaning for planar reflexion probe
//EditorGUILayout.PropertyField(d.boxBaseOffset, _.GetContent("Box Offset"));
if (drawOffset)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(d.offset, _.GetContent("Offset"));
HDReflectionProbeUI.Drawer_ToolBarButton(3, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.BeginHorizontal();
Drawer_AdvancedBlendDistance(

PlanarReflectionProbeUI.Drawer_ToolBarButton(1, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3)));
EditorGUILayout.EndHorizontal();
if (drawNormal)
{
EditorGUILayout.BeginHorizontal();
Drawer_AdvancedBlendDistance(
d,
true,
maxFadeDistance,
CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes.")
);
PlanarReflectionProbeUI.Drawer_ToolBarButton(2, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3)));
EditorGUILayout.EndHorizontal();
}
d.boxPositiveFaceFade, d.boxNegativeFaceFade, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
d.boxSideFadePositive, d.boxSideFadeNegative, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
SerializedProperty blendDistancePositive = isNormal ? d.boxInfluenceNormalPositiveFade : d.boxInfluencePositiveFade;
SerializedProperty blendDistanceNegative = isNormal ? d.boxInfluenceNormalNegativeFade : d.boxInfluenceNegativeFade;
SerializedProperty blendDistancePositive = isNormal ? d.boxBlendNormalDistancePositive : d.boxBlendDistancePositive;
SerializedProperty blendDistanceNegative = isNormal ? d.boxBlendNormalDistanceNegative : d.boxBlendDistanceNegative;
SerializedProperty editorAdvancedModeBlendDistancePositive = isNormal ? d.editorAdvancedModeBlendNormalDistancePositive : d.editorAdvancedModeBlendDistancePositive;
SerializedProperty editorAdvancedModeBlendDistanceNegative = isNormal ? d.editorAdvancedModeBlendNormalDistanceNegative : d.editorAdvancedModeBlendDistanceNegative;
SerializedProperty editorSimplifiedModeBlendDistance = isNormal ? d.editorSimplifiedModeBlendNormalDistance : d.editorSimplifiedModeBlendDistance;

GUILayout.EndVertical();
}
static void Drawer_SectionShapeSphere(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o)
static void Drawer_SectionShapeSphere(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o, bool drawOffset, bool drawNormal)
var maxFaceDistance = d.sphereBaseRadius.floatValue;
EditorGUILayout.PropertyField(d.sphereBaseRadius, _.GetContent("Radius"));
d.sphereBaseOffset.vector3Value = Vector3.zero;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(d.sphereRadius, _.GetContent("Radius"));
PlanarReflectionProbeUI.Drawer_ToolBarButton(0, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
if(drawOffset)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(d.offset, _.GetContent("Offset"));
HDReflectionProbeUI.Drawer_ToolBarButton(3, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
}
var maxBlendDistance = d.sphereRadius.floatValue;
EditorGUILayout.Slider(d.sphereInfluenceFade, 0, maxFaceDistance, _.GetContent("Blend Distance"));
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(d.sphereBlendDistance, _.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes."));
if (EditorGUI.EndChangeCheck())
{
d.sphereBlendDistance.floatValue = Mathf.Clamp(d.sphereBlendDistance.floatValue, 0, maxBlendDistance);
}
PlanarReflectionProbeUI.Drawer_ToolBarButton(1, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight + 3));
EditorGUILayout.EndHorizontal();
if (drawNormal)
{
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(d.sphereBlendNormalDistance, _.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes."));
if (EditorGUI.EndChangeCheck())
{
d.sphereBlendNormalDistance.floatValue = Mathf.Clamp(d.sphereBlendNormalDistance.floatValue, 0, maxBlendDistance);
}
PlanarReflectionProbeUI.Drawer_ToolBarButton(2, o, GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight + 3));
EditorGUILayout.EndHorizontal();
}
}
}
}

36
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs


if ((showedHandle & HandleType.Influence) != 0)
DrawGizmos_FadeHandle(
s, d, matrix,
d.boxInfluenceOffset, d.boxInfluenceSizeOffset,
d.sphereInfluenceRadiusOffset,
d.boxBlendOffset, d.boxBlendSize,
-d.sphereBlendDistance,
(editedHandle & HandleType.Influence) != 0,
k_GizmoThemeColorInfluence,
false);

s, d, matrix,
d.boxInfluenceNormalOffset, d.boxInfluenceNormalSizeOffset,
d.sphereInfluenceNormalRadiusOffset,
d.boxBlendNormalOffset, d.boxBlendNormalSize,
-d.sphereBlendNormalDistance,
(editedHandle & HandleType.InfluenceNormal) != 0,
k_GizmoThemeColorInfluenceNormal,
true);

var c = Gizmos.color;
Gizmos.matrix = matrix;
Gizmos.color = color;
switch (d.shapeType)
switch (d.shape)
case ShapeType.Box:
case InfluenceShape.Box:
s.boxBaseHandle.center = d.boxBaseOffset;
s.boxBaseHandle.size = d.boxBaseSize;
s.boxBaseHandle.center = d.offset;
s.boxBaseHandle.size = d.boxSize;
case ShapeType.Sphere:
case InfluenceShape.Sphere:
Gizmos.DrawSphere(d.sphereBaseOffset, d.sphereBaseRadius);
Gizmos.DrawSphere(d.offset, d.sphereRadius);
Gizmos.DrawWireSphere(d.sphereBaseOffset, d.sphereBaseRadius);
Gizmos.DrawWireSphere(d.offset, d.sphereRadius);
break;
}
}

var c = Gizmos.color;
Gizmos.matrix = matrix;
Gizmos.color = color;
switch (d.shapeType)
switch (d.shape)
case ShapeType.Box:
case InfluenceShape.Box:
refBox.center = d.boxBaseOffset + boxOffset;
refBox.size = d.boxBaseSize + boxSizeOffset;
refBox.center = d.offset + boxOffset;
refBox.size = d.boxSize + boxSizeOffset;
case ShapeType.Sphere:
case InfluenceShape.Sphere:
Gizmos.DrawSphere(d.sphereBaseOffset, d.sphereBaseRadius + sphereOffset);
Gizmos.DrawSphere(d.offset, d.sphereRadius + sphereOffset);
Gizmos.DrawWireSphere(d.sphereBaseOffset, d.sphereBaseRadius + sphereOffset);
Gizmos.DrawWireSphere(d.offset, d.sphereRadius + sphereOffset);
break;
}
}

66
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs


var c = Handles.color;
Handles.matrix = matrix;
Handles.color = k_GizmoThemeColorBase;
switch (d.shapeType)
switch (d.shape)
case ShapeType.Box:
case InfluenceShape.Box:
var center = d.boxBaseOffset;
var size = d.boxBaseSize;
var center = d.offset;
var size = d.boxSize;
d.boxBaseOffset = center;
d.boxBaseSize = size;
d.offset = center;
d.boxSize = size;
case ShapeType.Sphere:
case InfluenceShape.Sphere:
var center = d.sphereBaseOffset;
var radius = d.sphereBaseRadius;
var center = d.offset;
var radius = d.sphereRadius;
d.sphereBaseOffset = center;
d.sphereBaseRadius = radius;
d.offset = center;
d.sphereRadius = radius;
break;
}
}

var c = Handles.color;
Handles.matrix = matrix;
Handles.color = k_GizmoThemeColorInfluence;
switch (d.shapeType)
switch (d.shape)
case ShapeType.Box:
case InfluenceShape.Box:
var positive = d.boxInfluencePositiveFade;
var negative = d.boxInfluenceNegativeFade;
var positive = d.boxBlendDistancePositive;
var negative = d.boxBlendDistanceNegative;
d.boxBaseOffset, d.boxBaseSize,
d.offset, d.boxSize,
s.data.boxInfluencePositiveFade.vector3Value = positive;
s.data.boxInfluenceNegativeFade.vector3Value = negative;
s.data.boxBlendDistancePositive.vector3Value = positive;
s.data.boxBlendDistanceNegative.vector3Value = negative;
//save advanced/simplified saved data
if (s.data.editorAdvancedModeEnabled.boolValue)

s.data.Apply();
break;
}
case ShapeType.Sphere:
case InfluenceShape.Sphere:
var fade = d.sphereInfluenceFade;
var fade = d.sphereBlendDistance;
d.sphereBaseOffset, d.sphereBaseRadius,
d.offset, d.sphereRadius,
d.sphereInfluenceFade = fade;
d.sphereBlendDistance = fade;
break;
}
}

var c = Handles.color;
Handles.matrix = matrix;
Handles.color = k_GizmoThemeColorInfluenceNormal;
switch (d.shapeType)
switch (d.shape)
case ShapeType.Box:
case InfluenceShape.Box:
Vector3 positive = d.boxInfluenceNormalPositiveFade;
Vector3 negative = d.boxInfluenceNormalNegativeFade;
Vector3 positive = d.boxBlendNormalDistancePositive;
Vector3 negative = d.boxBlendNormalDistanceNegative;
d.boxBaseOffset, d.boxBaseSize,
d.offset, d.boxSize,
s.data.boxInfluenceNormalPositiveFade.vector3Value = positive;
s.data.boxInfluenceNormalNegativeFade.vector3Value = negative;
s.data.boxBlendNormalDistancePositive.vector3Value = positive;
s.data.boxBlendNormalDistanceNegative.vector3Value = negative;
//save advanced/simplified saved data
if (s.data.editorAdvancedModeEnabled.boolValue)

s.data.Apply();
break;
}
case ShapeType.Sphere:
case InfluenceShape.Sphere:
var fade = d.sphereInfluenceNormalFade;
var fade = d.sphereBlendNormalDistance;
d.sphereBaseOffset, d.sphereBaseRadius,
d.offset, d.sphereRadius,
d.sphereInfluenceNormalFade = fade;
d.sphereBlendNormalDistance = fade;
break;
}
}

8
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs


internal static readonly Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static readonly Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
static readonly int k_ShapeCount = Enum.GetValues(typeof(ShapeType)).Length;
static readonly int k_ShapeCount = Enum.GetValues(typeof(InfluenceShape)).Length;
public Gizmo6FacesBox boxBaseHandle;
public Gizmo6FacesBoxContained boxInfluenceHandle;

public override void Update()
{
base.Update();
SetIsSectionExpanded_Shape((ShapeType)data.shapeType.intValue);
SetIsSectionExpanded_Shape((InfluenceShape)data.shape.intValue);
void SetIsSectionExpanded_Shape(ShapeType shape)
void SetIsSectionExpanded_Shape(InfluenceShape shape)
public AnimBool IsSectionExpanded_Shape(ShapeType shapeType)
public AnimBool IsSectionExpanded_Shape(InfluenceShape shapeType)
{
return m_AnimBools[(int)shapeType];
}

38
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs


internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
static readonly int k_ShapeCount = Enum.GetValues(typeof(ShapeType)).Length;
static readonly int k_ShapeCount = Enum.GetValues(typeof(InfluenceShape)).Length;
public static readonly CED.IDrawer SectionShape;

SectionShape = CED.Group(
CED.Action(Drawer_FieldShapeType),
CED.FadeGroup(
(s, d, o, i) => s.IsSectionExpanded_Shape((ShapeType)i),
(s, d, o, i) => s.IsSectionExpanded_Shape((InfluenceShape)i),
FadeOption.Indent,
SectionShapeBox,
SectionShapeSphere

{
base.Update();
if (data != null)
SetIsSectionExpanded_Shape((ShapeType)data.shapeType.intValue);
SetIsSectionExpanded_Shape((InfluenceShape)data.shape.intValue);
void SetIsSectionExpanded_Shape(ShapeType shape)
void SetIsSectionExpanded_Shape(InfluenceShape shape)
public AnimBool IsSectionExpanded_Shape(ShapeType shapeType)
public AnimBool IsSectionExpanded_Shape(InfluenceShape shapeType)
{
return m_AnimBools[(int)shapeType];
}

EditorGUILayout.PropertyField(d.shapeType, _.GetContent("Shape Type"));
EditorGUILayout.PropertyField(d.shape, _.GetContent("Shape Type"));
EditorGUILayout.PropertyField(d.boxOffset, _.GetContent("Box Offset"));
EditorGUILayout.PropertyField(d.boxInfiniteProjection, _.GetContent("Infinite Projection"));
EditorGUILayout.PropertyField(d.sphereOffset, _.GetContent("Sphere Offset"));
EditorGUILayout.PropertyField(d.sphereInfiniteProjection, _.GetContent("Infinite Projection"));
switch (proxyVolume.shapeType)
switch (proxyVolume.shape)
case ShapeType.Box:
case ProxyShape.Box:
case ShapeType.Sphere:
case ProxyShape.Sphere:
Handles_EditBase_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}

static void Handles_EditBase_Sphere(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI s, Object sourceAsset)
{
s.sphereProjectionHandle.center = proxyVolume.sphereOffset;
s.sphereProjectionHandle.center = Vector3.zero;
s.sphereProjectionHandle.radius = proxyVolume.sphereRadius;
var mat = Handles.matrix;

{
Undo.RecordObject(sourceAsset, "Modified Projection Volume");
proxyVolume.sphereOffset = s.sphereProjectionHandle.center;
proxyVolume.sphereRadius = s.sphereProjectionHandle.radius;
EditorUtility.SetDirty(sourceAsset);

static void Handles_EditBase_Box(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI s, Object sourceAsset)
{
s.boxProjectionHandle.center = proxyVolume.boxOffset;
s.boxProjectionHandle.center = Vector3.zero;
s.boxProjectionHandle.size = proxyVolume.boxSize;
var mat = Handles.matrix;

{
Undo.RecordObject(sourceAsset, "Modified Projection Volume AABB");
proxyVolume.boxOffset = s.boxProjectionHandle.center;
proxyVolume.boxSize = s.boxProjectionHandle.size;
EditorUtility.SetDirty(sourceAsset);

public static void DrawGizmos_EditNone(Transform transform, ProxyVolume proxyVolume, ProxyVolumeUI ui, Object sourceAsset)
{
switch (proxyVolume.shapeType)
switch (proxyVolume.shape)
case ShapeType.Box:
case ProxyShape.Box:
case ShapeType.Sphere:
case ProxyShape.Sphere:
Gizmos_EditNone_Sphere(transform, proxyVolume, ui, sourceAsset);
break;
}

Gizmos.matrix = t.localToWorldMatrix;
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireSphere(d.sphereOffset, d.sphereRadius);
Gizmos.DrawWireSphere(Vector3.zero, d.sphereRadius);
Gizmos.matrix = mat;
}

Gizmos.matrix = t.localToWorldMatrix;
Gizmos.color = k_GizmoThemeColorProjection;
Gizmos.DrawWireCube(d.boxOffset, d.boxSize);
Gizmos.DrawWireCube(Vector3.zero, d.boxSize);
Gizmos.matrix = mat;
}

97
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedInfluenceVolume.cs


{
public class SerializedInfluenceVolume
{
public SerializedProperty root;
internal SerializedProperty root;
public SerializedProperty shapeType;
public SerializedProperty boxBaseSize;
public SerializedProperty boxBaseOffset;
public SerializedProperty boxInfluencePositiveFade;
public SerializedProperty boxInfluenceNegativeFade;
public SerializedProperty boxInfluenceNormalPositiveFade;
public SerializedProperty boxInfluenceNormalNegativeFade;
public SerializedProperty boxPositiveFaceFade;
public SerializedProperty boxNegativeFaceFade;
public SerializedProperty sphereBaseRadius;
public SerializedProperty sphereBaseOffset;
public SerializedProperty sphereInfluenceFade;
public SerializedProperty sphereInfluenceNormalFade;
internal SerializedProperty shape;
internal SerializedProperty offset;
internal SerializedProperty boxSize;
internal SerializedProperty boxBlendDistancePositive;
internal SerializedProperty boxBlendDistanceNegative;
//internal SerializedProperty boxBlendSize;
internal SerializedProperty boxBlendNormalDistancePositive;
internal SerializedProperty boxBlendNormalDistanceNegative;
//internal SerializedProperty boxBlendNormalSize;
internal SerializedProperty boxSideFadePositive;
internal SerializedProperty boxSideFadeNegative;
internal SerializedProperty sphereRadius;
internal SerializedProperty sphereBlendDistance;
internal SerializedProperty sphereBlendNormalDistance;
internal SerializedProperty editorAdvancedModeBlendDistancePositive;
internal SerializedProperty editorAdvancedModeBlendDistanceNegative;

{
this.root = root;
shapeType = root.Find((InfluenceVolume i) => i.shapeType);
boxBaseSize = root.Find((InfluenceVolume i) => i.boxBaseSize);
boxBaseOffset = root.Find((InfluenceVolume i) => i.boxBaseOffset);
boxInfluencePositiveFade = root.Find((InfluenceVolume i) => i.boxInfluencePositiveFade);
boxInfluenceNegativeFade = root.Find((InfluenceVolume i) => i.boxInfluenceNegativeFade);
boxInfluenceNormalPositiveFade = root.Find((InfluenceVolume i) => i.boxInfluenceNormalPositiveFade);
boxInfluenceNormalNegativeFade = root.Find((InfluenceVolume i) => i.boxInfluenceNormalNegativeFade);
boxPositiveFaceFade = root.Find((InfluenceVolume i) => i.boxPositiveFaceFade);
boxNegativeFaceFade = root.Find((InfluenceVolume i) => i.boxNegativeFaceFade);
sphereBaseRadius = root.Find((InfluenceVolume i) => i.sphereBaseRadius);
sphereBaseOffset = root.Find((InfluenceVolume i) => i.sphereBaseOffset);
sphereInfluenceFade = root.Find((InfluenceVolume i) => i.sphereInfluenceFade);
sphereInfluenceNormalFade = root.Find((InfluenceVolume i) => i.sphereInfluenceNormalFade);
shape = root.Find((InfluenceVolume i) => i.shape);
offset = root.Find((InfluenceVolume i) => i.offset);
boxSize = root.Find((InfluenceVolume i) => i.boxSize);
boxBlendDistancePositive = root.Find((InfluenceVolume i) => i.boxBlendDistancePositive);
boxBlendDistanceNegative = root.Find((InfluenceVolume i) => i.boxBlendDistanceNegative);
//boxBlendSize = root.Find((InfluenceVolume i) => i.boxBlendSize);
boxBlendNormalDistancePositive = root.Find((InfluenceVolume i) => i.boxBlendNormalDistancePositive);
boxBlendNormalDistanceNegative = root.Find((InfluenceVolume i) => i.boxBlendNormalDistanceNegative);
//boxBlendNormalSize = root.Find((InfluenceVolume i) => i.boxBlendNormalSize);
boxSideFadePositive = root.Find((InfluenceVolume i) => i.boxSideFadePositive);
boxSideFadeNegative = root.Find((InfluenceVolume i) => i.boxSideFadeNegative);
sphereRadius = root.Find((InfluenceVolume i) => i.sphereRadius);
sphereBlendDistance = root.Find((InfluenceVolume i) => i.sphereBlendDistance);
sphereBlendNormalDistance = root.Find((InfluenceVolume i) => i.sphereBlendNormalDistance);
editorAdvancedModeBlendDistancePositive = root.FindPropertyRelative("editorAdvancedModeBlendDistancePositive");
editorAdvancedModeBlendDistanceNegative = root.FindPropertyRelative("editorAdvancedModeBlendDistanceNegative");
editorSimplifiedModeBlendDistance = root.FindPropertyRelative("editorSimplifiedModeBlendDistance");
editorAdvancedModeBlendNormalDistancePositive = root.FindPropertyRelative("editorAdvancedModeBlendNormalDistancePositive");
editorAdvancedModeBlendNormalDistanceNegative = root.FindPropertyRelative("editorAdvancedModeBlendNormalDistanceNegative");
editorSimplifiedModeBlendNormalDistance = root.FindPropertyRelative("editorSimplifiedModeBlendNormalDistance");
editorAdvancedModeEnabled = root.FindPropertyRelative("editorAdvancedModeEnabled");
editorAdvancedModeBlendDistancePositive = root.FindPropertyRelative("m_EditorAdvancedModeBlendDistancePositive");
editorAdvancedModeBlendDistanceNegative = root.FindPropertyRelative("m_EditorAdvancedModeBlendDistanceNegative");
editorSimplifiedModeBlendDistance = root.FindPropertyRelative("m_EditorSimplifiedModeBlendDistance");
editorAdvancedModeBlendNormalDistancePositive = root.FindPropertyRelative("m_EditorAdvancedModeBlendNormalDistancePositive");
editorAdvancedModeBlendNormalDistanceNegative = root.FindPropertyRelative("m_EditorAdvancedModeBlendNormalDistanceNegative");
editorSimplifiedModeBlendNormalDistance = root.FindPropertyRelative("m_EditorSimplifiedModeBlendNormalDistance");
editorAdvancedModeEnabled = root.FindPropertyRelative("m_EditorAdvancedModeEnabled");
//handle data migration from before editor value were saved
if(editorAdvancedModeBlendDistancePositive.vector3Value == Vector3.zero
&& editorAdvancedModeBlendDistanceNegative.vector3Value == Vector3.zero

&& editorSimplifiedModeBlendNormalDistance.floatValue == 0f
&& (boxInfluencePositiveFade.vector3Value != Vector3.zero
|| boxInfluenceNegativeFade.vector3Value != Vector3.zero))
&& (boxBlendDistancePositive.vector3Value != Vector3.zero
|| boxBlendDistanceNegative.vector3Value != Vector3.zero))
Vector3 positive = boxInfluencePositiveFade.vector3Value;
Vector3 negative = boxInfluenceNegativeFade.vector3Value;
Vector3 positive = boxBlendDistancePositive.vector3Value;
Vector3 negative = boxBlendDistanceNegative.vector3Value;
//aproximated simplified
//approximated simplified, exact if it was simplified
//no normal modification allowed anymore in PlanarReflectionProbe
boxInfluenceNormalPositiveFade.vector3Value = Vector3.zero;
boxInfluenceNormalNegativeFade.vector3Value = Vector3.zero;
positive = boxBlendNormalDistancePositive.vector3Value;
negative = boxBlendNormalDistanceNegative.vector3Value;
//exact advanced
editorAdvancedModeBlendNormalDistancePositive.vector3Value = positive;
editorAdvancedModeBlendNormalDistanceNegative.vector3Value = negative;
//approximated simplified, exact if it was simplified
editorSimplifiedModeBlendNormalDistance.floatValue = Mathf.Max(positive.x, positive.y, positive.z, negative.x, negative.y, negative.z);
editorAdvancedModeEnabled.boolValue = true;
editorAdvancedModeEnabled.boolValue =
positive.x != positive.y
|| positive.x != positive.z
|| negative.x != negative.y
|| negative.x != negative.z
|| positive.x != negative.x;
Apply();
}
}

12
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedProxyVolume.cs


{
public SerializedProperty root;
public SerializedProperty shapeType;
public SerializedProperty shape;
public SerializedProperty boxOffset;
public SerializedProperty boxInfiniteProjection;
public SerializedProperty sphereOffset;
public SerializedProperty sphereInfiniteProjection;
shapeType = root.Find((ProxyVolume p) => p.shapeType);
shape = root.Find((ProxyVolume p) => p.shape);
boxOffset = root.Find((ProxyVolume p) => p.boxOffset);
boxInfiniteProjection = root.Find((ProxyVolume p) => p.boxInfiniteProjection);
sphereOffset = root.Find((ProxyVolume p) => p.sphereOffset);
sphereInfiniteProjection = root.Find((ProxyVolume p) => p.sphereInfiniteProjection);
}
}
}

4
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs


newAsset.buildProbabilityTables = Load<ComputeShader>(HDRenderPipelinePath + "Material/GGXConvolution/BuildProbabilityTables.compute");
newAsset.computeGgxIblSampleData = Load<ComputeShader>(HDRenderPipelinePath + "Material/GGXConvolution/ComputeGgxIblSampleData.compute");
newAsset.GGXConvolve = Load<Shader>(HDRenderPipelinePath + "Material/GGXConvolution/GGXConvolve.shader");
newAsset.opaqueAtmosphericScattering = Load<Shader>(HDRenderPipelinePath + "Sky/OpaqueAtmosphericScattering.shader");
newAsset.opaqueAtmosphericScattering = Load<Shader>(HDRenderPipelinePath + "Lighting/AtmosphericScattering/OpaqueAtmosphericScattering.shader");
newAsset.integrateHdriSky = Load<Shader>(HDRenderPipelinePath + "Sky/HDRISky/IntegrateHDRISky.shader");
newAsset.gradientSky = Load<Shader>(HDRenderPipelinePath + "Sky/GradientSky/GradientSky.shader");
// Skybox/Cubemap is a builtin shader, must use Sahder.Find to access it. It is fine because we are in the editor
newAsset.skyboxCubemap = Shader.Find("Skybox/Cubemap");

81
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/HDRISky/HDRISkyEditor.cs


using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline

: SkySettingsEditor
{
SerializedDataParameter m_hdriSky;
SerializedDataParameter m_DesiredLuxValue;
SerializedDataParameter m_IntensityMode;
SerializedDataParameter m_UpperHemisphereLuxValue;
RTHandleSystem.RTHandle m_IntensityTexture;
Material m_IntegrateHDRISkyMaterial; // Compute the HDRI sky intensity in lux for the skybox
Texture2D readBackTexture;
public override void OnEnable()
{

var o = new PropertyFetcher<HDRISky>(serializedObject);
m_hdriSky = Unpack(o.Find(x => x.hdriSky));
m_DesiredLuxValue = Unpack(o.Find(x => x.desiredLuxValue));
m_IntensityMode = Unpack(o.Find(x => x.skyIntensityMode));
m_UpperHemisphereLuxValue = Unpack(o.Find(x => x.upperHemisphereLuxValue));
m_IntensityTexture = RTHandles.Alloc(1, 1, colorFormat: RenderTextureFormat.ARGBFloat, sRGB: false);
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
m_IntegrateHDRISkyMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.integrateHdriSky);
readBackTexture = new Texture2D(1, 1, TextureFormat.RGBAFloat, false, false);
}
public override void OnDisable()
{
if (m_IntensityTexture != null)
RTHandles.Release(m_IntensityTexture);
readBackTexture = null;
}
// Compute the lux value in the upper hemisphere of the HDRI skybox
public void GetUpperHemisphereLuxValue()
{
Cubemap hdri = m_hdriSky.value.objectReferenceValue as Cubemap;
if (hdri == null)
return;
m_IntegrateHDRISkyMaterial.SetTexture(HDShaderIDs._Cubemap, hdri);
Graphics.Blit(Texture2D.whiteTexture, m_IntensityTexture.rt, m_IntegrateHDRISkyMaterial);
// Copy the rendertexture containing the lux value inside a Texture2D
RenderTexture.active = m_IntensityTexture.rt;
readBackTexture.ReadPixels(new Rect(0.0f, 0.0f, 1, 1), 0, 0);
RenderTexture.active = null;
// And then the value inside this texture
Color hdriIntensity = readBackTexture.GetPixel(0, 0);
m_UpperHemisphereLuxValue.value.floatValue = hdriIntensity.r;
PropertyField(m_hdriSky);
EditorGUI.BeginChangeCheck();
{
PropertyField(m_hdriSky);
EditorGUILayout.Space();
PropertyField(m_IntensityMode);
}
if (EditorGUI.EndChangeCheck())
{
GetUpperHemisphereLuxValue();
}
EditorGUILayout.Space();
if (m_IntensityMode.value.enumValueIndex == (int)SkyIntensityMode.Lux)
{
EditorGUI.indentLevel++;
PropertyField(m_DesiredLuxValue);
// Hide exposure and multiplier
m_CommonUIElementsMask &= ~(uint)(SkySettingsUIElement.Exposure | SkySettingsUIElement.Multiplier);
m_CommonUIElementsMask |= (uint)SkySettingsUIElement.IndentExposureAndMultiplier;
// Show the multiplier as read-only
EditorGUI.BeginDisabledGroup(true);
PropertyField(m_UpperHemisphereLuxValue);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
}
else
{
m_CommonUIElementsMask |= (uint)(SkySettingsUIElement.Exposure | SkySettingsUIElement.Multiplier);
}
base.CommonSkySettingsGUI();
}
}

10
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/SkySettingsEditor.cs


Multiplier = 1 << 1,
Rotation = 1 << 2,
UpdateMode = 1 << 3,
IncludeSunInBaking = 1 << 4
IncludeSunInBaking = 1 << 4,
IndentExposureAndMultiplier = 1 << 5,
}
SerializedDataParameter m_SkyExposure;

protected void CommonSkySettingsGUI()
{
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.IndentExposureAndMultiplier) != 0)
EditorGUI.indentLevel++;
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.IndentExposureAndMultiplier) != 0)
EditorGUI.indentLevel--;
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.Rotation) != 0)
PropertyField(m_SkyRotation);

PropertyField(m_IncludeSunInBaking);
}
}
}
}

10
com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset


m_FrameSettings:
enableShadow: 1
enableContactShadows: 1
enableShadowMask: 1
enableSSR: 1
enableSSAO: 1
enableSubsurfaceScattering: 1

enableLightLayers: 1
diffuseGlobalDimmer: 1
specularGlobalDimmer: 1
enableForwardRenderingOnly: 0

enableOpaqueObjects: 1
enableTransparentObjects: 1
enableMSAA: 0
enableShadowMask: 1
lightLoopSettings:
enableTileAndCluster: 1
enableComputeLightEvaluation: 1

supportSSR: 1
supportSSAO: 1
supportSubsurfaceScattering: 1
supportOnlyForward: 0
supportRuntimeDebugDisplay: 1
supportDitheringCrossFade: 1
supportLightLayers: 0
supportOnlyForward: 0
supportRuntimeDebugDisplay: 1
supportDitheringCrossFade: 1
lightLoopSettings:
cookieSize: 128
cookieTexArraySize: 16

13
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs


// Disk,
};
public static class GPULightTypeExtension
{
public static bool IsAreaLight(this GPULightType lightType)
{
return lightType == GPULightType.Rectangle || lightType == GPULightType.Line;
}
public static bool IsSpot(this GPULightType lightType)
{
return lightType == GPULightType.Spot || lightType == GPULightType.ProjectorBox || lightType == GPULightType.ProjectorPyramid;
}
}
// This is use to distinguish between reflection and refraction probe in LightLoop
[GenerateHLSL]
public enum GPUImageBasedLightingType

52
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
class ShadowSetup : IDisposable
{
// shadow related stuff

return true;
}
public bool GetDirectionalLightData(CommandBuffer cmd, ShadowSettings shadowSettings, GPULightType gpuLightType, VisibleLight light, HDAdditionalLightData additionalData, AdditionalShadowData additionalShadowData, int lightIndex)
public bool GetDirectionalLightData(CommandBuffer cmd, ShadowSettings shadowSettings, GPULightType gpuLightType, VisibleLight light, HDAdditionalLightData additionalData, AdditionalShadowData additionalShadowData, int lightIndex, DebugDisplaySettings debugDisplaySettings)
{
var directionalLightData = new DirectionalLightData();

return false;
// Discard light if disabled in debug display settings
if (!debugDisplaySettings.lightingDebugSettings.showDirectionalLight)
return false;
directionalLightData.lightLayers = additionalData.GetLightLayers();

public bool GetLightData(CommandBuffer cmd, ShadowSettings shadowSettings, Camera camera, GPULightType gpuLightType,
VisibleLight light, HDAdditionalLightData additionalLightData, AdditionalShadowData additionalshadowData,
int lightIndex, ref Vector3 lightDimensions)
int lightIndex, ref Vector3 lightDimensions, DebugDisplaySettings debugDisplaySettings)
{
var lightData = new LightData();

lightData.positionRWS = light.light.transform.position;
bool applyRangeAttenuation = additionalLightData.applyRangeAttenuation && (gpuLightType != GPULightType.ProjectorBox);
// Discard light if disabled in debug display settings
if (lightData.lightType.IsAreaLight())
{
if (!debugDisplaySettings.lightingDebugSettings.showAreaLight)
return false;
}
else
{
if (!debugDisplaySettings.lightingDebugSettings.showPunctualLight)
return false;
}
// In the shader we do range remapping: (x - start) / (end - start) = (dist^2 * rangeAttenuationScale + rangeAttenuationBias)
if (applyRangeAttenuation)

}
}
public bool GetEnvLightData(CommandBuffer cmd, Camera camera, ProbeWrapper probe)
public bool GetEnvLightData(CommandBuffer cmd, Camera camera, ProbeWrapper probe, DebugDisplaySettings debugDisplaySettings)
{
// For now we won't display real time probe when rendering one.
// TODO: We may want to display last frame result but in this case we need to be careful not to update the atlas before all realtime probes are rendered (for frame coherency).

// Discard probe if disabled in debug menu
if (!debugDisplaySettings.lightingDebugSettings.showReflectionProbe)
return false;
var capturePosition = Vector3.zero;
var influenceToWorld = probe.influenceToWorld;

// Return true if BakedShadowMask are enabled
public bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, ShadowSettings shadowSettings, CullResults cullResults,
ReflectionProbeCullResults reflectionProbeCullResults, DensityVolumeList densityVolumes)
ReflectionProbeCullResults reflectionProbeCullResults, DensityVolumeList densityVolumes, DebugDisplaySettings debugDisplaySettings)
{
using (new ProfilingSample(cmd, "Prepare Lights For GPU"))
{

// Directional rendering side, it is separated as it is always visible so no volume to handle here
if (gpuLightType == GPULightType.Directional)
{
if (GetDirectionalLightData(cmd, shadowSettings, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex))
if (GetDirectionalLightData(cmd, shadowSettings, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, debugDisplaySettings))
{
directionalLightcount++;

Vector3 lightDimensions = new Vector3(); // X = length or width, Y = height, Z = range (depth)
// Punctual, area, projector lights - the rendering side.
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, ref lightDimensions))
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, ref lightDimensions, debugDisplaySettings))
{
switch (lightCategory)
{

}
LightVolumeType lightVolumeType = LightVolumeType.Box;
if (additional != null && additional.influenceShape == ShapeType.Sphere)
if (additional != null && additional.influenceVolume.shape == InfluenceShape.Sphere)
lightVolumeType = LightVolumeType.Sphere;
++envLightCount;

continue;
var lightVolumeType = LightVolumeType.Box;
if (probe.influenceVolume.shapeType == ShapeType.Sphere)
if (probe.influenceVolume.shape == InfluenceShape.Sphere)
lightVolumeType = LightVolumeType.Sphere;
++envLightCount;

var probeWrapper = ProbeWrapper.Wrap(probe, planarProbe);
if (GetEnvLightData(cmd, camera, probeWrapper))
if (GetEnvLightData(cmd, camera, probeWrapper, debugDisplaySettings))
{
GetEnvLightVolumeDataAndBound(probeWrapper, lightVolumeType, worldToView);
if (stereoEnabled)

// These two buffers have been set in Rebuild()
s_ConvexBoundsBuffer.SetData(m_lightList.bounds);
s_LightVolumeDataBuffer.SetData(m_lightList.lightVolumes);
}
HDAdditionalReflectionData GetHDAdditionalReflectionData(VisibleReflectionProbe probe)
{
var add = probe.probe.GetComponent<HDAdditionalReflectionData>();
if (add == null)
{
add = HDUtils.s_DefaultHDAdditionalReflectionData;
add.blendDistancePositive = Vector3.one * probe.blendDistance;
add.blendDistanceNegative = add.blendDistancePositive;
add.influenceShape = ShapeType.Box;
}
return add;
}
HDAdditionalLightData GetHDAdditionalLightData(VisibleLight light)

116
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs


using UnityEngine.Serialization;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEngine.Experimental.Rendering
namespace UnityEngine.Experimental.Rendering.HDPipeline
[HideInInspector]
const int currentVersion = 2;
enum Version
{
First,
Second,
HDProbeChild,
UseInfluenceVolume,
// Add new version here and they will automatically be the Current one
Max,
Current = Max - 1
}
[SerializeField, FormerlySerializedAs("version")]
int m_Version;

public ShapeType influenceShape;
public float influenceSphereRadius = 3.0f;
public float sphereReprojectionVolumeRadius = 1.0f;
public bool useSeparateProjectionVolume = false;
public Vector3 boxReprojectionVolumeSize = Vector3.one;
public Vector3 boxReprojectionVolumeCenter = Vector3.zero;
public float maxSearchDistance = 8.0f;
public Texture previewCubemap;
public Vector3 blendDistancePositive = Vector3.zero;
public Vector3 blendDistanceNegative = Vector3.zero;
public Vector3 blendNormalDistancePositive = Vector3.zero;
public Vector3 blendNormalDistanceNegative = Vector3.zero;
public Vector3 boxSideFadePositive = Vector3.one;
public Vector3 boxSideFadeNegative = Vector3.one;
//editor value that need to be saved for easy passing from simplified to advanced and vice et versa
// /!\ must not be used outside editor code
[SerializeField] private Vector3 editorAdvancedModeBlendDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendDistance;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendNormalDistance;
[SerializeField] private bool editorAdvancedModeEnabled;
#pragma warning disable 649 //never assigned
//data only kept for migration, to be removed in future version
[SerializeField, System.Obsolete("influenceShape is deprecated, use influenceVolume parameters instead")]
InfluenceShape influenceShape;
[SerializeField, System.Obsolete("influenceSphereRadius is deprecated, use influenceVolume parameters instead")]
float influenceSphereRadius = 3.0f;
[SerializeField, System.Obsolete("blendDistancePositive is deprecated, use influenceVolume parameters instead")]
Vector3 blendDistancePositive = Vector3.zero;
[SerializeField, System.Obsolete("blendDistanceNegative is deprecated, use influenceVolume parameters instead")]
Vector3 blendDistanceNegative = Vector3.zero;
[SerializeField, System.Obsolete("blendNormalDistancePositive is deprecated, use influenceVolume parameters instead")]
Vector3 blendNormalDistancePositive = Vector3.zero;
[SerializeField, System.Obsolete("blendNormalDistanceNegative is deprecated, use influenceVolume parameters instead")]
Vector3 blendNormalDistanceNegative = Vector3.zero;
[SerializeField, System.Obsolete("boxSideFadePositive is deprecated, use influenceVolume parameters instead")]
Vector3 boxSideFadePositive = Vector3.one;
[SerializeField, System.Obsolete("boxSideFadeNegative is deprecated, use influenceVolume parameters instead")]
Vector3 boxSideFadeNegative = Vector3.one;
#pragma warning restore 649 //never assigned
public Vector3 boxBlendCenterOffset { get { return (blendDistanceNegative - blendDistancePositive) * 0.5f; } }
public Vector3 boxBlendSizeOffset { get { return -(blendDistancePositive + blendDistanceNegative); } }
public Vector3 boxBlendNormalCenterOffset { get { return (blendNormalDistanceNegative - blendNormalDistancePositive) * 0.5f; } }
public Vector3 boxBlendNormalSizeOffset { get { return -(blendNormalDistancePositive + blendNormalDistanceNegative); } }
public float sphereBlendRadiusOffset { get { return -blendDistancePositive.x; } }
public float sphereBlendNormalRadiusOffset { get { return -blendNormalDistancePositive.x; } }
bool needMigrateToUseInfluenceVolume = false;
public void OnBeforeSerialize()
{

{
if (m_Version != currentVersion)
if (m_Version != (int)Version.Current)
// Add here data migration code
if (m_Version < 2)
// Add here data migration code that use other component
// Note impossible to access other component at deserialization time
if (m_Version < (int)Version.HDProbeChild)
else if (m_Version < (int)Version.UseInfluenceVolume)
{
needMigrateToUseInfluenceVolume = true;
}
m_Version = currentVersion;
// Add here data migration code that do not use other component
m_Version = (int)Version.Current;
private void OnEnable()
void OnEnable()
if (needMigrateToUseInfluenceVolume)
MigrateToUseInfluenceVolume();
}
void MigrateToHDProbeChild()

m_Version = 2;
m_Version = (int)Version.HDProbeChild;
needMigrateToHDProbeChild = false;
void MigrateToUseInfluenceVolume()
{
influenceVolume.boxSize = legacyProbe.size;
#pragma warning disable CS0618 // Type or member is obsolete
influenceVolume.sphereRadius = influenceSphereRadius;
influenceVolume.shape = influenceShape; //must be done after each size transfert
influenceVolume.boxBlendDistancePositive = blendDistancePositive;
influenceVolume.boxBlendDistanceNegative = blendDistanceNegative;
influenceVolume.boxBlendNormalDistancePositive = blendNormalDistancePositive;
influenceVolume.boxBlendNormalDistanceNegative = blendNormalDistanceNegative;
influenceVolume.boxSideFadePositive = boxSideFadePositive;
influenceVolume.boxSideFadeNegative = boxSideFadeNegative;
#pragma warning restore CS0618 // Type or member is obsolete
m_Version = (int)Version.UseInfluenceVolume;
needMigrateToUseInfluenceVolume = false;
OnAfterDeserialize(); //continue migrating if needed
//Note: former editor parameters will be recreated as if non existent.
//User will lose parameters corresponding to non used mode between simplified and advanced
}
public override ReflectionProbeMode mode
{
set

base.refreshMode = value;
legacyProbe.refreshMode = value; //ensure compatibility till we capture without the legacy component
}
}
internal override void UpdatedInfluenceVolumeShape(Vector3 size, Vector3 offset)
{
legacyProbe.size = size;
legacyProbe.center = offset;
}
}
}

28
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs


using UnityEngine;
public abstract class HDProbe : MonoBehaviour
[ExecuteInEditMode]
public abstract class HDProbe : MonoBehaviour, ISerializationCallbackReceiver
[SerializeField]
InfluenceVolume m_InfluenceVolume;
[SerializeField, FormerlySerializedAsAttribute("dimmer"), FormerlySerializedAsAttribute("m_Dimmer"), FormerlySerializedAsAttribute("multiplier")]
float m_Multiplier = 1.0f;

/// <summary>ProxyVolume currently used by this probe.</summary>
public ReflectionProxyVolumeComponent proxyVolume { get { return m_ProxyVolume; } }
/// <summary>InfluenceVolume of the probe.</summary>
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } private set { m_InfluenceVolume = value; } }
/// <summary>Multiplier factor of reflection (non PBR parameter).</summary>
public float multiplier { get { return m_Multiplier; } }

get { return m_RefreshMode; }
set { m_RefreshMode = value; }
}
internal void Awake()
{
if (influenceVolume == null)
influenceVolume = new InfluenceVolume();
influenceVolume.Init(this);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
influenceVolume.Init(this);
}
internal virtual void UpdatedInfluenceVolumeShape(Vector3 size, Vector3 offset) { }
}
}

34
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs


using UnityEngine.Serialization;
using UnityEngine.Rendering;
using System;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

[HideInInspector]
const int currentVersion = 1;
const int currentVersion = 2;
[SerializeField, FormerlySerializedAs("version")]
int m_Version;

Static,
MirrorCamera
MirrorCamera,
[SerializeField]
InfluenceVolume m_InfluenceVolume = new InfluenceVolume();
[SerializeField]
Vector3 m_CaptureLocalPosition;
[SerializeField]

public bool overrideFieldOfView { get { return m_OverrideFieldOfView; } }
public float fieldOfViewOverride { get { return m_FieldOfViewOverride; } }
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } }
public BoundingSphere boundingSphere { get { return m_InfluenceVolume.GetBoundingSphereAt(transform); } }
public BoundingSphere boundingSphere { get { return influenceVolume.GetBoundingSphereAt(transform); } }
public Texture texture
{

}
}
}
public Bounds bounds { get { return m_InfluenceVolume.GetBoundsAt(transform); } }
public Bounds bounds { get { return influenceVolume.GetBoundsAt(transform); } }
public Vector3 captureLocalPosition { get { return m_CaptureLocalPosition; } set { m_CaptureLocalPosition = value; } }
public Matrix4x4 influenceToWorld
{

: influenceToWorld;
}
}
public ShapeType proxyShape
public ProxyShape proxyShape
? proxyVolume.proxyVolume.shapeType
: influenceVolume.shapeType;
? proxyVolume.proxyVolume.shape
: (ProxyShape)influenceVolume.shape;
}
}
public Vector3 proxyExtents

return proxyVolume != null
? proxyVolume.proxyVolume.extents
: influenceVolume.boxBaseSize;
: influenceVolume.boxSize;
}
}
public bool infiniteProjection
{
get
{
return proxyVolume != null
&& proxyVolume.proxyVolume.shape == ProxyShape.Infinite;
public bool infiniteProjection { get { return proxyVolume != null && proxyVolume.proxyVolume.infiniteProjection; } }
public bool useMirrorPlane
{

if (m_Version != currentVersion)
{
// Add here data migration code
if(m_Version < 2)
{
influenceVolume.MigrateOffsetSphere();
}
m_Version = currentVersion;
}
}

80
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs


throw new ArgumentException();
}
protected static EnvShapeType ConvertShape(ShapeType shape)
protected static EnvShapeType ConvertShape(InfluenceShape shape)
case ShapeType.Box:
case InfluenceShape.Box:
return EnvShapeType.Box;
case InfluenceShape.Sphere:
return EnvShapeType.Sphere;
}
}
protected static EnvShapeType ConvertShape(ProxyShape shape)
{
switch (shape)
{
case ProxyShape.Box:
case ShapeType.Sphere:
default:
case ProxyShape.Infinite:
case ProxyShape.Sphere:
return EnvShapeType.Sphere;
}
}

if (add == null)
{
add = HDUtils.s_DefaultHDAdditionalReflectionData;
add.blendDistancePositive = Vector3.one * probe.blendDistance;
add.blendDistanceNegative = add.blendDistancePositive;
add.influenceShape = ShapeType.Box;
if (add.influenceVolume == null)
{
add.Awake(); // We need to init the 'default' data if it isn't
}
Vector3 distance = Vector3.one * probe.blendDistance;
add.influenceVolume.boxBlendDistancePositive = distance;
add.influenceVolume.boxBlendDistanceNegative = distance;
add.influenceVolume.shape= InfluenceShape.Box;
}
return add;
}

public override Texture texture { get { return probe.texture; } }
public override ReflectionProbeMode mode { get { return probe.probe.mode; } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(additional.influenceShape); } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(additional.influenceVolume.shape); } }
public override float weight { get { return additional.weight; } }
public override float multiplier { get { return additional.multiplier; } }
public override Vector3 influenceExtents

switch (additional.influenceShape)
switch (additional.influenceVolume.shape)
case ShapeType.Box:
case InfluenceShape.Box:
case ShapeType.Sphere:
return Vector3.one * additional.influenceSphereRadius;
case InfluenceShape.Sphere:
return Vector3.one * additional.influenceVolume.sphereRadius;
public override Vector3 blendNormalDistancePositive { get { return additional.blendNormalDistancePositive; } }
public override Vector3 blendNormalDistanceNegative { get { return additional.blendNormalDistanceNegative; } }
public override Vector3 blendDistancePositive { get { return additional.blendDistancePositive; } }
public override Vector3 blendDistanceNegative { get { return additional.blendDistanceNegative; } }
public override Vector3 boxSideFadePositive { get { return additional.boxSideFadePositive; } }
public override Vector3 boxSideFadeNegative { get { return additional.boxSideFadeNegative; } }
public override Vector3 blendNormalDistancePositive { get { return additional.influenceVolume.boxBlendNormalDistancePositive; } }
public override Vector3 blendNormalDistanceNegative { get { return additional.influenceVolume.boxBlendNormalDistanceNegative; } }
public override Vector3 blendDistancePositive { get { return additional.influenceVolume.boxBlendDistancePositive; } }
public override Vector3 blendDistanceNegative { get { return additional.influenceVolume.boxBlendDistanceNegative; } }
public override Vector3 boxSideFadePositive { get { return additional.influenceVolume.boxSideFadePositive; } }
public override Vector3 boxSideFadeNegative { get { return additional.influenceVolume.boxSideFadeNegative; } }
public override EnvShapeType proxyShapeType
{

? ConvertShape(additional.proxyVolume.proxyVolume.shapeType)
? ConvertShape(additional.proxyVolume.proxyVolume.shape)
: influenceShapeType;
}
}

get
{
return additional.proxyVolume != null
? additional.proxyVolume.proxyVolume.infiniteProjection
? additional.proxyVolume.proxyVolume.shape == ProxyShape.Infinite
: probe.boxProjection == 0;
}
}

public override Matrix4x4 influenceToWorld { get { return planarReflectionProbe.influenceToWorld; } }
public override Texture texture { get { return planarReflectionProbe.texture; } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(planarReflectionProbe.influenceVolume.shapeType); } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(planarReflectionProbe.influenceVolume.shape); } }
public override float weight { get { return planarReflectionProbe.weight; } }
public override float multiplier { get { return planarReflectionProbe.multiplier; } }
public override Vector3 influenceExtents

switch (planarReflectionProbe.influenceVolume.shapeType)
switch (planarReflectionProbe.influenceVolume.shape)
case ShapeType.Box:
return planarReflectionProbe.influenceVolume.boxBaseSize * 0.5f;
case ShapeType.Sphere:
return planarReflectionProbe.influenceVolume.sphereBaseRadius * Vector3.one;
case InfluenceShape.Box:
return planarReflectionProbe.influenceVolume.boxSize * 0.5f;
case InfluenceShape.Sphere:
return planarReflectionProbe.influenceVolume.sphereRadius * Vector3.one;
public override Vector3 blendNormalDistancePositive { get { return planarReflectionProbe.influenceVolume.boxInfluenceNormalPositiveFade; } }
public override Vector3 blendNormalDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxInfluenceNormalNegativeFade; } }
public override Vector3 blendDistancePositive { get { return planarReflectionProbe.influenceVolume.boxInfluencePositiveFade; } }
public override Vector3 blendDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxInfluenceNegativeFade; } }
public override Vector3 boxSideFadePositive { get { return planarReflectionProbe.influenceVolume.boxPositiveFaceFade; } }
public override Vector3 boxSideFadeNegative { get { return planarReflectionProbe.influenceVolume.boxNegativeFaceFade; } }
public override Vector3 blendNormalDistancePositive { get { return planarReflectionProbe.influenceVolume.boxBlendNormalDistancePositive; } }
public override Vector3 blendNormalDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxBlendNormalDistanceNegative; } }
public override Vector3 blendDistancePositive { get { return planarReflectionProbe.influenceVolume.boxBlendDistancePositive; } }
public override Vector3 blendDistanceNegative { get { return planarReflectionProbe.influenceVolume.boxBlendDistanceNegative; } }
public override Vector3 boxSideFadePositive { get { return planarReflectionProbe.influenceVolume.boxSideFadePositive; } }
public override Vector3 boxSideFadeNegative { get { return planarReflectionProbe.influenceVolume.boxSideFadeNegative; } }
public override EnvShapeType proxyShapeType { get { return ConvertShape(planarReflectionProbe.proxyShape); } }
public override Vector3 proxyExtents { get { return planarReflectionProbe.proxyExtents; } }
public override bool infiniteProjection { get { return planarReflectionProbe.infiniteProjection; } }

233
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs


using System;
using UnityEngine.Serialization;
using UnityEngine.Experimental.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

[SerializeField]
ShapeType m_ShapeType = ShapeType.Box;
HDProbe probe;
[SerializeField, FormerlySerializedAs("m_ShapeType")]
InfluenceShape m_Shape = InfluenceShape.Box;
[SerializeField, FormerlySerializedAs("m_BoxBaseOffset")]
Vector3 m_Offset;
#pragma warning disable 649 //never assigned
[SerializeField, Obsolete("Kept only for compatibility. Use m_Offset instead")]
Vector3 m_SphereBaseOffset;
#pragma warning restore 649 //never assigned
[SerializeField]
Vector3 m_BoxBaseSize = Vector3.one;
[SerializeField]
Vector3 m_BoxBaseOffset;
[SerializeField]
Vector3 m_BoxInfluencePositiveFade;
[SerializeField]
Vector3 m_BoxInfluenceNegativeFade;
[SerializeField]
Vector3 m_BoxInfluenceNormalPositiveFade;
[SerializeField]
Vector3 m_BoxInfluenceNormalNegativeFade;
[SerializeField]
Vector3 m_BoxPositiveFaceFade = Vector3.one;
[SerializeField]
Vector3 m_BoxNegativeFaceFade = Vector3.one;
[SerializeField, FormerlySerializedAs("m_BoxBaseSize")]
Vector3 m_BoxSize = Vector3.one * 10;
[SerializeField, FormerlySerializedAs("m_BoxInfluencePositiveFade")]
Vector3 m_BoxBlendDistancePositive;
[SerializeField, FormerlySerializedAs("m_BoxInfluenceNegativeFade")]
Vector3 m_BoxBlendDistanceNegative;
[SerializeField, FormerlySerializedAs("m_BoxInfluenceNormalPositiveFade")]
Vector3 m_BoxBlendNormalDistancePositive;
[SerializeField, FormerlySerializedAs("m_BoxInfluenceNormalNegativeFade")]
Vector3 m_BoxBlendNormalDistanceNegative;
[SerializeField, FormerlySerializedAs("m_BoxPositiveFaceFade")]
Vector3 m_BoxSideFadePositive = Vector3.one;
[SerializeField, FormerlySerializedAs("m_BoxNegativeFaceFade")]
Vector3 m_BoxSideFadeNegative = Vector3.one;
[SerializeField] private Vector3 editorAdvancedModeBlendDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendDistance;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistancePositive;
[SerializeField] private Vector3 editorAdvancedModeBlendNormalDistanceNegative;
[SerializeField] private float editorSimplifiedModeBlendNormalDistance;
[SerializeField] private bool editorAdvancedModeEnabled;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendDistancePositive")]
Vector3 m_EditorAdvancedModeBlendDistancePositive;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendDistanceNegative")]
Vector3 m_EditorAdvancedModeBlendDistanceNegative;
[SerializeField, FormerlySerializedAs("editorSimplifiedModeBlendDistance")]
float m_EditorSimplifiedModeBlendDistance;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendNormalDistancePositive")]
Vector3 m_EditorAdvancedModeBlendNormalDistancePositive;
[SerializeField, FormerlySerializedAs("editorAdvancedModeBlendNormalDistanceNegative")]
Vector3 m_EditorAdvancedModeBlendNormalDistanceNegative;
[SerializeField, FormerlySerializedAs("editorSimplifiedModeBlendNormalDistance")]
float m_EditorSimplifiedModeBlendNormalDistance;
[SerializeField, FormerlySerializedAs("editorAdvancedModeEnabled")]
bool m_EditorAdvancedModeEnabled;
[SerializeField]
float m_SphereBaseRadius = 1;
[SerializeField]
Vector3 m_SphereBaseOffset;
[SerializeField]
float m_SphereInfluenceFade;
[SerializeField]
float m_SphereInfluenceNormalFade;
[SerializeField, FormerlySerializedAs("m_SphereBaseRadius")]
float m_SphereRadius = 1;
[SerializeField, FormerlySerializedAs("m_SphereInfluenceFade")]
float m_SphereBlendDistance;
[SerializeField, FormerlySerializedAs("m_SphereInfluenceNormalFade")]
float m_SphereBlendNormalDistance;
public ShapeType shapeType { get { return m_ShapeType; } }
/// <summary>Shape of this InfluenceVolume.</summary>
public InfluenceShape shape
{
get { return m_Shape; }
set
{
m_Shape = value;
switch (m_Shape)
{
case InfluenceShape.Box:
probe.UpdatedInfluenceVolumeShape(m_BoxSize, offset);
break;
case InfluenceShape.Sphere:
probe.UpdatedInfluenceVolumeShape(Vector3.one * (2 * m_SphereRadius), offset);
break;
}
}
}
public Vector3 boxBaseSize { get { return m_BoxBaseSize; } set { m_BoxBaseSize = value; } }
public Vector3 boxBaseOffset { get { return m_BoxBaseOffset; } set { m_BoxBaseOffset = value; } }
public Vector3 boxInfluencePositiveFade { get { return m_BoxInfluencePositiveFade; } set { m_BoxInfluencePositiveFade = value; } }
public Vector3 boxInfluenceNegativeFade { get { return m_BoxInfluenceNegativeFade; } set { m_BoxInfluenceNegativeFade = value; } }
public Vector3 boxInfluenceNormalPositiveFade { get { return m_BoxInfluenceNormalPositiveFade; } set { m_BoxInfluenceNormalPositiveFade = value; } }
public Vector3 boxInfluenceNormalNegativeFade { get { return m_BoxInfluenceNormalNegativeFade; } set { m_BoxInfluenceNormalNegativeFade = value; } }
public Vector3 boxPositiveFaceFade { get { return m_BoxPositiveFaceFade; } set { m_BoxPositiveFaceFade = value; } }
public Vector3 boxNegativeFaceFade { get { return m_BoxNegativeFaceFade; } set { m_BoxNegativeFaceFade = value; } }
/// <summary>Offset of this influence volume to the component handling him.</summary>
public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }
/// <summary>Size of the InfluenceVolume in Box Mode.</summary>
public Vector3 boxSize
{
get { return m_BoxSize; }
set
{
m_BoxSize = value;
probe.UpdatedInfluenceVolumeShape(m_BoxSize, offset);
}
}
/// <summary>Offset of sub volume defining fading.</summary>
public Vector3 boxBlendOffset { get { return (boxBlendDistanceNegative - boxBlendDistancePositive) * 0.5f; } }
/// <summary>Size of sub volume defining fading.</summary>
public Vector3 boxBlendSize { get { return -(boxBlendDistancePositive + boxBlendDistanceNegative); } }
/// <summary>
/// Position of fade sub volume maxOffset point relative to InfluenceVolume max corner.
/// Values between 0 (on InfluenceVolume hull) to half of boxSize corresponding axis.
/// </summary>
public Vector3 boxBlendDistancePositive { get { return m_BoxBlendDistancePositive; } set { m_BoxBlendDistancePositive = value; } }
/// <summary>
/// Position of fade sub volume minOffset point relative to InfluenceVolume min corner.
/// Values between 0 (on InfluenceVolume hull) to half of boxSize corresponding axis.
/// </summary>
public Vector3 boxBlendDistanceNegative { get { return m_BoxBlendDistanceNegative; } set { m_BoxBlendDistanceNegative = value; } }
public Vector3 boxInfluenceOffset { get { return (boxInfluenceNegativeFade - boxInfluencePositiveFade) * 0.5f; } }
public Vector3 boxInfluenceSizeOffset { get { return -(boxInfluencePositiveFade + boxInfluenceNegativeFade); } }
public Vector3 boxInfluenceNormalOffset { get { return (boxInfluenceNormalNegativeFade - boxInfluenceNormalPositiveFade) * 0.5f; } }
public Vector3 boxInfluenceNormalSizeOffset { get { return -(boxInfluenceNormalPositiveFade + boxInfluenceNormalNegativeFade); } }
/// <summary>Offset of sub volume defining fading relative to normal orientation.</summary>
public Vector3 boxBlendNormalOffset { get { return (boxBlendNormalDistanceNegative - boxBlendNormalDistancePositive) * 0.5f; } }
/// <summary>Size of sub volume defining fading relative to normal orientation.</summary>
public Vector3 boxBlendNormalSize { get { return -(boxBlendNormalDistancePositive + boxBlendNormalDistanceNegative); } }
/// <summary>
/// Position of normal fade sub volume maxOffset point relative to InfluenceVolume max corner.
/// Values between 0 (on InfluenceVolume hull) to half of boxSize corresponding axis (on origin for this axis).
/// </summary>
public Vector3 boxBlendNormalDistancePositive { get { return m_BoxBlendNormalDistancePositive; } set { m_BoxBlendNormalDistancePositive = value; } }
/// <summary>
/// Position of normal fade sub volume minOffset point relative to InfluenceVolume min corner.
/// Values between 0 (on InfluenceVolume hull) to half of boxSize corresponding axis (on origin for this axis).
/// </summary>
public Vector3 boxBlendNormalDistanceNegative { get { return m_BoxBlendNormalDistanceNegative; } set { m_BoxBlendNormalDistanceNegative = value; } }
/// <summary>Define fading percent of +X, +Y and +Z locally oriented face. (values from 0 to 1)</summary>
public Vector3 boxSideFadePositive { get { return m_BoxSideFadePositive; } set { m_BoxSideFadePositive = value; } }
/// <summary>Define fading percent of -X, -Y and -Z locally oriented face. (values from 0 to 1)</summary>
public Vector3 boxSideFadeNegative { get { return m_BoxSideFadeNegative; } set { m_BoxSideFadeNegative = value; } }
public float sphereBaseRadius { get { return m_SphereBaseRadius; } set { m_SphereBaseRadius = value; } }
public Vector3 sphereBaseOffset { get { return m_SphereBaseOffset; } set { m_SphereBaseOffset = value; } }
public float sphereInfluenceFade { get { return m_SphereInfluenceFade; } set { m_SphereInfluenceFade = value; } }
public float sphereInfluenceNormalFade { get { return m_SphereInfluenceNormalFade; } set { m_SphereInfluenceNormalFade = value; } }
public float sphereInfluenceRadiusOffset { get { return -sphereInfluenceFade; } }
public float sphereInfluenceNormalRadiusOffset { get { return -sphereInfluenceNormalFade; } }
/// <summary>Radius of the InfluenceVolume in Sphere Mode.</summary>
public float sphereRadius
{
get { return m_SphereRadius; }
set
{
m_SphereRadius = value;
probe.UpdatedInfluenceVolumeShape(Vector3.one * (2 * m_SphereRadius), offset);
}
}
/// <summary>
/// Offset of the fade sub volume from InfluenceVolume hull.
/// Value between 0 (on InfluenceVolume hull) and sphereRadius (fade sub volume reduced to a point).
/// </summary>
public float sphereBlendDistance { get { return m_SphereBlendDistance; } set { m_SphereBlendDistance = value; } }
/// <summary>
/// Offset of the normal fade sub volume from InfluenceVolume hull.
/// Value between 0 (on InfluenceVolume hull) and sphereRadius (fade sub volume reduced to a point).
/// </summary>
public float sphereBlendNormalDistance { get { return m_SphereBlendNormalDistance; } set { m_SphereBlendNormalDistance = value; } }
internal void Init(HDProbe probe)
{
this.probe = probe;
}
public BoundingSphere GetBoundingSphereAt(Transform transform)
internal BoundingSphere GetBoundingSphereAt(Transform probeTransform)
switch (shapeType)
switch (shape)
case ShapeType.Sphere:
return new BoundingSphere(transform.TransformPoint(sphereBaseOffset), sphereBaseRadius);
case ShapeType.Box:
case InfluenceShape.Sphere:
return new BoundingSphere(probeTransform.TransformPoint(offset), sphereRadius);
case InfluenceShape.Box:
var position = transform.TransformPoint(boxBaseOffset);
var radius = Mathf.Max(boxBaseSize.x, Mathf.Max(boxBaseSize.y, boxBaseSize.z));
var position = probeTransform.TransformPoint(offset);
var radius = Mathf.Max(boxSize.x, Mathf.Max(boxSize.y, boxSize.z));
public Bounds GetBoundsAt(Transform transform)
internal Bounds GetBoundsAt(Transform probeTransform)
switch (shapeType)
switch (shape)
case ShapeType.Sphere:
return new Bounds(transform.position, Vector3.one * sphereBaseRadius);
case ShapeType.Box:
case InfluenceShape.Sphere:
return new Bounds(probeTransform.position, Vector3.one * sphereRadius);
case InfluenceShape.Box:
var position = transform.TransformPoint(boxBaseOffset);
// TODO: Return a proper AABB based on influence box volume
return new Bounds(position, boxBaseSize);
var position = probeTransform.TransformPoint(offset);
return new Bounds(position, boxSize);
public Vector3 GetWorldPosition(Transform transform)
internal Vector3 GetWorldPosition(Transform probeTransform)
{
return probeTransform.TransformPoint(offset);
}
internal void MigrateOffsetSphere()
switch (shapeType)
if (shape == InfluenceShape.Sphere)
default:
case ShapeType.Sphere:
return transform.TransformPoint(sphereBaseOffset);
case ShapeType.Box:
return transform.TransformPoint(boxBaseOffset);
#pragma warning disable CS0618 // Type or member is obsolete
m_Offset = m_SphereBaseOffset;
#pragma warning restore CS0618 // Type or member is obsolete
}
}
}

42
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ProxyVolume.cs


using System;
using UnityEngine.Serialization;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

[SerializeField]
ShapeType m_ShapeType = ShapeType.Box;
[SerializeField, FormerlySerializedAs("m_ShapeType")]
ProxyShape m_Shape = ProxyShape.Box;
[SerializeField]
Vector3 m_BoxOffset;
[SerializeField]
[SerializeField, Obsolete("Kept only for compatibility. Use m_Shape instead")]
[SerializeField]
Vector3 m_SphereOffset;
[SerializeField]
[SerializeField, Obsolete("Kept only for compatibility. Use m_Shape instead")]
public ShapeType shapeType { get { return m_ShapeType; } }
/// <summary>The shape of the proxy</summary>
public ProxyShape shape { get { return m_Shape; } private set { m_Shape = value; } }
/// <summary>The size of the proxy if it as a shape Box</summary>
public Vector3 boxOffset { get { return m_BoxOffset; } set { m_BoxOffset = value; } }
public bool boxInfiniteProjection { get { return m_BoxInfiniteProjection; } }
/// <summary>The radius of the proxy if it as a shape Sphere</summary>
public Vector3 sphereOffset { get { return m_SphereOffset; } set { m_SphereOffset = value; } }
public bool sphereInfiniteProjection { get { return m_SphereInfiniteProjection; } }
public Vector3 extents
internal Vector3 extents
switch (shapeType)
switch (shape)
case ShapeType.Box: return m_BoxSize * 0.5f;
case ShapeType.Sphere: return Vector3.one * m_SphereRadius;
case ProxyShape.Box: return m_BoxSize * 0.5f;
case ProxyShape.Sphere: return Vector3.one * m_SphereRadius;
public bool infiniteProjection
internal void MigrateInfiniteProhjectionInShape()
get
#pragma warning disable CS0618 // Type or member is obsolete
if (shape == ProxyShape.Sphere && m_SphereInfiniteProjection
|| shape == ProxyShape.Box && m_BoxInfiniteProjection)
#pragma warning restore CS0618 // Type or member is obsolete
return shapeType == ShapeType.Box && boxInfiniteProjection
|| shapeType == ShapeType.Sphere && sphereInfiniteProjection;
shape = ProxyShape.Infinite;
}
}
}

32
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class ReflectionProxyVolumeComponent : MonoBehaviour
public class ReflectionProxyVolumeComponent : MonoBehaviour, ISerializationCallbackReceiver
enum Version
{
First,
IncludeInfiniteInShape,
// Add new version here and they will automatically be the Current one
Max,
Current = Max - 1
}
[SerializeField]
int m_Version;
/// <summary>Access to proxy volume parameters</summary>
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
if (m_Version != (int)Version.Current)
{
// Add here data migration code
if (m_Version < (int)Version.IncludeInfiniteInShape)
{
proxyVolume.MigrateInfiniteProhjectionInShape();
}
m_Version = (int)Version.Current;
}
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ShapeType.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public enum ShapeType
public enum InfluenceShape
{
Box,
Sphere,
}
public enum ProxyShape
Sphere
Sphere,
Infinite
}
}

2
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


bool enableBakeShadowMask;
using (new ProfilingSample(cmd, "TP_PrepareLightsForGPU", CustomSamplerId.TPPrepareLightsForGPU.GetSampler()))
{
enableBakeShadowMask = m_LightLoop.PrepareLightsForGPU(cmd, hdCamera, m_ShadowSettings, m_CullResults, m_ReflectionProbeCullResults, densityVolumes);
enableBakeShadowMask = m_LightLoop.PrepareLightsForGPU(cmd, hdCamera, m_ShadowSettings, m_CullResults, m_ReflectionProbeCullResults, densityVolumes, m_DebugDisplaySettings);
}
ConfigureForShadowMask(enableBakeShadowMask, cmd);
ConfigureForLightLayers(hdCamera.frameSettings.enableLightLayers, cmd);

1
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs


public static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap");
public static readonly int _Cubemap = Shader.PropertyToID("_Cubemap");
public static readonly int _InvOmegaP = Shader.PropertyToID("_InvOmegaP");
public static readonly int _SkyParam = Shader.PropertyToID("_SkyParam");
public static readonly int _PixelCoordToViewDirWS = Shader.PropertyToID("_PixelCoordToViewDirWS");

2
com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset


GGXConvolve: {fileID: 4800000, guid: 123ed592ad5c2494b8aed301fd609e7b, type: 3}
opaqueAtmosphericScattering: {fileID: 4800000, guid: 32f724728cf19904291226f239ec16f0, type: 3}
hdriSky: {fileID: 4800000, guid: 9bd32a6ece529fd4f9408b8d7e00c10d, type: 3}
integrateHdriSky: {fileID: 4800000, guid: 48db2705cf2856d4e893eb30a6892d1b, type: 3}
gradientSky: {fileID: 4800000, guid: 2b5d4f1b26f03dc4a873b093e0c4adb1, type: 3}
preIntegratedFGD_GGXDisneyDiffuse: {fileID: 4800000, guid: 123f13d52852ef547b2962de4bd9eaad, type: 3}
preIntegratedFGD_CharlieClothLambert: {fileID: 4800000, guid: 3b3bf235775cf8b4baae7f3306787ab0, type: 3}
encodeBC6HCS: {fileID: 7200000, guid: aa922d239de60304f964e24488559eeb, type: 3}

2
com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/RenderPipelineResources.cs


public Shader GGXConvolve;
public Shader opaqueAtmosphericScattering;
public Shader hdriSky;
public Shader integrateHdriSky;
public Shader gradientSky;
// Material
public Shader preIntegratedFGD_GGXDisneyDiffuse;

2
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISky.shader


}
Fallback Off
}
}

21
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/HDRISkyRenderer.cs


HDUtils.SetRenderTarget(builtinParams.commandBuffer, builtinParams.hdCamera, builtinParams.colorBuffer, builtinParams.depthBuffer);
}
}
float luxMultiplier = m_HdriSkyParams.desiredLuxValue.value / m_HdriSkyParams.upperHemisphereLuxValue.value;
float multiplier = (m_HdriSkyParams.skyIntensityMode == SkyIntensityMode.Exposure) ? m_HdriSkyParams.multiplier.value : luxMultiplier;
float exposure = (m_HdriSkyParams.skyIntensityMode == SkyIntensityMode.Exposure) ? GetExposure(m_HdriSkyParams, builtinParams.debugSettings) : 0;
m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(GetExposure(m_HdriSkyParams, builtinParams.debugSettings), m_HdriSkyParams.multiplier, -m_HdriSkyParams.rotation, 0.0f)); // -rotation to match Legacy...
m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(exposure, multiplier, -m_HdriSkyParams.rotation, 0.0f)); // -rotation to match Legacy...
// This matrix needs to be updated at the draw call frequency.
m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix);
CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, renderForCubemap ? 0 : 1);
using (new ProfilingSample(builtinParams.commandBuffer, "Draw sky"))
{
// This matrix needs to be updated at the draw call frequency.
m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix);
CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, renderForCubemap ? 0 : 1);
}
}
public override bool IsValid()

}
}
}

2
com.unity.render-pipelines.high-definition/HDRP/Sky/SkyRenderingContext.cs


}
}
}
}
}

31
com.unity.render-pipelines.high-definition/HDRP/Sky/SkySettings.cs


: base(value, overrideState) {}
}
public enum SkyIntensityMode
{
Exposure,
Lux,
}
[System.Flags]
public enum SkySettingsPropertyFlags
{
ShowMultiplierAndEV = (1 << 0),
ShowRotation = (1 << 1),
ShowUpdateMode = (1 << 2),
}
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public sealed class SkyIntensityParameter : VolumeParameter<SkyIntensityMode>
{
public SkyIntensityParameter(SkyIntensityMode value, bool overrideState = false)
: base(value, overrideState) {}
}
[Tooltip("Sky intensity mode")]
public SkyIntensityParameter skyIntensityMode = new SkyIntensityParameter(SkyIntensityMode.Exposure);
[Tooltip("Auto multiplier from the HDRI sky")]
public MinFloatParameter upperHemisphereLuxValue = new MinFloatParameter(1.0f, 0.0f);
[Tooltip("Lux intensity multiplier for the sky")]
public FloatParameter desiredLuxValue = new FloatParameter(20000);
[Tooltip("Specify how the environment lighting should be updated.")]
public EnvUpdateParameter updateMode = new EnvUpdateParameter(EnvironementUpdateMode.OnChanged);
[Tooltip("If environment update is set to realtime, period in seconds at which it is updated (0.0 means every frame).")]

hash = hash * 23 + rotation.GetHashCode();
hash = hash * 23 + exposure.GetHashCode();
hash = hash * 23 + multiplier.GetHashCode();
hash = hash * 23 + desiredLuxValue.GetHashCode();
hash = hash * 23 + ((int)skyIntensityMode.value).GetHashCode();
//<<<
hash = hash * 23 + updatePeriod.GetHashCode();

public abstract SkyRenderer CreateRenderer();
}
}
}

3
com.unity.render-pipelines.high-definition/HDRP/Sky/VisualEnvironment.cs


public enum SkyType
{
HDRISky = 1,
ProceduralSky = 2
ProceduralSky = 2,
Gradient = 3,
}
// Keep this class first in the file. Otherwise it seems that the script type is not registered properly.

16
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDAdditionalReflectionDataEditor.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
[CustomEditor(typeof(HDAdditionalReflectionData))]
[CanEditMultipleObjects]
partial class HDAdditionalReflectionDataEditor : Editor
{
public override void OnInspectorGUI()
{
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDAdditionalReflectionDataEditor.cs.meta


fileFormatVersion: 2
guid: 4937af65ea343b54d8f3d107a8f5828d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky.meta


fileFormatVersion: 2
guid: d02d7d4257904854f91435453078fd44
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs.orig
文件差异内容过多而无法显示
查看文件

75
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs.orig


using UnityEngine.Rendering;
using UnityEngine.Serialization;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[ExecuteInEditMode]
public abstract class HDProbe : MonoBehaviour, ISerializationCallbackReceiver
{
[SerializeField, FormerlySerializedAs("proxyVolumeComponent"), FormerlySerializedAs("m_ProxyVolumeReference")]
ReflectionProxyVolumeComponent m_ProxyVolume = null;
[SerializeField]
InfluenceVolume m_InfluenceVolume;
[SerializeField, FormerlySerializedAsAttribute("dimmer"), FormerlySerializedAsAttribute("m_Dimmer"), FormerlySerializedAsAttribute("multiplier")]
float m_Multiplier = 1.0f;
[SerializeField, FormerlySerializedAsAttribute("weight")]
[Range(0.0f, 1.0f)]
float m_Weight = 1.0f;
[SerializeField]
ReflectionProbeMode m_Mode = ReflectionProbeMode.Baked;
[SerializeField]
ReflectionProbeRefreshMode m_RefreshMode = ReflectionProbeRefreshMode.OnAwake;
/// <summary>ProxyVolume currently used by this probe.</summary>
public ReflectionProxyVolumeComponent proxyVolume { get { return m_ProxyVolume; } }
/// <summary>InfluenceVolume of the probe.</summary>
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } private set { m_InfluenceVolume = value; } }
/// <summary>Multiplier factor of reflection (non PBR parameter).</summary>
public float multiplier { get { return m_Multiplier; } }
/// <summary>Weight for blending amongst probes (non PBR parameter).</summary>
public float weight { get { return m_Weight; } }
/// <summary>The capture mode.</summary>
public virtual ReflectionProbeMode mode
{
get { return m_Mode; }
set { m_Mode = value; }
}
/// <summary>Refreshing rate of the capture for Realtime capture mode.</summary>
public virtual ReflectionProbeRefreshMode refreshMode
{
get { return m_RefreshMode; }
set { m_RefreshMode = value; }
}
<<<<<<< HEAD
void Awake()
=======
internal void Awake()
>>>>>>> HDRP/staging
{
if (influenceVolume == null)
influenceVolume = new InfluenceVolume();
influenceVolume.Init(this);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
influenceVolume.Init(this);
}
internal virtual void UpdatedInfluenceVolumeShape(Vector3 size, Vector3 offset) { }
}
}

8
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky.meta


fileFormatVersion: 2
guid: 4eaf64d2d64c8fb45b1e85eefff62dd7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

88
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader


Shader "Hidden/HDRenderPipeline/IntegrateHDRI"
{
Properties
{
[HideInInspector]
_Cubemap ("", CUBE) = "white" {}
}
SubShader
{
Tags{ "RenderPipeline" = "HDRenderPipeline" }
Pass
{
ZTest Always Cull Off ZWrite Off
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Frag
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Color.hlsl"
#include "CoreRP/ShaderLibrary/ImageBasedLighting.hlsl"
#include "../../ShaderVariables.hlsl"
struct Attributes
{
uint vertexID : SV_VertexID;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 texCoord : TEXCOORD0;
};
TextureCube<float4> _Cubemap;
Varyings Vert(Attributes input)
{
Varyings output;
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID);
output.texCoord = GetFullScreenTriangleTexCoord(input.vertexID);
return output;
}
// With HDRI that have a large range (including the sun) it can be challenging to
// compute the lux value without multiple importance sampling.
// We instead use a brute force Uniforme Spherical integration of the upper hemisphere
// with a large number of sample. This is fine as this happen in the editor.
real GetUpperHemisphereLuxValue(TEXTURECUBE_ARGS(skybox, sampler_skybox), real3 N)
{
float sum = 0.0;
float dphi = 0.005;
float dtheta = 0.005;
for (float phi = 0; phi < 2.0 * PI; phi += dphi)
{
for (float theta = 0; theta < PI / 2.0; theta += dtheta)
{
// SphericalToCartesian function is for Z up, lets move to Y up with TransformGLtoDX
float3 L = TransformGLtoDX(SphericalToCartesian(phi, cos(theta)));
real val = Luminance(SAMPLE_TEXTURECUBE_LOD(skybox, sampler_skybox, L, 0).rgb);
sum += cos(theta) * sin(theta) * val;
}
}
sum *= dphi * dtheta;
return sum;
}
float4 Frag(Varyings input) : SV_Target
{
// Integrate upper hemisphere (Y up)
float3 N = float3(0.0, 1.0, 0.0);
float intensity = GetUpperHemisphereLuxValue(TEXTURECUBE_PARAM(_Cubemap, s_trilinear_clamp_sampler), N);
return float4(intensity, 1.0, 1.0, 1.0);
}
ENDHLSL
}
}
Fallback Off
}

9
com.unity.render-pipelines.high-definition/HDRP/Sky/HDRISky/IntegrateHDRISky.shader.meta


fileFormatVersion: 2
guid: 48db2705cf2856d4e893eb30a6892d1b
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

42
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs


using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
[CanEditMultipleObjects]
[VolumeComponentEditor(typeof(GradientSky))]
public class GradientSkySettingsEditor : SkySettingsEditor
{
SerializedDataParameter m_Bottom;
SerializedDataParameter m_Middle;
SerializedDataParameter m_Top;
SerializedDataParameter m_GradientMultiplier;
public override void OnEnable()
{
base.OnEnable();
var o = new PropertyFetcher<GradientSky>(serializedObject);
m_Bottom = Unpack(o.Find(x => x.bottom));
m_Middle = Unpack(o.Find(x => x.middle));
m_Top = Unpack(o.Find(x => x.top));
m_GradientMultiplier = Unpack(o.Find(x => x.gradientDiffusion));
}
public override void OnInspectorGUI()
{
PropertyField(m_Top);
PropertyField(m_Middle);
PropertyField(m_Bottom);
PropertyField(m_GradientMultiplier);
EditorGUILayout.Space();
m_CommonUIElementsMask = (uint)SkySettingsUIElement.UpdateMode;
base.CommonSkySettingsGUI();
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/GradientSky/GradientSkyEditor.cs.meta


fileFormatVersion: 2
guid: 8d9ef3fb3b5232a4abaebf916d7a1108
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

32
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[SkyUniqueID((int)SkyType.Gradient)]
public class GradientSky : SkySettings
{
public ColorParameter top = new ColorParameter(Color.blue, true, false, true);
public ColorParameter middle = new ColorParameter(new Color(0.3f, 0.7f, 1f), true, false, true);
public ColorParameter bottom = new ColorParameter(Color.white, true, false, true);
public FloatParameter gradientDiffusion = new FloatParameter(1);
public override SkyRenderer CreateRenderer()
{
return new GradientSkyRenderer(this);
}
public override int GetHashCode()
{
int hash = base.GetHashCode();
unchecked
{
hash = 13;
hash = hash * 23 + bottom.GetHashCode();
hash = hash * 23 + top.GetHashCode();
hash = hash * 23 + middle.GetHashCode();
hash = hash * 23 + gradientDiffusion.GetHashCode();
}
return hash;
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.cs.meta


fileFormatVersion: 2
guid: a81bcacc415a1f743bfdf703afc52027
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader.meta


fileFormatVersion: 2
guid: 2b5d4f1b26f03dc4a873b093e0c4adb1
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

63
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs


using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
public class GradientSkyRenderer : SkyRenderer
{
Material m_GradientSkyMaterial; // Renders a cubemap into a render texture (can be cube or 2D)
MaterialPropertyBlock m_PropertyBlock;
GradientSky m_GradientSkyParams;
readonly int _GradientBottom = Shader.PropertyToID("_GradientBottom");
readonly int _GradientMiddle = Shader.PropertyToID("_GradientMiddle");
readonly int _GradientTop = Shader.PropertyToID("_GradientTop");
readonly int _GradientDiffusion = Shader.PropertyToID("_GradientDiffusion");
public GradientSkyRenderer(GradientSky GradientSkyParams)
{
m_GradientSkyParams = GradientSkyParams;
m_PropertyBlock = new MaterialPropertyBlock();
}
public override void Build()
{
var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
m_GradientSkyMaterial = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.gradientSky);
}
public override void Cleanup()
{
CoreUtils.Destroy(m_GradientSkyMaterial);
}
public override void SetRenderTargets(BuiltinSkyParameters builtinParams)
{
if (builtinParams.depthBuffer == BuiltinSkyParameters.nullRT)
{
HDUtils.SetRenderTarget(builtinParams.commandBuffer, builtinParams.hdCamera, builtinParams.colorBuffer);
}
else
{
HDUtils.SetRenderTarget(builtinParams.commandBuffer, builtinParams.hdCamera, builtinParams.colorBuffer, builtinParams.depthBuffer);
}
}
public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderForCubemap, bool renderSunDisk)
{
m_GradientSkyMaterial.SetColor(_GradientBottom, m_GradientSkyParams.bottom);
m_GradientSkyMaterial.SetColor(_GradientMiddle, m_GradientSkyParams.middle);
m_GradientSkyMaterial.SetColor(_GradientTop, m_GradientSkyParams.top);
m_GradientSkyMaterial.SetFloat(_GradientDiffusion, m_GradientSkyParams.gradientDiffusion);
// This matrix needs to be updated at the draw call frequency.
m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix);
CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_GradientSkyMaterial, m_PropertyBlock, renderForCubemap ? 0 : 1);
}
public override bool IsValid()
{
return m_GradientSkyParams != null && m_GradientSkyMaterial != null;
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSkyRenderer.cs.meta


fileFormatVersion: 2
guid: 932fb63537938154fbe7249e1bbeb2e3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

81
com.unity.render-pipelines.high-definition/HDRP/Sky/GradientSky/GradientSky.shader


Shader "Hidden/HDRenderPipeline/Sky/GradientSky"
{
HLSLINCLUDE
#pragma vertex Vert
#pragma fragment Frag
#pragma target 4.5
#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "CoreRP/ShaderLibrary/Color.hlsl"
#include "CoreRP/ShaderLibrary/CommonLighting.hlsl"
#include "HDRP/ShaderVariables.hlsl"
float4x4 _PixelCoordToViewDirWS; // Actually just 3x3, but Unity can only set 4x4
float4 _GradientBottom;
float4 _GradientMiddle;
float4 _GradientTop;
float _GradientDiffusion;
struct Attributes
{
uint vertexID : SV_VertexID;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
};
Varyings Vert(Attributes input)
{
Varyings output;
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID, UNITY_RAW_FAR_CLIP_VALUE);
return output;
}
float4 Frag(Varyings input) : SV_Target
{
float3 viewDirWS = normalize(mul(float3(input.positionCS.xy, 1.0), (float3x3)_PixelCoordToViewDirWS));
float verticalGradient = viewDirWS.y * _GradientDiffusion;
float topLerpFactor = saturate(-verticalGradient);
float bottomLerpFactor = saturate(verticalGradient);
float3 color = lerp(_GradientMiddle.xyz, _GradientBottom.xyz, bottomLerpFactor);
color = lerp(color, _GradientTop.xyz, topLerpFactor);
return float4 (color, 1.0);
}
ENDHLSL
SubShader
{
Pass
{
ZWrite Off
ZTest Always
Blend Off
Cull Off
HLSLPROGRAM
ENDHLSL
}
Pass
{
ZWrite Off
ZTest LEqual
Blend Off
Cull Off
HLSLPROGRAM
ENDHLSL
}
}
Fallback Off
}

8
com.unity.render-pipelines.high-definition/HDRP/Sky/AtmosphericScattering.meta


fileFormatVersion: 2
guid: d522828bc0314e14cb6faa4291bb64da
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存