浏览代码

Merge branch 'master' into StackLit2

# Conflicts:
#	com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.hlsl
/StackLit2
Stephane Laroche 6 年前
当前提交
cbb9a885
共有 283 个文件被更改,包括 28501 次插入16536 次删除
  1. 63
      TestProjects/HDRP_Tests/Assets/GraphicTests/Common/TestRunner/HDRP_GraphicTestRunner.cs
  2. 7
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity
  3. 2
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity.meta
  4. 5
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2102_GI_Emission.unity
  5. 2
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2102_GI_Emission.unity.meta
  6. 6
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2103_BakeMixed.unity
  7. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1101_Unlit.png
  8. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1101_Unlit.png.meta
  9. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1102_Unlit_Distortion.png
  10. 13
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1102_Unlit_Distortion.png.meta
  11. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1103_Unlit_Distortion_DepthTest.png
  12. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1103_Unlit_Distortion_DepthTest.png.meta
  13. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1201_Lit_Features.png
  14. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1201_Lit_Features.png.meta
  15. 738
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1202_Lit_DoubleSideNormalMode.png
  16. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1202_Lit_DoubleSideNormalMode.png.meta
  17. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1204_Lit_Transparent_Fog.png
  18. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1204_Lit_Transparent_Fog.png.meta
  19. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1207_Lit_Displacement.png
  20. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1207_Lit_Displacement.png.meta
  21. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1208_Lit_Displacement_POM.png
  22. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1208_Lit_Displacement_POM.png.meta
  23. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1209_Lit_Displacement_Vertex.png
  24. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1209_Lit_Displacement_Vertex.png.meta
  25. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1210_Lit_BentNormal.png
  26. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1210_Lit_BentNormal.png.meta
  27. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1211_Lit_Details.png
  28. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1211_Lit_Details.png.meta
  29. 790
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1212_Lit_Emission.png
  30. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1212_Lit_Emission.png.meta
  31. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1302_SSS_MaxRadius.png
  32. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1302_SSS_MaxRadius.png.meta
  33. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1303_SSS_Pre-Post.png
  34. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1303_SSS_Pre-Post.png.meta
  35. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2001_Dynamic_Directional.png
  36. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2001_Dynamic_Directional.png.meta
  37. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2002_Dynamic_Mix.png
  38. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2002_Dynamic_Mix.png.meta
  39. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2003_Light_Parameters.png
  40. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2003_Light_Parameters.png.meta
  41. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2101_GI_Metapass.png
  42. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2101_GI_Metapass.png.meta
  43. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2102_GI_Emission.png
  44. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2102_GI_Emission.png.meta
  45. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2103_BakeMixed.png
  46. 952
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2201_ReflectionProbes_Priority.png
  47. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2201_ReflectionProbes_Priority.png.meta
  48. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2202_ReflectionProbes_Volume.png
  49. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2202_ReflectionProbes_Volume.png.meta
  50. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2203_PlanarProbes.png
  51. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2203_PlanarProbes.png.meta
  52. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2401_Light_on_Tesselation.png
  53. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2401_Light_on_Tesselation.png.meta
  54. 999
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9001_Decals.png
  55. 2
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9001_Decals.png.meta
  56. 118
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0006_Std_Empty_Deferred_HDR.png
  57. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0100_Std_FXAA.png
  58. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0101_Std_FXAA_Fast.png
  59. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0102_Std_SMAA.png
  60. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0200_Std_Vignette.png
  61. 797
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0201_Std_LensDistort.png
  62. 764
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0202_Std_LensUnDistort.png
  63. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0203_Std_ChromaticAberration.png
  64. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0204_Std_ChromaticAberration_Fast.png
  65. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0205_Std_Grain.png
  66. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0206_Std_Grain_Colored.png
  67. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0207_Std_Bloom_HDR.png
  68. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0208_Std_Bloom_HDR_Fast.png
  69. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0209_Std_Bloom_LDR.png
  70. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0210_Std_Bloom_LDR_Fast.png
  71. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0211_Std_LensDirt.png
  72. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0212_Std_ColorGrading_HDR_Neutral.png
  73. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0213_Std_ColorGrading_LDR_Neutral.png
  74. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0214_Std_ColorGrading_HDR_Mix.png
  75. 999
      TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0215_Std_ColorGrading_LDR_Mix.png
  76. 83
      com.unity.render-pipelines.core/CoreRP/Editor/CoreEditorUtils.cs
  77. 4
      com.unity.render-pipelines.core/CoreRP/Editor/com.unity.render-pipelines.core.Editor.asmdef
  78. 17
      com.unity.render-pipelines.core/CoreRP/ShaderLibrary/Common.hlsl
  79. 13
      com.unity.render-pipelines.core/CoreRP/ShaderLibrary/UnityInstancing.hlsl
  80. 15
      com.unity.render-pipelines.core/CoreRP/Utilities/CoreUtils.cs
  81. 3
      com.unity.render-pipelines.core/CoreRP/com.unity.render-pipelines.core.Runtime.asmdef
  82. 5
      com.unity.render-pipelines.core/package.json
  83. 15
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  84. 2
      com.unity.render-pipelines.high-definition/HDRP/Camera/HDCamera.cs
  85. 5
      com.unity.render-pipelines.high-definition/HDRP/Editor/AssetProcessors/NormalMapAverageLengthTexturePostprocessor.cs
  86. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/BuildProcessors/HDRPreprocessShaders.cs
  87. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.Styles.cs
  88. 263
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs
  89. 378
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
  90. 337
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  91. 38
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs
  92. 84
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Drawers.cs
  93. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.cs
  94. 43
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs
  95. 127
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
  96. 24
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs
  97. 171
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs
  98. 55
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs
  99. 49
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedInfluenceVolume.cs
  100. 24
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Volumetric/DensityVolumeEditor.cs

63
TestProjects/HDRP_Tests/Assets/GraphicTests/Common/TestRunner/HDRP_GraphicTestRunner.cs


using UnityEngine.SceneManagement;
using UnityEngine.Events;
public class HDRP_GraphicTestRunner
#if UNITY_EDITOR
using UnityEditor;
using EditorSceneManagement = UnityEditor.SceneManagement;
#endif
public class HDRP_GraphicTestRunner : IPrebuildSetup
{
[UnityTest, Category("HDRP Graphic Tests")]
[PrebuildSetup("SetupGraphicsTestCases")]

ImageAssert.AreEqual(testCase.ReferenceImage, camera, (settings != null)?settings.ImageComparisonSettings:null);
}
public void Setup()
{
// Search for "InitTestSceneXXXXXXXX" generated by test runner and save the path in the EditorPrefs
for (int i=0 ; i<EditorSceneManagement.EditorSceneManager.sceneCount ; ++i)
{
Scene scene = EditorSceneManagement.EditorSceneManager.GetSceneAt(i);
if (scene.name.StartsWith("InitTestScene"))
{
EditorPrefs.SetString("InitTestScene", scene.path);
break;
}
}
string scenesWithAutoLightMap = "";
// For each scene in the build settings, force build of the lightmaps if it has "DoLightmap" label.
foreach( EditorBuildSettingsScene scene in EditorBuildSettings.scenes)
{
SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath<SceneAsset>(scene.path);
var labels = new System.Collections.Generic.List<string>(AssetDatabase.GetLabels(sceneAsset));
if ( labels.Contains("DoLightmap") )
{
EditorSceneManagement.EditorSceneManager.OpenScene(scene.path, EditorSceneManagement.OpenSceneMode.Single);
Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand;
EditorSceneManagement.EditorSceneManager.SaveOpenScenes();
Lightmapping.Clear();
Lightmapping.Bake();
scenesWithAutoLightMap += scene.path + ";";
EditorSceneManagement.EditorSceneManager.SaveOpenScenes();
Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.Iterative;
EditorSceneManagement.EditorSceneManager.SaveOpenScenes();
EditorSceneManagement.EditorSceneManager.NewScene(EditorSceneManagement.NewSceneSetup.EmptyScene);
}
}
EditorPrefs.SetString("ScenesWithAutoLightMap", scenesWithAutoLightMap);
// Re-open testrunner scene
string initTestSceneString = EditorPrefs.GetString("InitTestScene");
if (!string.IsNullOrEmpty(initTestSceneString))
{
EditorSceneManagement.EditorSceneManager.OpenScene(initTestSceneString, EditorSceneManagement.OpenSceneMode.Single);
}
#endif
}
#if UNITY_EDITOR
[TearDown]
public void DumpImagesInEditor()
{

7
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity


m_ReflectionIntensity: 0
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_GIWorkflowMode: 0
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1

m_PVRFilteringAtrousPositionSigmaIndirect: 0.5
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 0
m_LightingDataAsset: {fileID: 0}
m_LightingDataAsset: {fileID: 112000078, guid: e53c22e6000d3534f8ec90372eb92686,
type: 2}
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:

2
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity.meta


fileFormatVersion: 2
guid: 8747b43f8bcf2b44cbc3ece373da65a9
labels:
- DoLightmap
DefaultImporter:
externalObjects: {}
userData:

5
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2102_GI_Emission.unity


LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1

m_PVRFilteringAtrousPositionSigmaIndirect: 0.5
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_LightingDataAsset: {fileID: 112000016, guid: 10022f4aa0d773842b686156e2b35246,
type: 2}
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:

2
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2102_GI_Emission.unity.meta


fileFormatVersion: 2
guid: b8f49ca9a12abb4468116e9422139e63
labels:
- DoLightmap
DefaultImporter:
externalObjects: {}
userData:

6
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2103_BakeMixed.unity


LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1

m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 0
m_LightingDataAsset: {fileID: 0}
m_LightingDataAsset: {fileID: 112000024, guid: 69dfd70e8803cd341bd2ad557215bad1,
type: 2}
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:

shadowResolution: 512
shadowDimmer: 1
shadowFadeDistance: 10000
contactShadows: 0
viewBiasMin: 0.5
viewBiasMax: 10
viewBiasScale: 1

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1101_Unlit.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1101_Unlit.png.meta


fileFormatVersion: 2
guid: 29422fd325a32fb45bee86ca3d8a5792
guid: a3f1cb86a1e031a44bd3380ab40642cf
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1102_Unlit_Distortion.png
文件差异内容过多而无法显示
查看文件

13
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1102_Unlit_Distortion.png.meta


fileFormatVersion: 2
guid: ab25cbdf905bb3348b099f0182a70157
guid: 74ce626098389e144ae57a1c9e1ad613
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1103_Unlit_Distortion_DepthTest.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1103_Unlit_Distortion_DepthTest.png.meta


fileFormatVersion: 2
guid: e6a12a827816feb41bd228f12a420c92
guid: 5a59cd7fd9c84cb4ca0f998edbb72442
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1201_Lit_Features.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1201_Lit_Features.png.meta


fileFormatVersion: 2
guid: 060632995e01c4644963494d9d5fd420
guid: 71c7c49e531be7144abfa6166879b2bd
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

738
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1202_Lit_DoubleSideNormalMode.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1202_Lit_DoubleSideNormalMode.png.meta


fileFormatVersion: 2
guid: 16684469562502f4192c30df345844b0
guid: b930905dac1dbad41b286619df5ec5f8
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1204_Lit_Transparent_Fog.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1204_Lit_Transparent_Fog.png.meta


fileFormatVersion: 2
guid: 37c160a8d79010c47969f302bf9dc072
guid: 28453479a011f8a4ba5bbe56948f527c
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1207_Lit_Displacement.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1207_Lit_Displacement.png.meta


fileFormatVersion: 2
guid: 00e2fed2647af98468e746d3e95a445c
guid: 0ba4834b8b7100e418797ff02e96c9d6
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1208_Lit_Displacement_POM.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1208_Lit_Displacement_POM.png.meta


fileFormatVersion: 2
guid: 652ec006f3984174d95467d72286b2e5
guid: d974451c44ed49c44880a270bf3ee173
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1209_Lit_Displacement_Vertex.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1209_Lit_Displacement_Vertex.png.meta


fileFormatVersion: 2
guid: d938c81f4cadb6d4393038abc22bca56
guid: a56191ad86923ad47b8d829f06d681fd
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1210_Lit_BentNormal.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1210_Lit_BentNormal.png.meta


fileFormatVersion: 2
guid: 16f65effd3751974899fd75bb271fedf
guid: 0c058831feb827b4da8b5493313c9ee3
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1211_Lit_Details.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1211_Lit_Details.png.meta


fileFormatVersion: 2
guid: 23803071c6e34c246a818afc855c0bbd
guid: 81b531c1a653b214a88d19ec87caa9ca
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

790
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1212_Lit_Emission.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1212_Lit_Emission.png.meta


fileFormatVersion: 2
guid: 382d81bcfa34caa42a0a699f8bf310e8
guid: 348be4e79cdaae84e93c3c1a276f69d1
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1302_SSS_MaxRadius.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1302_SSS_MaxRadius.png.meta


fileFormatVersion: 2
guid: 4eba3b32508363f4c83782c8b635fa10
guid: bdccfc8627f65784e8bf8f3b00fabc63
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1303_SSS_Pre-Post.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1303_SSS_Pre-Post.png.meta


fileFormatVersion: 2
guid: e14235e8c1551a44e8f1e1f68dacc3ce
guid: 2cc5ed8d8f4f322408e2da22f28ad8ab
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2001_Dynamic_Directional.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2001_Dynamic_Directional.png.meta


fileFormatVersion: 2
guid: 7a350baa8208570499ede9fc3388002b
guid: b17db07781c685746b52f18865757d24
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2002_Dynamic_Mix.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2002_Dynamic_Mix.png.meta


fileFormatVersion: 2
guid: 78a909bee8bb0cf4abe7aed9381dfaad
guid: 394ab3665378c3147a4c75c7f26bf733
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2003_Light_Parameters.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2003_Light_Parameters.png.meta


fileFormatVersion: 2
guid: 7df4ebfc030ad0d4a979b337f15210e5
guid: ad5f20115920b39478e171fcab391bf9
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2101_GI_Metapass.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2101_GI_Metapass.png.meta


fileFormatVersion: 2
guid: 79be7b02e89daaa4f8fa3d8612647d00
guid: 987814de9d09eeb4b92576aa47e52309
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2102_GI_Emission.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2102_GI_Emission.png.meta


fileFormatVersion: 2
guid: cf0a82b6bb0141042aff3c1ac1153c9e
guid: e93459f56dd1e23459a84ccf407fb838
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2103_BakeMixed.png
文件差异内容过多而无法显示
查看文件

952
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2201_ReflectionProbes_Priority.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2201_ReflectionProbes_Priority.png.meta


fileFormatVersion: 2
guid: 53b350825a2eb804d9eed6dc0c488b57
guid: 086fc4453b19c6841907edb0cf6993b9
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2202_ReflectionProbes_Volume.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2202_ReflectionProbes_Volume.png.meta


fileFormatVersion: 2
guid: ac03e9a156283724684f225cab03b53b
guid: d8d801396bcd5154fb1b4ff4ab8cc746
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2203_PlanarProbes.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2203_PlanarProbes.png.meta


fileFormatVersion: 2
guid: 380d7a4256789364686cb39e1cc6f035
guid: 16f493e7fcda718489042231a9f95dc1
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2401_Light_on_Tesselation.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2401_Light_on_Tesselation.png.meta


fileFormatVersion: 2
guid: 2ea77960957c2de4e8b97509968d667a
guid: 881a8c46fb9b4da4aae259d745ff17ff
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

999
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9001_Decals.png
文件差异内容过多而无法显示
查看文件

2
TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9001_Decals.png.meta


fileFormatVersion: 2
guid: 4427616c627768b49a3ac5afc730a33d
guid: 68adaf19702f5e9428433924c1c0dd64
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}

118
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0006_Std_Empty_Deferred_HDR.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0100_Std_FXAA.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0101_Std_FXAA_Fast.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0102_Std_SMAA.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0200_Std_Vignette.png
文件差异内容过多而无法显示
查看文件

797
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0201_Std_LensDistort.png
文件差异内容过多而无法显示
查看文件

764
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0202_Std_LensUnDistort.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0203_Std_ChromaticAberration.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0204_Std_ChromaticAberration_Fast.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0205_Std_Grain.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0206_Std_Grain_Colored.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0207_Std_Bloom_HDR.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0208_Std_Bloom_HDR_Fast.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0209_Std_Bloom_LDR.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0210_Std_Bloom_LDR_Fast.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0211_Std_LensDirt.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0212_Std_ColorGrading_HDR_Neutral.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0213_Std_ColorGrading_LDR_Neutral.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0214_Std_ColorGrading_HDR_Mix.png
文件差异内容过多而无法显示
查看文件

999
TestProjects/PostProcessing/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/0215_Std_ColorGrading_LDR_Mix.png
文件差异内容过多而无法显示
查看文件

83
com.unity.render-pipelines.core/CoreRP/Editor/CoreEditorUtils.cs


return group.isExpanded;
}
static readonly GUIContent[] k_DrawVector6Slider_LabelPositives =
static readonly GUIContent[] k_DrawVector6_Label =
new GUIContent("+X"),
new GUIContent("+Y"),
new GUIContent("+Z"),
};
static readonly GUIContent[] k_DrawVector6Slider_LabelNegatives =
{
new GUIContent("-X"),
new GUIContent("-Y"),
new GUIContent("-Z"),
new GUIContent("X"),
new GUIContent("Y"),
new GUIContent("Z"),
public static void DrawVector6Slider(GUIContent label, SerializedProperty positive, SerializedProperty negative, Vector3 min, Vector3 max)
public static void DrawVector6(GUIContent label, SerializedProperty positive, SerializedProperty negative, Vector3 min, Vector3 max, Color[][] colors = null)
if (colors != null && (colors.Length != 2 || colors[0].Length != 3 || colors[1].Length != 3))
throw new System.ArgumentException("Colors must be a 2x3 array.");
EditorGUILayout.LabelField(label);
if(label != GUIContent.none)
EditorGUILayout.LabelField(label);
v = DrawVector3Slider(rect, k_DrawVector6Slider_LabelPositives, v, min, max);
v = DrawVector3(rect, k_DrawVector6_Label, v, min, max, false, colors == null ? null : colors[0]);
if (EditorGUI.EndChangeCheck())
positive.vector3Value = v;

v = negative.vector3Value;
EditorGUI.BeginChangeCheck();
v = DrawVector3Slider(rect, k_DrawVector6Slider_LabelNegatives, v, min, max);
v = DrawVector3(rect, k_DrawVector6_Label, v, min, max, true, colors == null ? null : colors[1]);
if (EditorGUI.EndChangeCheck())
negative.vector3Value = v;
--EditorGUI.indentLevel;

static Vector3 DrawVector3Slider(Rect rect, GUIContent[] labels, Vector3 value, Vector3 min, Vector3 max)
static Vector3 DrawVector3(Rect rect, GUIContent[] labels, Vector3 value, Vector3 min, Vector3 max, bool addMinusPrefix, Color[] colors)
// Use a corrected width due to the hacks used for layouting the slider properly below
rect.width -= 20;
var fieldWidth = rect.width / 3f;
float[] multifloat = new float[] { value.x, value.y, value.z };
rect = EditorGUI.IndentedRect(rect);
float fieldWidth = rect.width / 3f;
EditorGUI.BeginChangeCheck();
EditorGUI.MultiFloatField(rect, labels, multifloat);
if(EditorGUI.EndChangeCheck())
{
value.x = Mathf.Max(Mathf.Min(multifloat[0], max.x), min.x);
value.y = Mathf.Max(Mathf.Min(multifloat[1], max.y), min.y);
value.z = Mathf.Max(Mathf.Min(multifloat[2], max.z), min.z);
}
//Suffix is a hack as sublabel only work with 1 character
if(addMinusPrefix)
{
Rect suffixRect = new Rect(rect.x-33, rect.y, 100, rect.height);
for(int i = 0; i < 3; ++i)
{
EditorGUI.LabelField(suffixRect, "-");
suffixRect.x += fieldWidth + .5f;
}
}
for (var i = 0; i < 3; ++i)
//Color is a hack as nothing is done to handle this at the moment
if(colors != null)
var c = new Rect(rect.x + fieldWidth * i, rect.y, fieldWidth, rect.height);
var labelRect = new Rect(c.x, c.y, k_DrawVector6Slider_LabelSize, c.height);
var sliderRect = new Rect(labelRect.x + labelRect.width, c.y, c.width - k_DrawVector6Slider_LabelSize - k_DrawVector6Slider_FieldSize + 45, c.height);
var fieldRect = new Rect(sliderRect.x + sliderRect.width - 25, c.y, k_DrawVector6Slider_FieldSize, c.height);
EditorGUI.LabelField(labelRect, labels[i]);
value[i] = GUI.HorizontalSlider(sliderRect, value[i], min[i], max[i]);
value[i] = EditorGUI.FloatField(fieldRect, value[i]);
if (colors.Length != 3)
throw new System.ArgumentException("colors must have 3 elements.");
Rect suffixRect = new Rect(rect.x - 23, rect.y, 100, rect.height);
GUIStyle colorMark = new GUIStyle(EditorStyles.label);
colorMark.normal.textColor = colors[0];
EditorGUI.LabelField(suffixRect, "|", colorMark);
suffixRect.x += 1;
EditorGUI.LabelField(suffixRect, "|", colorMark);
suffixRect.x += fieldWidth - .5f;
colorMark.normal.textColor = colors[1];
EditorGUI.LabelField(suffixRect, "|", colorMark);
suffixRect.x += 1;
EditorGUI.LabelField(suffixRect, "|", colorMark);
suffixRect.x += fieldWidth + .5f;
colorMark.normal.textColor = colors[2];
EditorGUI.LabelField(suffixRect, "|", colorMark);
suffixRect.x += 1;
EditorGUI.LabelField(suffixRect, "|", colorMark);
}
return value;
}

4
com.unity.render-pipelines.core/CoreRP/Editor/com.unity.render-pipelines.core.Editor.asmdef


{
"name": "com.unity.render-pipelines.core.Editor",
"references": [
"com.unity.render-pipelines.core.Runtime",
"com.unity.postprocessing.Runtime",
"com.unity.postprocessing.Editor"
"com.unity.render-pipelines.core.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [

17
com.unity.render-pipelines.core/CoreRP/ShaderLibrary/Common.hlsl


// space at the end of the variable name
// WS: world space
// RWS: Camera-Relative world space. A space where the translation of the camera have already been substract in order to improve precision
// VS: view space
// OS: object space
// CS: Homogenous clip spaces

{
data ^= 1u << offset;
}
#ifndef INTRINSIC_WAVEREADFIRSTLANE
// Warning: for correctness, the argument's value must be the same across all lanes of the wave.

return ComputeTextureLOD(uv);
}
float ComputeTextureLOD(float3 Px, float3 Py, float3 Pz)
// LOD clamp is optional and happens outside the function.
float ComputeTextureLOD(float3 duvw_dx, float3 duvw_dy, float3 duvw_dz, float scale)
float d = max(dot(Px, Px), max(dot(Py, Py), dot(Pz, Pz)));
return max(0.0, 0.5 * log2(d));
float d = Max3(dot(duvw_dx, duvw_dx), dot(duvw_dy, duvw_dy), dot(duvw_dz, duvw_dz));
return 0.5 * log2(d * (scale * scale));
}

{
real dp3 = max(REAL_MIN, dot(inVec, inVec));
return inVec * rsqrt(dp3);
}
// Division which returns 1 for (inf/inf) and (0/0).
// If any of the input parameters are NaNs, the result is a NaN.
real SafeDiv(real numer, real denom)
{
return (numer != denom) ? numer / denom : 1;
}
// Generates a triangle in homogeneous clip space, s.t.

13
com.unity.render-pipelines.core/CoreRP/ShaderLibrary/UnityInstancing.hlsl


#endif
UNITY_INSTANCING_BUFFER_END(unity_Builtins2)
#define UNITY_MATRIX_M UNITY_ACCESS_INSTANCED_PROP(unity_Builtins0, unity_ObjectToWorldArray)
#ifdef MODIFY_MATRIX_FOR_CAMERA_RELATIVE_RENDERING
#define UNITY_MATRIX_M ApplyCameraTranslationToMatrix(UNITY_ACCESS_INSTANCED_PROP(unity_Builtins0, unity_ObjectToWorldArray))
#else
#define UNITY_MATRIX_M UNITY_ACCESS_INSTANCED_PROP(unity_Builtins0, unity_ObjectToWorldArray)
#endif
#define UNITY_MATRIX_I_M UNITY_ACCESS_INSTANCED_PROP(MERGE_UNITY_BUILTINS_INDEX(UNITY_WORLDTOOBJECTARRAY_CB), unity_WorldToObjectArray)
#ifdef MODIFY_MATRIX_FOR_CAMERA_RELATIVE_RENDERING
#define UNITY_MATRIX_I_M ApplyCameraTranslationToInverseMatrix(UNITY_ACCESS_INSTANCED_PROP(MERGE_UNITY_BUILTINS_INDEX(UNITY_WORLDTOOBJECTARRAY_CB), unity_WorldToObjectArray))
#else
#define UNITY_MATRIX_I_M UNITY_ACCESS_INSTANCED_PROP(MERGE_UNITY_BUILTINS_INDEX(UNITY_WORLDTOOBJECTARRAY_CB), unity_WorldToObjectArray)
#endif
#else // UNITY_INSTANCING_ENABLED

15
com.unity.render-pipelines.core/CoreRP/Utilities/CoreUtils.cs


using System.Collections.Generic;
using System.Linq;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
namespace UnityEngine.Experimental.Rendering
{

// we pass the first color target as the depth target. If it has 0 depth bits,
// no depth target ends up being bound.
DrawFullScreen(commandBuffer, material, colorBuffers, colorBuffers[0], properties, shaderPassId);
}
// Post-processing misc
public static bool IsPostProcessingActive(PostProcessLayer layer)
{
return layer != null
&& layer.enabled;
}
public static bool IsTemporalAntialiasingActive(PostProcessLayer layer)
{
return IsPostProcessingActive(layer)
&& layer.antialiasingMode == PostProcessLayer.Antialiasing.TemporalAntialiasing
&& layer.temporalAntialiasing.IsSupported();
}
// Color space utilities

3
com.unity.render-pipelines.core/CoreRP/com.unity.render-pipelines.core.Runtime.asmdef


{
"name": "com.unity.render-pipelines.core.Runtime",
"references": [
"com.unity.postprocessing.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],

5
com.unity.render-pipelines.core/package.json


"description": "Core library for Unity render pipelines.",
"version": "3.0.0-preview",
"unity": "2018.2",
"displayName": "Render Pipeline Core Library",
"dependencies": {
"com.unity.postprocessing": "2.0.7-preview"
}
"displayName": "Render Pipeline Core Library"
}

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


- Fixed apply range attenuation option on punctual light
- Fixed issue when using more than one volume mask texture with density volumes.
- Fixed an error which prevented volumetric lighting from working if no density volumes with 3D textures were present.
- Fixed issue with color temperature not take correctly into account with static lighting
- Don't display fog when diffuse lighting, specular lighting, or lux meter debug mode are enabled.
### Added
- Add option supportDitheringCrossFade on HDRP Asset to allow to remove shader variant during player build if needed

- Add an option to generate an emissive mesh for area lights (currently rectangle light only). The mesh fits the size, intensity and color of the light.
- Add an option to the HDRP asset to increase the resolution of volumetric lighting.
- Add additional ligth unit support for punctual light (Lumens, Candela) and area lights (Lumens, Luminance)
- Add dedicated Gizmo for the box Influence volume of HDReflectionProbe / PlanarReflectionProbe
- Change code in area light with LTC for Lit shader. Magnitude is now take from FGD texture instead of a separate texture.
- Change code in area light with LTC for Lit shader. Magnitude is now take from FGD texture instead of a separate texture
- Improve camera relative rendering: We now apply camera translation on the model matrix, so before the TransformObjectToWorld(). Note: unity_WorldToObject and unity_ObjectToWorld must never be used directly.
- Rename positionWS to positionRWS (Camera relative world position) at a lot of places (mainly in interpolator and FragInputs). In case of custom shader user will be required to update their code.
- Rename positionWS, capturePositionWS, proxyPositionWS, influencePositionWS to positionRWS, capturePositionRWS, proxyPositionRWS, influencePositionRWS (Camera relative world position) in LightDefinition struct.
- Improve the quality of trilinear filtering of density volume textures.
- Improve UI for HDReflectionProbe / PlanarReflectionProbe
- Fix issue with forward opaque lit shader variant being removed by the shader preprocessor
## [2.0.4-preview]

- Support correctly scene selection for alpha tested object
- Add per light shadow mask mode control (i.e shadow mask distance and shadow mask). It use the option NonLightmappedOnly
- Add geometric filtering to Lit shader (allow to reduce specular aliasing)
- Allow to double click on a render pipeline asset to setup it automatically in GraphicSettings
- Add shortcut to create DensityVolume and PlanarReflection in hierarchy
- Add a DefaultHDMirrorMaterial material for PlanarReflection
- Added a script to be able to upgrade material to newer version of HDRP

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


// If TAA is enabled projMatrix will hold a jittered projection matrix. The original,
// non-jittered projection matrix can be accessed via nonJitteredProjMatrix.
bool taaEnabled = camera.cameraType == CameraType.Game &&
CoreUtils.IsTemporalAntialiasingActive(postProcessLayer) &&
HDUtils.IsTemporalAntialiasingActive(postProcessLayer) &&
m_frameSettings.enablePostprocess;
var nonJitteredCameraProj = camera.projectionMatrix;

5
com.unity.render-pipelines.high-definition/HDRP/Editor/AssetProcessors/NormalMapAverageLengthTexturePostprocessor.cs


using System;
using UnityEditor;
using UnityEngine;
using System.IO;
public class NormalMapAverageLengthTexturePostprocessor : AssetPostprocessor
{

void OnPreprocessTexture()
{
// Any texture with _NA suffix will store average normal lenght in alpha
if (assetPath.IndexOf(s_Suffix, StringComparison.InvariantCultureIgnoreCase) != -1)
if (Path.GetFileNameWithoutExtension(assetPath).EndsWith(s_Suffix, StringComparison.InvariantCultureIgnoreCase))
{
// Make sure we don't convert as a normal map.
TextureImporter textureImporter = (TextureImporter)assetImporter;

void OnPostprocessTexture(Texture2D texture)
{
if (assetPath.IndexOf(s_Suffix, StringComparison.InvariantCultureIgnoreCase) != -1)
if (Path.GetFileNameWithoutExtension(assetPath).EndsWith(s_Suffix, StringComparison.InvariantCultureIgnoreCase))
{
// Based on The Order : 1886 SIGGRAPH course notes implementation. Sample all normal map
// texels from the base mip level that are within the footprint of the current mipmap texel.

8
com.unity.render-pipelines.high-definition/HDRP/Editor/BuildProcessors/HDRPreprocessShaders.cs


int inputShaderVariantCount = inputData.Count;
ShaderCompilerData workaround = inputData[0];
for (int i = 0; i < inputData.Count; ++i)
{
ShaderCompilerData input = inputData[i];

i--;
}
}
// Currently if a certain snippet is completely stripped (for example if you remove a whole pass) other passes might get broken
// To work around that, we make sure that we always have at least one variant.
// TODO: Remove this one it is fixed
if (inputData.Count == 0)
inputData.Add(workaround);
}
}
}

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.Styles.cs


public readonly GUIContent directionalIntensity = new GUIContent("Intensity (Lux)", "Illuminance of the directional light at ground level in lux.");
public readonly GUIContent punctualIntensity = new GUIContent("Intensity (Lumen)", "Luminous power of the light in lumen. Spotlight are considered as point light with barndoor so match intensity of a point light.");
public readonly GUIContent areaIntensity = new GUIContent("Intensity (Lumen)", "Luminous power of the light in lumen.");
public readonly GUIContent lightIntensity = new GUIContent("Intensity", "");
public readonly GUIContent maxSmoothness = new GUIContent("Max Smoothness", "Very low cost way of faking spherical area lighting. This will modify the roughness of the material lit. This is useful when the specular highlight is too small or too sharp.");
public readonly GUIContent affectDiffuse = new GUIContent("Affect Diffuse", "This will disable diffuse lighting for this light. Doesn't save performance, diffuse lighting is still computed.");

public readonly GUIContent shapeWidthBox = new GUIContent("Size X", "");
public readonly GUIContent shapeHeightBox = new GUIContent("Size Y", "");
public readonly GUIContent applyRangeAttenuation = new GUIContent("Apply Range Attenuation", "Allows disabling range attenuation. This is useful indoor (like a room) to avoid having to setup a large range for a light to get correct inverse square attenuation that may leak out of the indoor");
public readonly GUIContent displayAreaLightEmissiveMesh = new GUIContent("Display Emissive Mesh", "Generate an emissive mesh using the size, color and intensity of the area light");
public readonly GUIContent shape = new GUIContent("Type", "Specifies the current type of light. Possible types are Directional, Spot, Point, Rectangle and Line lights.");
public readonly GUIContent[] shapeNames;

263
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs


using System;
using System.Linq;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Experimental.Rendering;

sealed class SerializedLightData
{
public SerializedProperty directionalIntensity;
public SerializedProperty punctualIntensity;
public SerializedProperty areaIntensity;
public SerializedProperty intensity;
public SerializedProperty enableSpotReflector;
public SerializedProperty spotInnerPercent;
public SerializedProperty lightDimmer;

public SerializedProperty maxSmoothness;
public SerializedProperty applyRangeAttenuation;
public SerializedProperty volumetricDimmer;
public SerializedProperty lightUnit;
public SerializedProperty displayAreaLightEmissiveMesh;
// Editor stuff
public SerializedProperty useOldInspector;

//Disc,
}
enum DirectionalLightUnit
{
Lux = LightUnit.Lux,
}
enum AreaLightUnit
{
Lumen = LightUnit.Lumen,
Luminance = LightUnit.Luminance,
}
enum PunctualLightUnit
{
Lumen = LightUnit.Lumen,
Candela = LightUnit.Candela,
}
HDAdditionalLightData[] m_AdditionalLightDatas;
AdditionalShadowData[] m_AdditionalShadowDatas;
bool m_UpdateAreaLightEmissiveMeshComponents = false;
var lightData = CoreEditorUtils.GetAdditionalData<HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData);
var shadowData = CoreEditorUtils.GetAdditionalData<AdditionalShadowData>(targets, HDAdditionalShadowData.InitDefaultHDAdditionalShadowData);
m_SerializedAdditionalLightData = new SerializedObject(lightData);
m_SerializedAdditionalShadowData = new SerializedObject(shadowData);
m_AdditionalLightDatas = CoreEditorUtils.GetAdditionalData<HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData);
m_AdditionalShadowDatas = CoreEditorUtils.GetAdditionalData<AdditionalShadowData>(targets, HDAdditionalShadowData.InitDefaultHDAdditionalShadowData);
m_SerializedAdditionalLightData = new SerializedObject(m_AdditionalLightDatas);
m_SerializedAdditionalShadowData = new SerializedObject(m_AdditionalShadowDatas);
directionalIntensity = o.Find(x => x.directionalIntensity),
punctualIntensity = o.Find(x => x.punctualIntensity),
areaIntensity = o.Find(x => x.areaIntensity),
intensity = o.Find(x => x.displayLightIntensity),
lightUnit = o.Find(x => x.lightUnit),
displayAreaLightEmissiveMesh = o.Find(x => x.displayAreaLightEmissiveMesh),
fadeDistance = o.Find(x => x.fadeDistance),
affectDiffuse = o.Find(x => x.affectDiffuse),
affectSpecular = o.Find(x => x.affectSpecular),

edgeToleranceNormal = o.Find(x => x.edgeToleranceNormal),
edgeTolerance = o.Find(x => x.edgeTolerance)
};
// Update emissive mesh and light intensity when undo/redo
Undo.undoRedoPerformed += () => {
m_SerializedAdditionalLightData.ApplyModifiedProperties();
foreach (var hdLightData in m_AdditionalLightDatas)
if (hdLightData != null)
hdLightData.UpdateAreaLightEmissiveMesh();
};
}
public override void OnInspectorGUI()

m_SerializedAdditionalShadowData.ApplyModifiedProperties();
m_SerializedAdditionalLightData.ApplyModifiedProperties();
settings.ApplyModifiedProperties();
if (m_UpdateAreaLightEmissiveMeshComponents)
UpdateAreaLightEmissiveMeshComponents();
}
void DrawFoldout(SerializedProperty foldoutProperty, string title, Action func)

{
EditorGUI.BeginChangeCheck(); // For GI we need to detect any change on additional data and call SetLightDirty + For intensity we need to detect light shape change
EditorGUI.BeginChangeCheck();
if (EditorGUI.EndChangeCheck())
UpdateLightIntensityUnit();
if (m_LightShape != LightShape.Directional)
settings.DrawRange(false);

if (EditorGUI.EndChangeCheck())
{
UpdateLightIntensity();
UpdateLightScale();
m_UpdateAreaLightEmissiveMeshComponents = true;
// Caution: this function must match the one in HDAdditionalLightData.ConvertPhysicalLightIntensityToLightIntensity - any change need to be replicated
void UpdateLightIntensity()
void UpdateLightIntensityUnit()
// Clamp negative values.
m_AdditionalLightData.directionalIntensity.floatValue = Mathf.Max(0, m_AdditionalLightData.directionalIntensity.floatValue);
m_AdditionalLightData.punctualIntensity.floatValue = Mathf.Max(0, m_AdditionalLightData.punctualIntensity.floatValue);
m_AdditionalLightData.areaIntensity.floatValue = Mathf.Max(0, m_AdditionalLightData.areaIntensity.floatValue);
if (m_LightShape == LightShape.Directional)
m_AdditionalLightData.lightUnit.enumValueIndex = (int)DirectionalLightUnit.Lux;
else
m_AdditionalLightData.lightUnit.enumValueIndex = (int)LightUnit.Lumen;
}
switch (m_LightShape)
// Refect light size changes on transform local scale
void UpdateLightScale()
{
foreach (var hdLightData in m_AdditionalLightDatas)
{
switch (m_LightShape)
{
case LightShape.Line:
hdLightData.transform.localScale = new Vector3(m_AdditionalLightData.shapeWidth.floatValue, 0, 0);
break;
case LightShape.Rectangle:
hdLightData.transform.localScale = new Vector3(m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue, 0);
break;
case LightShape.Point:
case LightShape.Spot:
hdLightData.transform.localScale = Vector3.one * settings.range.floatValue;
break;
}
}
}
LightUnit LightIntensityUnitPopup(LightShape shape)
{
LightUnit selectedLightUnit;
LightUnit oldLigthUnit = (LightUnit)m_AdditionalLightData.lightUnit.enumValueIndex;
EditorGUI.BeginChangeCheck();
switch (shape)
settings.intensity.floatValue = m_AdditionalLightData.directionalIntensity.floatValue;
selectedLightUnit = (LightUnit)EditorGUILayout.EnumPopup((DirectionalLightUnit)m_AdditionalLightData.lightUnit.enumValueIndex);
settings.intensity.floatValue = LightUtils.ConvertPointLightIntensity(m_AdditionalLightData.punctualIntensity.floatValue);
case LightShape.Spot:
selectedLightUnit = (LightUnit)EditorGUILayout.EnumPopup((PunctualLightUnit)m_AdditionalLightData.lightUnit.enumValueIndex);
break;
default:
selectedLightUnit = (LightUnit)EditorGUILayout.EnumPopup((AreaLightUnit)m_AdditionalLightData.lightUnit.enumValueIndex);
}
if (EditorGUI.EndChangeCheck())
ConvertLightIntensity(oldLigthUnit, selectedLightUnit);
case LightShape.Spot:
// Spot should used conversion which take into account the angle, and thus the intensity vary with angle.
// This is not easy to manipulate for lighter, so we simply consider any spot light as just occluded point light. So reuse the same code.
return selectedLightUnit;
}
var spotLightShape = (SpotLightShape)m_AdditionalLightData.spotLightShape.enumValueIndex;
void ConvertLightIntensity(LightUnit oldLightUnit, LightUnit newLightUnit)
{
float intensity = m_AdditionalLightData.intensity.floatValue;
if (m_AdditionalLightData.enableSpotReflector.boolValue)
// For punctual lights
if (oldLightUnit == LightUnit.Lumen && newLightUnit == LightUnit.Candela)
{
if (m_LightShape == LightShape.Spot && m_AdditionalLightData.enableSpotReflector.boolValue)
{
// We have already calculate the correct value, just assign it
intensity = ((Light)target).intensity;
}
else
intensity = LightUtils.ConvertPointLightLumenToCandela(intensity);
}
if (oldLightUnit == LightUnit.Candela && newLightUnit == LightUnit.Lumen)
{
if (m_LightShape == LightShape.Spot && m_AdditionalLightData.enableSpotReflector.boolValue)
{
// We just need to multiply candela by solid angle in this case
if ((SpotLightShape)m_AdditionalLightData.spotLightShape.enumValueIndex == SpotLightShape.Cone)
intensity = LightUtils.ConvertSpotLightCandelaToLumen(intensity, ((Light)target).spotAngle * Mathf.Deg2Rad, true);
else if ((SpotLightShape)m_AdditionalLightData.spotLightShape.enumValueIndex == SpotLightShape.Pyramid)
if (spotLightShape == SpotLightShape.Cone)
{
settings.intensity.floatValue = LightUtils.ConvertSpotLightIntensity(m_AdditionalLightData.punctualIntensity.floatValue, settings.spotAngle.floatValue * Mathf.Deg2Rad, true);
}
else if (spotLightShape == SpotLightShape.Pyramid)
{
float angleA, angleB;
LightUtils.CalculateAnglesForPyramid(m_AdditionalLightData.aspectRatio.floatValue, settings.spotAngle.floatValue,
out angleA, out angleB);
float angleA, angleB;
LightUtils.CalculateAnglesForPyramid(m_AdditionalLightData.aspectRatio.floatValue, ((Light)target).spotAngle * Mathf.Deg2Rad, out angleA, out angleB);
settings.intensity.floatValue = LightUtils.ConvertFrustrumLightIntensity(m_AdditionalLightData.punctualIntensity.floatValue, angleA, angleB);
}
else // Box shape, fallback to punctual light.
{
settings.intensity.floatValue = LightUtils.ConvertPointLightIntensity(m_AdditionalLightData.punctualIntensity.floatValue);
}
}
else // Reflector disabled, fallback to punctual light.
{
settings.intensity.floatValue = LightUtils.ConvertPointLightIntensity(m_AdditionalLightData.punctualIntensity.floatValue);
intensity = LightUtils.ConvertFrustrumLightCandelaToLumen(intensity, angleA, angleB);
break;
else // Box
intensity = LightUtils.ConvertPointLightCandelaToLumen(intensity);
}
else
intensity = LightUtils.ConvertPointLightCandelaToLumen(intensity);
}
case LightShape.Rectangle:
settings.intensity.floatValue = LightUtils.ConvertRectLightIntensity(m_AdditionalLightData.areaIntensity.floatValue, m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue);
break;
case LightShape.Line:
settings.intensity.floatValue = LightUtils.CalculateLineLightIntensity(m_AdditionalLightData.areaIntensity.floatValue, m_AdditionalLightData.shapeWidth.floatValue);
break;
// For area lights
if (oldLightUnit == LightUnit.Lumen && newLightUnit == LightUnit.Luminance)
{
if (m_LightShape == LightShape.Rectangle)
intensity = LightUtils.ConvertRectLightLumenToLuminance(intensity, m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue);
else if (m_LightShape == LightShape.Line)
intensity = LightUtils.CalculateLineLightLumenToLuminance(intensity, m_AdditionalLightData.shapeWidth.floatValue);
}
if (oldLightUnit == LightUnit.Luminance && newLightUnit == LightUnit.Lumen)
{
if (m_LightShape == LightShape.Rectangle)
intensity = LightUtils.ConvertRectLightLuminanceToLumen(intensity, m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue);
else if (m_LightShape == LightShape.Line)
intensity = LightUtils.CalculateLineLightLuminanceToLumen(intensity, m_AdditionalLightData.shapeWidth.floatValue);
m_AdditionalLightData.intensity.floatValue = intensity;
void DrawLightSettings()
void UpdateAreaLightEmissiveMeshComponents()
settings.DrawColor();
foreach (var hdLightData in m_AdditionalLightDatas)
{
hdLightData.UpdateAreaLightEmissiveMesh();
MeshRenderer emissiveMeshRenderer = hdLightData.GetComponent<MeshRenderer>();
MeshFilter emissiveMeshFilter = hdLightData.GetComponent<MeshFilter>();
EditorGUI.BeginChangeCheck();
// If the display emissive mesh is disabled, skip to the next selected light
if (emissiveMeshFilter == null || emissiveMeshRenderer == null)
continue ;
switch (m_LightShape)
{
case LightShape.Directional:
EditorGUILayout.PropertyField(m_AdditionalLightData.directionalIntensity, s_Styles.directionalIntensity);
break;
// We only load the mesh and it's material here, because we can't do that inside HDAdditionalLightData (Editor assembly)
// Every other properties of the mesh is updated in HDAdditionalLightData to support timeline and editor records
emissiveMeshFilter.mesh = UnityEditor.Experimental.Rendering.HDPipeline.HDEditorUtils.LoadAsset< Mesh >("RenderPipelineResources/Quad.FBX");
if (emissiveMeshRenderer.sharedMaterial == null)
emissiveMeshRenderer.material = new Material(Shader.Find("HDRenderPipeline/Unlit"));
}
case LightShape.Point:
case LightShape.Spot:
EditorGUILayout.PropertyField(m_AdditionalLightData.punctualIntensity, s_Styles.punctualIntensity);
m_UpdateAreaLightEmissiveMeshComponents = false;
}
// Only display reflector option if it make sense
if (m_LightShape == LightShape.Spot)
{
var spotLightShape = (SpotLightShape)m_AdditionalLightData.spotLightShape.enumValueIndex;
if (spotLightShape == SpotLightShape.Cone || spotLightShape == SpotLightShape.Pyramid)
EditorGUILayout.PropertyField(m_AdditionalLightData.enableSpotReflector, s_Styles.enableSpotReflector);
}
break;
void DrawLightSettings()
{
settings.DrawColor();
case LightShape.Rectangle:
case LightShape.Line:
EditorGUILayout.PropertyField(m_AdditionalLightData.areaIntensity, s_Styles.areaIntensity);
break;
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(m_AdditionalLightData.intensity, s_Styles.lightIntensity);
m_AdditionalLightData.lightUnit.enumValueIndex = (int)LightIntensityUnitPopup(m_LightShape);
EditorGUILayout.EndHorizontal();
if (EditorGUI.EndChangeCheck())
// Only display reflector option if it make sense
if (m_LightShape == LightShape.Spot)
UpdateLightIntensity();
var spotLightShape = (SpotLightShape)m_AdditionalLightData.spotLightShape.enumValueIndex;
if ((spotLightShape == SpotLightShape.Cone || spotLightShape == SpotLightShape.Pyramid)
&& m_AdditionalLightData.lightUnit.enumValueIndex == (int)PunctualLightUnit.Lumen)
EditorGUILayout.PropertyField(m_AdditionalLightData.enableSpotReflector, s_Styles.enableSpotReflector);
}
settings.DrawBounceIntensity();

EditorGUI.BeginChangeCheck(); // For GI we need to detect any change on additional data and call SetLightDirty
// No cookie with area light (maybe in future textured area light ?)
if (m_LightShape != LightShape.Rectangle && m_LightShape != LightShape.Line)
if (!HDAdditionalLightData.IsAreaLight(m_AdditionalLightData.lightTypeExtent))
{
settings.DrawCookie();

EditorGUILayout.PropertyField(m_AdditionalLightData.volumetricDimmer, s_Styles.volumetricDimmer);
if (m_LightShape != LightShape.Directional)
EditorGUILayout.PropertyField(m_AdditionalLightData.applyRangeAttenuation, s_Styles.applyRangeAttenuation);
// Emissive mesh for area light only
if (HDAdditionalLightData.IsAreaLight(m_AdditionalLightData.lightTypeExtent))
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_AdditionalLightData.displayAreaLightEmissiveMesh, s_Styles.displayAreaLightEmissiveMesh);
if (EditorGUI.EndChangeCheck())
m_UpdateAreaLightEmissiveMeshComponents = true;
}
EditorGUI.indentLevel--;
}

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


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

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);
internal static readonly Color[][] k_handlesColor = new Color[][]
{
new Color[]
{
Color.red,
Color.green,
Color.blue
},
new Color[]
{
new Color(.5f, 0f, 0f, 1f),
new Color(0f, .5f, 0f, 1f),
new Color(0f, 0f, .5f, 1f)
}
};
void OnSceneGUI()
{
var s = m_UIState;

static void Handle_InfluenceFadeEditing(HDReflectionProbeUI s, SerializedHDReflectionProbe sp, Editor o, InfluenceType influenceType)
{
BoxBoundsHandle blendBox;
Gizmo6FacesBoxContained alternativeBlendBox;
SphereBoundsHandle sphereHandle;
Vector3 probeBlendDistancePositive, probeBlendDistanceNegative;
Color color;

case InfluenceType.Standard:
{
blendBox = s.boxBlendHandle;
sphereHandle = s.sphereBlendHandle;
probeBlendDistancePositive = sp.targetData.blendDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendDistanceNegative;
color = k_GizmoThemeColorInfluenceBlend;
break;
}
{
alternativeBlendBox = s.alternativeBoxBlendHandle;
sphereHandle = s.sphereBlendHandle;
probeBlendDistancePositive = sp.targetData.blendDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendDistanceNegative;
color = k_GizmoThemeColorInfluenceBlend;
break;
}
{
blendBox = s.boxBlendNormalHandle;
sphereHandle = s.sphereBlendNormalHandle;
probeBlendDistancePositive = sp.targetData.blendNormalDistancePositive;
probeBlendDistanceNegative = sp.targetData.blendNormalDistanceNegative;
color = k_GizmoThemeColorInfluenceNormalBlend;
break;
}
{
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;

case ShapeType.Box:
{
blendBox.center = sp.target.center - (probeBlendDistancePositive - probeBlendDistanceNegative) * 0.5f;
blendBox.size = sp.target.size - probeBlendDistancePositive - probeBlendDistanceNegative;
{
alternativeBlendBox.center = sp.target.center - (probeBlendDistancePositive - probeBlendDistanceNegative) * 0.5f;
alternativeBlendBox.size = sp.target.size - probeBlendDistancePositive - probeBlendDistanceNegative;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
Handles.color = color;
blendBox.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(sp.target, "Modified Reflection Probe Influence");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe Influence");
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 center = sp.target.center;
var influenceSize = sp.target.size;
var diff = 2 * (blendBox.center - center);
var sum = influenceSize - blendBox.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));
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;
probeBlendDistancePositive = blendDistancePositive;
probeBlendDistanceNegative = blendDistanceNegative;
ApplyConstraintsOnTargets(s, sp, o);
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
{
sphereHandle.center = sp.target.center;
sphereHandle.radius = Mathf.Clamp(sp.targetData.influenceSphereRadius - probeBlendDistancePositive.x, 0, sp.targetData.influenceSphereRadius);
{
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");
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 influenceRadius = sp.targetData.influenceSphereRadius;
var blendRadius = sphereHandle.radius;
var blendDistance = Mathf.Clamp(influenceRadius - blendRadius, 0, influenceRadius);
var blendDistance = Mathf.Clamp(influenceRadius - blendRadius, 0, influenceRadius);
probeBlendDistancePositive = Vector3.one * blendDistance;
probeBlendDistanceNegative = probeBlendDistancePositive;
probeBlendDistancePositive = Vector3.one * blendDistance;
probeBlendDistanceNegative = probeBlendDistancePositive;
ApplyConstraintsOnTargets(s, sp, o);
ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
}
Handles.matrix = mat;
Handles.color = col;

{
default:
case InfluenceType.Standard:
{
sp.targetData.blendDistancePositive = probeBlendDistancePositive;
sp.targetData.blendDistanceNegative = probeBlendDistanceNegative;
break;
}
{
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;
}
{
sp.targetData.blendNormalDistancePositive = probeBlendDistancePositive;
sp.targetData.blendNormalDistanceNegative = probeBlendDistanceNegative;
break;
}
{
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)

switch ((ShapeType)sp.influenceShape.enumValueIndex)
{
case ShapeType.Box:
{
s.boxInfluenceHandle.center = sp.target.center;
s.boxInfluenceHandle.size = sp.target.size;
Handles.color = k_GizmoThemeColorExtent;
EditorGUI.BeginChangeCheck();
s.boxInfluenceHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
Undo.RecordObject(sp.target, "Modified Reflection Probe AABB");
Undo.RecordObject(sp.targetData, "Modified Reflection Probe AABB");
s.alternativeBoxInfluenceHandle.center = sp.target.center;
s.alternativeBoxInfluenceHandle.size = sp.target.size;
var center = s.boxInfluenceHandle.center;
var size = s.boxInfluenceHandle.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");
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref size);
Vector3 center;
Vector3 size;
center = s.alternativeBoxInfluenceHandle.center;
size = s.alternativeBoxInfluenceHandle.size;
sp.target.center = center;
sp.target.size = size;
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref size);
ApplyConstraintsOnTargets(s, sp, o);
sp.target.center = center;
sp.target.size = size;
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
//ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
{
s.sphereInfluenceHandle.center = sp.target.center;
s.sphereInfluenceHandle.radius = sp.targetData.influenceSphereRadius;
{
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");
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;
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;
HDReflectionProbeEditorUtility.ValidateAABB(sp.target, ref center, ref radius);
influenceRadius = radius.x;
sp.targetData.influenceSphereRadius = influenceRadius;
sp.targetData.influenceSphereRadius = influenceRadius;
ApplyConstraintsOnTargets(s, sp, o);
//ApplyConstraintsOnTargets(s, sp, o);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
EditorUtility.SetDirty(sp.target);
EditorUtility.SetDirty(sp.targetData);
}
break;
break;
}
}
Handles.matrix = mat;
Handles.color = col;

var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();
Gizmos_Influence(reflectionProbe, reflectionData, null, false);
//Gizmos_Influence(reflectionProbe, reflectionData, e, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Standard, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Normal, false);

HDReflectionProbeEditorUtility.ChangeVisibility(reflectionProbe, false);
}
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, Editor e, InfluenceType type, bool isEdit)
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
Gizmo6FacesBoxContained box;
Vector3 boxCenterOffset;
Vector3 boxSizeOffset;
float sphereRadiusOffset;

default:
case InfluenceType.Standard:
{
boxCenterOffset = a.boxBlendCenterOffset;
boxSizeOffset = a.boxBlendSizeOffset;
sphereRadiusOffset = a.sphereBlendRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
break;
}
{
box = e != null ? e.m_UIState.alternativeBoxBlendHandle : null;
boxCenterOffset = a.boxBlendCenterOffset;
boxSizeOffset = a.boxBlendSizeOffset;
sphereRadiusOffset = a.sphereBlendRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
break;
}
{
boxCenterOffset = a.boxBlendNormalCenterOffset;
boxSizeOffset = a.boxBlendNormalSizeOffset;
sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
break;
}
{
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);

{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
else
Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
break;
}
{
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;
}
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
break;
}
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
break;
}
}
Gizmos.matrix = mat;

static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, Editor e, bool isEdit)
static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;

{
case ShapeType.Box:
{
Gizmos.color = isEdit ? k_GizmoThemeColorExtentFace : k_GizmoThemeColorExtent;
if (isEdit)
Gizmos.DrawCube(p.center, p.size);
else
Gizmos.DrawWireCube(p.center, p.size);
break;
}
{
Gizmos.color = k_GizmoThemeColorExtentFace;
e.m_UIState.alternativeBoxInfluenceHandle.DrawHull(isEdit);
break;
}
{
Gizmos.color = k_GizmoThemeColorExtentFace;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius);
break;
}
{
Gizmos.color = k_GizmoThemeColorExtentFace;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius);
break;
}
}
Gizmos.matrix = mat;

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


Inspector = new[]
{
SectionPrimarySettings,
SectionProxyVolumeSettings,
SectionSeparateProjectionVolumeSettings,
//SectionSeparateProjectionVolumeSettings,
SectionInfluenceProxyMismatch,
SectionCaptureSettings,
SectionAdditionalSettings,
ButtonBake

public static readonly CED.IDrawer[] Inspector;
public static readonly CED.IDrawer SectionPrimarySettings = CED.Group(
CED.Action(Drawer_Toolbar),
CED.space,
CED.space,
),
CED.space,
CED.Action(Drawer_InfluenceShape),
//CED.Action(Drawer_IntensityMultiplier),
CED.space,
CED.Action(Drawer_Toolbar),
CED.space,
CED.Action((s, d, o) => EditorGUILayout.PropertyField(d.proxyVolumeComponent, _.GetContent("Proxy Volume")))
)
);
public static readonly CED.IDrawer SectionProxyVolumeSettings = CED.FoldoutGroup(
"Proxy Volume",
(s, p, o) => s.isSectionExpandedProxyVolume,
FoldoutOption.Indent,
CED.Action(Drawer_ProxyVolume)
"Influence volume settings",
"Influence Volume",
CED.FadeGroup(
(s, p, o, i) => s.IsSectionExpandedShape((ShapeType)i),
FadeOption.None,
CED.Action(Drawer_InfluenceBoxSettings), // Box
CED.Action(Drawer_InfluenceSphereSettings) // Sphere
)/*,
CED.Action(Drawer_UseSeparateProjectionVolume)*/
CED.Action(Drawer_InfluenceAdvancedSwitch),
CED.space,
CED.Action(Drawer_InfluenceShape),
CED.space,
CED.Action(Drawer_InfluenceAreas),
CED.space,
CED.Action(Drawer_InfluenceSettings)
public static readonly CED.IDrawer SectionSeparateProjectionVolumeSettings = CED.FadeGroup(
(s, p, o, i) => s.isSectionExpandedSeparateProjection,
FadeOption.None,
CED.FoldoutGroup(
"Reprojection volume settings",
(s, p, o) => s.isSectionExpandedSeparateProjection,
FoldoutOption.Indent,
CED.FadeGroup(
(s, p, o, i) => s.IsSectionExpandedShape((ShapeType)i),
FadeOption.None,
CED.Action(Drawer_ProjectionBoxSettings), // Box
CED.Action(Drawer_ProjectionSphereSettings) // Sphere
)
)
);
public static readonly CED.IDrawer SectionInfluenceProxyMismatch = CED.Action(Drawer_InfluenceProxyMissmatch);
"Capture settings",
"Capture Settings",
(s, p, o) => s.isSectionExpandedCaptureSettings,
FoldoutOption.Indent,
CED.Action(Drawer_CaptureSettings)

"Additional settings",
"Artistic Settings",
(s, p, o) => s.isSectionExpandedAdditional,
FoldoutOption.Indent,
CED.Action(Drawer_AdditionalSettings)

static void Drawer_AdditionalSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.weight);
EditorGUILayout.PropertyField(p.weight, CoreEditorUtils.GetContent("Influence Volume Weight|Blending weight to use while interpolating between influence volume. (Reminder: Sky is an Influence Volume too)."));
EditorGUILayout.PropertyField(p.multiplier);
EditorGUILayout.PropertyField(p.multiplier, CoreEditorUtils.GetContent("Multiplier|Tweeking option to enhance reflection."));
if (EditorGUI.EndChangeCheck())
p.multiplier.floatValue = Mathf.Max(0.0f, p.multiplier.floatValue);

EditorReflectionSystemGUI.DrawBakeButton((ReflectionProbeMode)p.mode.intValue, p.target);
}
static void Drawer_ProxyVolume(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.proxyVolumeComponent, _.GetContent("Proxy Volume"));
if (p.proxyVolumeComponent.objectReferenceValue == null)
{
EditorGUILayout.HelpBox(
"When no Proxy setted, Influence shape will be used as Proxy shape too.",
MessageType.Info,
true
);
}
}
static void Drawer_InfluenceProxyMissmatch(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
if (p.proxyVolumeComponent.objectReferenceValue != null)
{
var proxy = (ReflectionProxyVolumeComponent)p.proxyVolumeComponent.objectReferenceValue;
if ((int)proxy.proxyVolume.shapeType != p.influenceShape.enumValueIndex)
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",
MessageType.Error,
true
);
}
}
bool advanced = p.editorAdvancedModeEnabled.boolValue;
CoreEditorUtils.DrawVector6Slider(
CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes."),
p.blendDistancePositive, p.blendDistanceNegative, Vector3.zero, maxBlendDistance);
CoreEditorUtils.DrawVector6Slider(
CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes."),
p.blendNormalDistancePositive, p.blendNormalDistanceNegative, Vector3.zero, maxBlendDistance);
EditorGUILayout.BeginHorizontal();
Drawer_AdvancedBlendDistance(
p,
false,
maxBlendDistance,
CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes.")
);
if (GUILayout.Button(toolbar_Contents[1], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[1], GetBoundsGetter(p)(), owner);
}
EditorGUILayout.EndHorizontal();
CoreEditorUtils.DrawVector6Slider(
CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."),
p.boxSideFadePositive, p.boxSideFadeNegative, Vector3.zero, Vector3.one);
EditorGUILayout.BeginHorizontal();
Drawer_AdvancedBlendDistance(
p,
true,
maxBlendDistance,
CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes.")
);
if (GUILayout.Button(toolbar_Contents[2], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.MinHeight(22f), GUILayout.MaxHeight((advanced ? 3 : 1) * (EditorGUIUtility.singleLineHeight + 3))))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[2], GetBoundsGetter(p)(), owner);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
if (advanced)
{
CoreEditorUtils.DrawVector6(
CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."),
p.boxSideFadePositive, p.boxSideFadeNegative, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
}
}
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(p.boxSize, CoreEditorUtils.GetContent("Box Size|The size of the box in which the reflections will be applied to objects. The value is not affected by the Transform of the Game Object."));
EditorGUILayout.PropertyField(p.boxOffset, CoreEditorUtils.GetContent("Box Offset|The center of the box in which the reflections will be applied to objects. The value is relative to the position of the Game Object."));
EditorGUILayout.PropertyField(p.boxProjection, CoreEditorUtils.GetContent("Box Projection|Box projection 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 box projection 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"));
static void Drawer_AdvancedBlendDistance(SerializedHDReflectionProbe p, bool isNormal, Vector3 maxBlendDistance, GUIContent content)
{
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;
Vector3 bdp = blendDistancePositive.vector3Value;
Vector3 bdn = blendDistanceNegative.vector3Value;
if (EditorGUI.EndChangeCheck())
EditorGUILayout.BeginVertical();
if (p.editorAdvancedModeEnabled.boolValue)
var center = p.boxOffset.vector3Value;
var size = p.boxSize.vector3Value;
if (HDReflectionProbeEditorUtility.ValidateAABB(p.target, ref center, ref size))
EditorGUI.BeginChangeCheck();
CoreEditorUtils.DrawVector6(
content,
editorAdvancedModeBlendDistancePositive, editorAdvancedModeBlendDistanceNegative, Vector3.zero, maxBlendDistance, HDReflectionProbeEditor.k_handlesColor);
if(EditorGUI.EndChangeCheck())
{
blendDistancePositive.vector3Value = editorAdvancedModeBlendDistancePositive.vector3Value;
blendDistanceNegative.vector3Value = editorAdvancedModeBlendDistanceNegative.vector3Value;
p.Apply();
}
}
else
{
float distance = editorSimplifiedModeBlendDistance.floatValue;
EditorGUI.BeginChangeCheck();
distance = EditorGUILayout.FloatField(content, distance);
if (EditorGUI.EndChangeCheck())
p.boxOffset.vector3Value = center;
p.boxSize.vector3Value = size;
Vector3 decal = Vector3.one * distance;
bdp.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
bdp.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
bdp.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
bdn.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
bdn.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
bdn.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
blendDistancePositive.vector3Value = bdp;
blendDistanceNegative.vector3Value = bdn;
editorSimplifiedModeBlendDistance.floatValue = distance;
p.Apply();
GUILayout.EndVertical();
}
static void Drawer_InfluenceSphereSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)

var blendDistance = p.blendDistancePositive.vector3Value.x;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = p.blendDistancePositive.hasMultipleDifferentValues;
blendDistance = EditorGUILayout.Slider(CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes."), blendDistance, 0, maxBlendDistance);

p.blendDistanceNegative.vector3Value = Vector3.one * blendDistance;
}
if (GUILayout.Button(toolbar_Contents[1], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[1], GetBoundsGetter(p)(), owner);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = p.blendNormalDistancePositive.hasMultipleDifferentValues;
blendNormalDistance = EditorGUILayout.Slider(CoreEditorUtils.GetContent("Blend Normal Distance|Area around the probe where the normals influence the probe. Only used in deferred probes."), blendNormalDistance, 0, maxBlendDistance);

p.blendNormalDistanceNegative.vector3Value = Vector3.one * blendNormalDistance;
}
if (GUILayout.Button(toolbar_Contents[2], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(k_Toolbar_SceneViewEditModes[2], GetBoundsGetter(p)(), owner);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(p.influenceSphereRadius, CoreEditorUtils.GetContent("Radius"));
EditorGUILayout.PropertyField(p.boxOffset, CoreEditorUtils.GetContent("Sphere Offset|The center of the sphere in which the reflections will be applied to objects. The value is relative to the position of the Game Object."));
EditorGUILayout.PropertyField(p.boxProjection, CoreEditorUtils.GetContent("Sphere Projection|Sphere projection causes reflections to appear to change based on the object's position within the probe's sphere, 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 sphere projection 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"));
}
#endregion
#region Projection Volume
static void Drawer_UseSeparateProjectionVolume(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.useSeparateProjectionVolume);
s.isSectionExpandedSeparateProjection.target = p.useSeparateProjectionVolume.boolValue;
}
static void Drawer_ProjectionBoxSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.boxReprojectionVolumeSize);
EditorGUILayout.PropertyField(p.boxReprojectionVolumeCenter);
}
static void Drawer_ProjectionSphereSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.sphereReprojectionVolumeRadius);
}
#endregion

s.SetModeTarget(p.mode.intValue);
foreach (var targetObject in p.so.targetObjects)
HDReflectionProbeEditorUtility.ResetProbeSceneTextureInMaterial((ReflectionProbe)targetObject);
}
}
static void Drawer_InfluenceAdvancedSwitch(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.FlexibleSpace();
bool advanced = p.editorAdvancedModeEnabled.boolValue;
advanced = !GUILayout.Toggle(!advanced, CoreEditorUtils.GetContent("Normal|Normal parameters mode (only change for box shape)."), EditorStyles.miniButtonLeft, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
advanced = GUILayout.Toggle(advanced, CoreEditorUtils.GetContent("Advanced|Advanced parameters mode (only change for box shape)."), EditorStyles.miniButtonRight, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
s.alternativeBoxBlendHandle.allHandleControledByOne = s.alternativeBoxBlendNormalHandle.allHandleControledByOne = !advanced;
if (p.editorAdvancedModeEnabled.boolValue ^ advanced)
{
p.editorAdvancedModeEnabled.boolValue = advanced;
if (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;
}
else
{
p.blendDistanceNegative.vector3Value = p.blendDistancePositive.vector3Value = Vector3.one * p.editorSimplifiedModeBlendDistance.floatValue;
p.blendNormalDistanceNegative.vector3Value = p.blendNormalDistancePositive.vector3Value = Vector3.one * p.editorSimplifiedModeBlendNormalDistance.floatValue;
}
p.Apply();
}
}
}

if (EditorGUI.EndChangeCheck())
s.SetShapeTarget(p.influenceShape.intValue);
if (p.proxyVolumeComponent.objectReferenceValue != null)
switch ((ShapeType)p.influenceShape.enumValueIndex)
var proxy = (ReflectionProxyVolumeComponent)p.proxyVolumeComponent.objectReferenceValue;
if ((int)proxy.proxyVolume.shapeType != p.influenceShape.enumValueIndex)
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",
MessageType.Error,
true
);
case ShapeType.Box:
Drawer_InfluenceShapeBoxSettings(s, p, owner);
break;
case ShapeType.Sphere:
Drawer_InfluenceShapeSphereSettings(s, p, owner);
break;
}
static void Drawer_InfluenceShapeBoxSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(p.boxSize, CoreEditorUtils.GetContent("Box Size|The size of the box in which the reflections will be applied to objects. The value is not affected by the Transform of the Game Object."));
if (GUILayout.Button(toolbar_Contents[0], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeBox, GetBoundsGetter(p)(), owner);
}
EditorGUILayout.EndHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(p.boxOffset, CoreEditorUtils.GetContent("Box Offset|The center of the box in which the reflections will be applied to objects. The value is relative to the position of the Game Object."));
if (GUILayout.Button(toolbar_Contents[3], GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeOrigin, GetBoundsGetter(p)(), owner);
}
EditorGUILayout.EndHorizontal();
if (EditorGUI.EndChangeCheck())
{
var center = p.boxOffset.vector3Value;
var size = p.boxSize.vector3Value;
if (HDReflectionProbeEditorUtility.ValidateAABB(p.target, ref center, ref size))
{
//clamp to contains object center instead of resizing
Vector3 projector = (center - p.boxOffset.vector3Value).normalized;
p.boxOffset.vector3Value = center + Mathf.Abs(Vector3.Dot((p.boxSize.vector3Value - size) * .5f, projector)) * projector;
}
}
}
static void Drawer_InfluenceShapeSphereSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(p.influenceSphereRadius, 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);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(p.boxOffset, CoreEditorUtils.GetContent("Sphere Offset|The center of the sphere in which the reflections will be applied to objects. The value is relative to the position of the Game Object."));
if (GUILayout.Button(toolbar_Contents[3], GUILayout.ExpandHeight(true), GUILayout.Width(28f), GUILayout.Height(EditorGUIUtility.singleLineHeight + 3)))
{
EditMode.ChangeEditMode(EditMode.SceneViewEditMode.ReflectionProbeOrigin, GetBoundsGetter(p)(), owner);
}
EditorGUILayout.EndHorizontal();
}
static void Drawer_InfluenceAreas(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
if (s.IsSectionExpandedShape(ShapeType.Box).value)
{
Drawer_InfluenceBoxSettings(s, p, owner);
}
if (s.IsSectionExpandedShape(ShapeType.Sphere).value)
{
Drawer_InfluenceSphereSettings(s, p, owner);
}
}
static void Drawer_InfluenceSettings(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"));
}
static void Drawer_IntensityMultiplier(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)

38
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 UnityEngine.Experimental.Rendering;
namespace UnityEditor.Experimental.Rendering
{

public void ClearOperation(Operation op) { operations &= ~op; }
public void AddOperation(Operation op) { operations |= op; }
public BoxBoundsHandle boxInfluenceHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxProjectionHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxBlendHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxBlendNormalHandle = new BoxBoundsHandle();
public Gizmo6FacesBox alternativeBoxInfluenceHandle;
public Gizmo6FacesBoxContained alternativeBoxBlendHandle;
public Gizmo6FacesBoxContained alternativeBoxBlendNormalHandle;
public SphereBoundsHandle sphereInfluenceHandle = new SphereBoundsHandle();
public SphereBoundsHandle sphereProjectionHandle = new SphereBoundsHandle();
public SphereBoundsHandle sphereBlendHandle = new SphereBoundsHandle();

public AnimBool isSectionExpandedInfluenceVolume { get { return m_AnimBools[0]; } }
public AnimBool isSectionExpandedSeparateProjection { get { return m_AnimBools[1]; } }
public AnimBool isSectionExpandedProxyVolume { get { return m_AnimBools[0]; } }
public AnimBool isSectionExpandedInfluenceVolume { get { return m_AnimBools[1]; } }
public AnimBool isSectionExpandedCaptureSettings { get { return m_AnimBools[2]; } }
public AnimBool isSectionExpandedAdditional { get { return m_AnimBools[3]; } }

public HDReflectionProbeUI()
: base(k_AnimBoolsCount)
{
isSectionExpandedProxyVolume.value = true;
alternativeBoxInfluenceHandle = new Gizmo6FacesBox(monochromeFace:true, monochromeSelectedFace:true);
alternativeBoxBlendHandle = new Gizmo6FacesBoxContained(alternativeBoxInfluenceHandle, monochromeFace:true, monochromeSelectedFace:true);
alternativeBoxBlendNormalHandle = new Gizmo6FacesBoxContained(alternativeBoxInfluenceHandle, monochromeFace:true, monochromeSelectedFace:true);
Color[] handleColors = new Color[]
{
HDReflectionProbeEditor.k_handlesColor[0][0],
HDReflectionProbeEditor.k_handlesColor[0][1],
HDReflectionProbeEditor.k_handlesColor[0][2],
HDReflectionProbeEditor.k_handlesColor[1][0],
HDReflectionProbeEditor.k_handlesColor[1][1],
HDReflectionProbeEditor.k_handlesColor[1][2]
};
alternativeBoxInfluenceHandle.handleColors = handleColors;
alternativeBoxBlendHandle.handleColors = handleColors;
alternativeBoxBlendNormalHandle.handleColors = handleColors;
alternativeBoxInfluenceHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorExtent };
alternativeBoxInfluenceHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorExtentFace };
alternativeBoxBlendHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend };
alternativeBoxBlendHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace };
alternativeBoxBlendNormalHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend };
alternativeBoxBlendNormalHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace };
}
public override void Update()

SetModeTarget(data.mode.hasMultipleDifferentValues ? -1 : data.mode.intValue);
SetShapeTarget(data.influenceShape.hasMultipleDifferentValues ? -1 : data.influenceShape.intValue);
isSectionExpandedSeparateProjection.value = data.useSeparateProjectionVolume.boolValue;
base.Update();
}

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


public static readonly CED.IDrawer Inspector;
public static readonly CED.IDrawer SectionProbeModeSettings;
public static readonly CED.IDrawer ProxyVolumeSettings = CED.FoldoutGroup(
"Proxy Volume",
(s, d, o) => s.isSectionExpendedProxyVolume,
FoldoutOption.Indent,
CED.Action(Drawer_SectionProxySettings)
);
public static readonly CED.IDrawer SectionFoldoutInfluenceSettings = CED.FoldoutGroup(
"Influence Settings",
(s, d, o) => s.isSectionExpandedInfluenceSettings,
public static readonly CED.IDrawer SectionFoldoutAdditionalSettings = CED.FoldoutGroup(
"Artistic Settings",
(s, d, o) => s.isSectionExpendedAdditionalSettings,
public static readonly CED.IDrawer SectionFoldoutProxySettings;
public static readonly CED.IDrawer SectionFoldoutCaptureSettings;
public static readonly CED.IDrawer SectionCaptureMirrorSettings = CED.Action(Drawer_SectionCaptureMirror);

CED.Action(Drawer_SectionCaptureSettings),
CED.FadeGroup(
(s, d, o, i) =>
{
switch (i)
{
default:
case 0: return s.isSectionExpandedCaptureMirrorSettings;
case 1: return s.isSectionExpandedCaptureStaticSettings;
}
},
{
switch (i)
{
default:
case 0: return s.isSectionExpandedCaptureMirrorSettings;
case 1: return s.isSectionExpandedCaptureStaticSettings;
}
},
FadeOption.None,
SectionCaptureMirrorSettings,
SectionCaptureStaticSettings)

);
Inspector = CED.Group(
//SectionProbeModeSettings,
CED.space,
CED.Action((s, d, o) => EditorGUILayout.LabelField(_.GetContent("Proxy Volume"), EditorStyles.boldLabel)),
CED.Action(Drawer_FieldProxyVolumeReference),
CED.space,
ProxyVolumeSettings,
CED.Select(
(s, d, o) => s.influenceVolume,
(s, d, o) => d.influenceVolume,

SectionFoldoutInfluenceSettings,
SectionFoldoutAdditionalSettings,
CED.Select(
(s, d, o) => s.frameSettings,
(s, d, o) => d.frameSettings,

GUI.enabled = true;
}
static void Drawer_SectionProxySettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.proxyVolumeReference, _.GetContent("Reference"));
if (d.proxyVolumeReference.objectReferenceValue != null)
{
var proxy = (ReflectionProxyVolumeComponent)d.proxyVolumeReference.objectReferenceValue;
if ((int)proxy.proxyVolume.shapeType != d.influenceVolume.shapeType.enumValueIndex)
EditorGUILayout.HelpBox(
"Proxy volume and influence volume have different shape types, this is not supported.",
MessageType.Error,
true
);
}
else
{
EditorGUILayout.HelpBox(
"When no Proxy setted, Influence shape will be used as Proxy shape too.",
MessageType.Info,
true
);
}
}
static void Drawer_SectionInfluenceSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.weight, _.GetContent("Weight"));

GUI.enabled = true;
}
static void Drawer_FieldProxyVolumeReference(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.proxyVolumeReference, _.GetContent("Reference"));
}
static readonly EditMode.SceneViewEditMode[] k_Toolbar_SceneViewEditModes =
{
EditBaseShape,

static readonly EditMode.SceneViewEditMode[] k_Toolbar_Static_SceneViewEditModes =
{
EditCenter
//EditCenter //offset have no meanings with planar
EditMirrorPosition,
//EditMirrorPosition, //offset have no meanings with planar
EditMirrorRotation
};
static GUIContent[] s_Toolbar_Contents = null;

{
get
{
return s_Toolbar_Static_Contents ?? (s_Toolbar_Static_Contents = new[]
return s_Toolbar_Static_Contents ?? (s_Toolbar_Static_Contents = new GUIContent[]
EditorGUIUtility.IconContent("MoveTool", "|Move the capture position.")
//EditorGUIUtility.IconContent("MoveTool", "|Move the capture position.") //offset have no meanings with planar
});
}
}

{
return s_Toolbar_Mirror_Contents ?? (s_Toolbar_Mirror_Contents = new[]
{
EditorGUIUtility.IconContent("MoveTool", "|Move the mirror plane."),
//EditorGUIUtility.IconContent("MoveTool", "|Move the mirror plane."), //offset have no meanings with planar
EditorGUIUtility.IconContent("RotateTool", "|Rotate the mirror plane.")
});
}

GUILayout.FlexibleSpace();
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(Editor o)

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


{
partial class PlanarReflectionProbeUI : BaseUI<SerializedPlanarReflectionProbe>
{
const int k_AnimBoolFields = 4;
const int k_AnimBoolFields = 6;
static readonly int k_ReflectionProbeModeModeCount = Enum.GetValues(typeof(ReflectionProbeMode)).Length;
static readonly int k_AnimBoolTotal = k_AnimBoolFields + k_ReflectionProbeModeModeCount;

public AnimBool isSectionExpandedCaptureMirrorSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 2]; } }
public AnimBool isSectionExpandedCaptureStaticSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 3]; } }
public AnimBool isSectionExpendedProxyVolume { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 4]; } }
public AnimBool isSectionExpendedAdditionalSettings { get { return m_AnimBools[k_ReflectionProbeModeModeCount + 5]; } }
public bool showCaptureHandles { get; set; }

isSectionExpandedInfluenceSettings.value = true;
isSectionExpandedCaptureSettings.value = true;
isSectionExpendedProxyVolume.value = true;
isSectionExpendedAdditionalSettings.value = false;
}
public AnimBool IsSectionExpandedReflectionProbeMode(ReflectionProbeMode mode)

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


internal SerializedProperty weight;
internal SerializedProperty multiplier;
internal SerializedProperty editorAdvancedModeBlendDistancePositive;
internal SerializedProperty editorAdvancedModeBlendDistanceNegative;
internal SerializedProperty editorSimplifiedModeBlendDistance;
internal SerializedProperty editorAdvancedModeBlendNormalDistancePositive;
internal SerializedProperty editorAdvancedModeBlendNormalDistanceNegative;
internal SerializedProperty editorSimplifiedModeBlendNormalDistance;
internal SerializedProperty editorAdvancedModeEnabled;
internal SerializedProperty proxyVolumeComponent;
public SerializedHDReflectionProbe(SerializedObject so, SerializedObject addso)

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)
{
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;
}
proxyVolumeComponent = addso.Find((HDAdditionalReflectionData d) => d.proxyVolumeComponent);
}

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


partial class InfluenceVolumeUI
{
public static readonly CED.IDrawer SectionShape;
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);

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

EditorGUILayout.PropertyField(d.shapeType, _.GetContent("Shape Type"));
}
static void Drawer_InfluenceAdvancedSwitch(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor owner)
{
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.FlexibleSpace();
bool advanced = d.editorAdvancedModeEnabled.boolValue;
advanced = !GUILayout.Toggle(!advanced, CoreEditorUtils.GetContent("Normal|Normal parameters mode (only change for box shape)."), EditorStyles.miniButtonLeft, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
advanced = GUILayout.Toggle(advanced, CoreEditorUtils.GetContent("Advanced|Advanced parameters mode (only change for box shape)."), EditorStyles.miniButtonRight, GUILayout.Width(60f), GUILayout.ExpandWidth(false));
s.boxInfluenceHandle.allHandleControledByOne = s.boxInfluenceNormalHandle.allHandleControledByOne = !advanced;
if (d.editorAdvancedModeEnabled.boolValue ^ advanced)
{
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;
}
else
{
d.boxInfluenceNegativeFade.vector3Value = d.boxInfluencePositiveFade.vector3Value = Vector3.one * d.editorSimplifiedModeBlendDistance.floatValue;
d.boxInfluenceNormalNegativeFade.vector3Value = d.boxInfluenceNormalPositiveFade.vector3Value = Vector3.one * d.editorSimplifiedModeBlendNormalDistance.floatValue;
}
d.Apply();
}
}
}
bool advanced = d.editorAdvancedModeEnabled.boolValue;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(d.boxBaseOffset, _.GetContent("Box Offset"));
PlanarReflectionProbeUI.Drawer_ToolBarButton(0, o, GUILayout.Width(28f), GUILayout.MinHeight(22f));
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
//offset have no meaning for planar reflexion probe
//EditorGUILayout.PropertyField(d.boxBaseOffset, _.GetContent("Box Offset"));
_.DrawVector6Slider(
_.GetContent("Influence Fade"),
d.boxInfluencePositiveFade, d.boxInfluenceNegativeFade,
minFadeDistance, maxFadeDistance);
EditorGUILayout.BeginHorizontal();
Drawer_AdvancedBlendDistance(
d,
false,
maxFadeDistance,
CoreEditorUtils.GetContent("Blend Distance|Area around the probe where it is blended with other probes. Only used in deferred probes.")
);
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 (advanced)
{
CoreEditorUtils.DrawVector6(
CoreEditorUtils.GetContent("Face fade|Fade faces of the cubemap."),
d.boxPositiveFaceFade, d.boxNegativeFaceFade, Vector3.zero, Vector3.one, HDReflectionProbeEditor.k_handlesColor);
}
}
EditorGUILayout.Space();
static void Drawer_AdvancedBlendDistance(SerializedInfluenceVolume d, bool isNormal, Vector3 maxBlendDistance, GUIContent content)
{
SerializedProperty blendDistancePositive = isNormal ? d.boxInfluenceNormalPositiveFade : d.boxInfluencePositiveFade;
SerializedProperty blendDistanceNegative = isNormal ? d.boxInfluenceNormalNegativeFade : d.boxInfluenceNegativeFade;
SerializedProperty editorAdvancedModeBlendDistancePositive = isNormal ? d.editorAdvancedModeBlendNormalDistancePositive : d.editorAdvancedModeBlendDistancePositive;
SerializedProperty editorAdvancedModeBlendDistanceNegative = isNormal ? d.editorAdvancedModeBlendNormalDistanceNegative : d.editorAdvancedModeBlendDistanceNegative;
SerializedProperty editorSimplifiedModeBlendDistance = isNormal ? d.editorSimplifiedModeBlendNormalDistance : d.editorSimplifiedModeBlendDistance;
Vector3 bdp = blendDistancePositive.vector3Value;
Vector3 bdn = blendDistanceNegative.vector3Value;
_.DrawVector6Slider(
_.GetContent("Influence Normal Fade"),
d.boxInfluenceNormalPositiveFade, d.boxInfluenceNormalNegativeFade,
minFadeDistance, maxFadeDistance);
EditorGUILayout.BeginVertical();
EditorGUILayout.Space();
if (d.editorAdvancedModeEnabled.boolValue)
{
EditorGUI.BeginChangeCheck();
blendDistancePositive.vector3Value = editorAdvancedModeBlendDistancePositive.vector3Value;
blendDistanceNegative.vector3Value = editorAdvancedModeBlendDistanceNegative.vector3Value;
CoreEditorUtils.DrawVector6(
content,
blendDistancePositive, blendDistanceNegative, Vector3.zero, maxBlendDistance, HDReflectionProbeEditor.k_handlesColor);
if(EditorGUI.EndChangeCheck())
{
editorAdvancedModeBlendDistancePositive.vector3Value = blendDistancePositive.vector3Value;
editorAdvancedModeBlendDistanceNegative.vector3Value = blendDistanceNegative.vector3Value;
}
}
else
{
float distance = editorSimplifiedModeBlendDistance.floatValue;
EditorGUI.BeginChangeCheck();
distance = EditorGUILayout.FloatField(content, distance);
if (EditorGUI.EndChangeCheck())
{
Vector3 decal = Vector3.one * distance;
bdp.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
bdp.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
bdp.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
bdn.x = Mathf.Clamp(decal.x, 0f, maxBlendDistance.x);
bdn.y = Mathf.Clamp(decal.y, 0f, maxBlendDistance.y);
bdn.z = Mathf.Clamp(decal.z, 0f, maxBlendDistance.z);
blendDistancePositive.vector3Value = bdp;
blendDistanceNegative.vector3Value = bdn;
editorSimplifiedModeBlendDistance.floatValue = distance;
}
}
_.DrawVector6Slider(
_.GetContent("Influence Face Fade"),
d.boxPositiveFaceFade, d.boxNegativeFaceFade,
Vector3.zero, Vector3.one);
GUILayout.EndVertical();
}
static void Drawer_SectionShapeSphere(InfluenceVolumeUI s, SerializedInfluenceVolume d, Editor o)

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


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

d.boxInfluenceOffset, d.boxInfluenceSizeOffset,
d.sphereInfluenceRadiusOffset,
(editedHandle & HandleType.Influence) != 0,
k_GizmoThemeColorInfluence);
k_GizmoThemeColorInfluence,
false);
if ((showedHandle & HandleType.InfluenceNormal) != 0)
DrawGizmos_FadeHandle(

(editedHandle & HandleType.InfluenceNormal) != 0,
k_GizmoThemeColorInfluenceNormal);
k_GizmoThemeColorInfluenceNormal,
true);
}
static void DrawGizmos_BaseHandle(

{
case ShapeType.Box:
{
if (isSolid)
Gizmos.DrawCube(d.boxBaseOffset, d.boxBaseSize);
else
Gizmos.DrawWireCube(d.boxBaseOffset, d.boxBaseSize);
s.boxBaseHandle.center = d.boxBaseOffset;
s.boxBaseHandle.size = d.boxBaseSize;
s.boxBaseHandle.DrawHull(isSolid);
break;
}
case ShapeType.Sphere:

InfluenceVolumeUI s, InfluenceVolume d, Matrix4x4 matrix,
Vector3 boxOffset, Vector3 boxSizeOffset,
float sphereOffset,
bool isSolid, Color color)
bool isSolid, Color color, bool isNormal)
{
var mat = Gizmos.matrix;
var c = Gizmos.color;

{
case ShapeType.Box:
{
if (isSolid)
Gizmos.DrawCube(d.boxBaseOffset + boxOffset, d.boxBaseSize + boxSizeOffset);
else
Gizmos.DrawWireCube(d.boxBaseOffset + boxOffset, d.boxBaseSize + boxSizeOffset);
Gizmo6FacesBox refBox = isNormal ? s.boxInfluenceNormalHandle : s.boxInfluenceHandle;
refBox.center = d.boxBaseOffset + boxOffset;
refBox.size = d.boxBaseSize + boxSizeOffset;
refBox.DrawHull(isSolid);
break;
}
case ShapeType.Sphere:

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


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

switch (d.shapeType)
{
case ShapeType.Box:
{
var center = d.boxBaseOffset;
var size = d.boxBaseSize;
DrawBoxHandle(
s, d, o, sourceAsset,
s1 => s1.boxBaseHandle,
ref center,
ref size);
d.boxBaseOffset = center;
d.boxBaseSize = size;
break;
}
{
var center = d.boxBaseOffset;
var size = d.boxBaseSize;
DrawBoxHandle(
s, d, o, sourceAsset,
s1 => s1.boxBaseHandle,
ref center,
ref size);
d.boxBaseOffset = center;
d.boxBaseSize = size;
break;
}
{
var center = d.sphereBaseOffset;
var radius = d.sphereBaseRadius;
DrawSphereHandle(
s, d, o, sourceAsset,
s1 => s1.sphereBaseHandle,
ref center,
ref radius);
d.sphereBaseOffset = center;
d.sphereBaseRadius = radius;
break;
}
{
var center = d.sphereBaseOffset;
var radius = d.sphereBaseRadius;
DrawSphereHandle(
s, d, o, sourceAsset,
s1 => s1.sphereBaseHandle,
ref center,
ref radius);
d.sphereBaseOffset = center;
d.sphereBaseRadius = radius;
break;
}
}
Handles.matrix = mat;
Handles.color = c;

switch (d.shapeType)
{
case ShapeType.Box:
{
var positive = d.boxInfluencePositiveFade;
var negative = d.boxInfluenceNegativeFade;
DrawBoxFadeHandle(
s, d, o, sourceAsset,
s1 => s1.boxInfluenceHandle,
d.boxBaseOffset, d.boxBaseSize,
ref positive,
ref negative);
d.boxInfluencePositiveFade = positive;
d.boxInfluenceNegativeFade = negative;
break;
}
{
var positive = d.boxInfluencePositiveFade;
var negative = d.boxInfluenceNegativeFade;
DrawBoxFadeHandle(
s, d, o, sourceAsset,
s1 => s1.boxInfluenceHandle,
d.boxBaseOffset, d.boxBaseSize,
ref positive,
ref negative);
s.data.boxInfluencePositiveFade.vector3Value = positive;
s.data.boxInfluenceNegativeFade.vector3Value = negative;
//save advanced/simplified saved data
if (s.data.editorAdvancedModeEnabled.boolValue)
{
s.data.editorAdvancedModeBlendDistancePositive.vector3Value = positive;
s.data.editorAdvancedModeBlendDistanceNegative.vector3Value = negative;
}
else
{
s.data.editorSimplifiedModeBlendDistance.floatValue = positive.x;
}
s.data.Apply();
break;
}
{
var fade = d.sphereInfluenceFade;
DrawSphereFadeHandle(
s, d, o, sourceAsset,
s1 => s1.sphereInfluenceHandle,
d.sphereBaseOffset, d.sphereBaseRadius,
ref fade);
d.sphereInfluenceFade = fade;
break;
}
{
var fade = d.sphereInfluenceFade;
DrawSphereFadeHandle(
s, d, o, sourceAsset,
s1 => s1.sphereInfluenceHandle,
d.sphereBaseOffset, d.sphereBaseRadius,
ref fade);
d.sphereInfluenceFade = fade;
break;
}
}
Handles.matrix = mat;
Handles.color = c;

switch (d.shapeType)
{
case ShapeType.Box:
{
var positive = d.boxInfluenceNormalPositiveFade;
var negative = d.boxInfluenceNormalNegativeFade;
DrawBoxFadeHandle(
s, d, o, sourceAsset,
s1 => s1.boxInfluenceNormalHandle,
d.boxBaseOffset, d.boxBaseSize,
ref positive,
ref negative);
d.boxInfluenceNormalPositiveFade = positive;
d.boxInfluenceNormalNegativeFade = negative;
break;
}
{
Vector3 positive = d.boxInfluenceNormalPositiveFade;
Vector3 negative = d.boxInfluenceNormalNegativeFade;
DrawBoxFadeHandle(
s, d, o, sourceAsset,
s1 => s1.boxInfluenceNormalHandle,
d.boxBaseOffset, d.boxBaseSize,
ref positive,
ref negative);
s.data.boxInfluenceNormalPositiveFade.vector3Value = positive;
s.data.boxInfluenceNormalNegativeFade.vector3Value = negative;
//save advanced/simplified saved data
if (s.data.editorAdvancedModeEnabled.boolValue)
{
s.data.editorAdvancedModeBlendNormalDistancePositive.vector3Value = positive;
s.data.editorAdvancedModeBlendNormalDistanceNegative.vector3Value = negative;
}
else
{
s.data.editorSimplifiedModeBlendNormalDistance.floatValue = positive.x;
}
s.data.Apply();
break;
}
{
var fade = d.sphereInfluenceNormalFade;
DrawSphereFadeHandle(
s, d, o, sourceAsset,
s1 => s1.sphereInfluenceNormalHandle,
d.sphereBaseOffset, d.sphereBaseRadius,
ref fade);
d.sphereInfluenceNormalFade = fade;
break;
}
{
var fade = d.sphereInfluenceNormalFade;
DrawSphereFadeHandle(
s, d, o, sourceAsset,
s1 => s1.sphereInfluenceNormalHandle,
d.sphereBaseOffset, d.sphereBaseRadius,
ref fade);
d.sphereInfluenceNormalFade = fade;
break;
}
}
Handles.matrix = mat;
Handles.color = c;

InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset,
Func<InfluenceVolumeUI, BoxBoundsHandle> boundsGetter,
Func<InfluenceVolumeUI, Gizmo6FacesBox> boundsGetter,
ref Vector3 center, ref Vector3 size)
{
var b = boundsGetter(s);

static void DrawBoxFadeHandle(
InfluenceVolumeUI s, InfluenceVolume d, Editor o, Object sourceAsset,
Func<InfluenceVolumeUI, BoxBoundsHandle> boundsGetter,
Func<InfluenceVolumeUI, Gizmo6FacesBox> boundsGetter,
Vector3 baseOffset, Vector3 baseSize,
ref Vector3 positive, ref Vector3 negative)
{

b.size = baseSize - positive - negative;
b.allHandleControledByOne = !s.data.editorAdvancedModeEnabled.boolValue;
EditorGUI.BeginChangeCheck();
b.DrawHandle();

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


using UnityEditor.IMGUI.Controls;
using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Experimental.Rendering;
internal static Color k_GizmoThemeColorBase = new Color(255f / 255f, 229f / 255f, 148f / 255f, 80f / 255f);
internal static Color k_GizmoThemeColorBaseFace = new Color(255f / 255f, 229f / 255f, 148f / 255f, 45f / 255f);
internal static Color k_GizmoThemeColorInfluence = new Color(83f / 255f, 255f / 255f, 95f / 255f, 75f / 255f);
internal static Color k_GizmoThemeColorInfluenceFace = new Color(83f / 255f, 255f / 255f, 95f / 255f, 17f / 255f);
internal static Color k_GizmoThemeColorInfluenceNormal = new Color(0f / 255f, 229f / 255f, 255f / 255f, 80f / 255f);
internal static Color k_GizmoThemeColorInfluenceNormalFace = new Color(0f / 255f, 229f / 255f, 255f / 255f, 36f / 255f);
internal static Color k_GizmoThemeColorProjection = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
internal static Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
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);
const int k_AnimBoolFields = 2;
internal static readonly Color k_GizmoThemeColorBase = new Color(255f / 255f, 229f / 255f, 148f / 255f, 80f / 255f);
internal static readonly Color k_GizmoThemeColorBaseFace = new Color(255f / 255f, 229f / 255f, 148f / 255f, 45f / 255f);
internal static readonly Color k_GizmoThemeColorInfluence = new Color(83f / 255f, 255f / 255f, 95f / 255f, 75f / 255f);
internal static readonly Color k_GizmoThemeColorInfluenceFace = new Color(83f / 255f, 255f / 255f, 95f / 255f, 17f / 255f);
internal static readonly Color k_GizmoThemeColorInfluenceNormal = new Color(0f / 255f, 229f / 255f, 255f / 255f, 80f / 255f);
internal static readonly Color k_GizmoThemeColorInfluenceNormalFace = new Color(0f / 255f, 229f / 255f, 255f / 255f, 36f / 255f);
internal static readonly Color k_GizmoThemeColorProjection = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
internal static readonly Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
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);
public BoxBoundsHandle boxBaseHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxInfluenceHandle = new BoxBoundsHandle();
public BoxBoundsHandle boxInfluenceNormalHandle = new BoxBoundsHandle();
public Gizmo6FacesBox boxBaseHandle;
public Gizmo6FacesBoxContained boxInfluenceHandle;
public Gizmo6FacesBoxContained boxInfluenceNormalHandle;
public SphereBoundsHandle sphereBaseHandle = new SphereBoundsHandle();
public SphereBoundsHandle sphereInfluenceHandle = new SphereBoundsHandle();

public bool showInfluenceHandles { get; set; }
public InfluenceVolumeUI()
: base(k_ShapeCount + 1)
: base(k_ShapeCount + k_AnimBoolFields)
isSectionExpandedShape.value = true;
boxBaseHandle = new Gizmo6FacesBox(monochromeFace:true, monochromeSelectedFace:true);
boxInfluenceHandle = new Gizmo6FacesBoxContained(boxBaseHandle, monochromeFace:true, monochromeSelectedFace:true);
boxInfluenceNormalHandle = new Gizmo6FacesBoxContained(boxBaseHandle, monochromeFace:true, monochromeSelectedFace:true);
Color[] handleColors = new Color[]
{
HDReflectionProbeEditor.k_handlesColor[0][0],
HDReflectionProbeEditor.k_handlesColor[0][1],
HDReflectionProbeEditor.k_handlesColor[0][2],
HDReflectionProbeEditor.k_handlesColor[1][0],
HDReflectionProbeEditor.k_handlesColor[1][1],
HDReflectionProbeEditor.k_handlesColor[1][2]
};
boxBaseHandle.handleColors = handleColors;
boxInfluenceHandle.handleColors = handleColors;
boxInfluenceNormalHandle.handleColors = handleColors;
boxBaseHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorExtent };
boxBaseHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorExtentFace };
boxInfluenceHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlend };
boxInfluenceHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceBlendFace };
boxInfluenceNormalHandle.faceColors = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlend };
boxInfluenceNormalHandle.faceColorsSelected = new Color[] { HDReflectionProbeEditor.k_GizmoThemeColorInfluenceNormalBlendFace };
}
public override void Update()

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


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

public SerializedProperty sphereInfluenceFade;
public SerializedProperty sphereInfluenceNormalFade;
internal SerializedProperty editorAdvancedModeBlendDistancePositive;
internal SerializedProperty editorAdvancedModeBlendDistanceNegative;
internal SerializedProperty editorSimplifiedModeBlendDistance;
internal SerializedProperty editorAdvancedModeBlendNormalDistancePositive;
internal SerializedProperty editorAdvancedModeBlendNormalDistanceNegative;
internal SerializedProperty editorSimplifiedModeBlendNormalDistance;
internal SerializedProperty editorAdvancedModeEnabled;
public SerializedInfluenceVolume(SerializedProperty root)
{
this.root = root;

sphereBaseOffset = root.Find((InfluenceVolume i) => i.sphereBaseOffset);
sphereInfluenceFade = root.Find((InfluenceVolume i) => i.sphereInfluenceFade);
sphereInfluenceNormalFade = root.Find((InfluenceVolume i) => i.sphereInfluenceNormalFade);
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");
//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)
{
Vector3 positive = boxInfluencePositiveFade.vector3Value;
Vector3 negative = boxInfluenceNegativeFade.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 = boxInfluenceNormalPositiveFade.vector3Value;
negative = boxInfluenceNormalNegativeFade.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;
}
}
public void Apply()
{
root.serializedObject.ApplyModifiedProperties();
}
}
}

24
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Volumetric/DensityVolumeEditor.cs


[CustomEditor(typeof(DensityVolume))]
class DensityVolumeEditor : Editor
{
private static GUIContent albedoLabel = new GUIContent("Scattering Color");
private static GUIContent meanFreePathLabel = new GUIContent("Mean Free Path");
private static GUIContent volumeTextureLabel = new GUIContent("Volume Texture Mask");
private static GUIContent textureScrollLabel = new GUIContent("Texture Scroll Speed");
private static GUIContent textureTileLabel = new GUIContent("Texture Tiling Amount");
private static GUIContent textureSettingsTitle = new GUIContent("Volume Texture Settings");
static GUIContent s_AlbedoLabel = new GUIContent("Single Scattering Albedo", "Hue and saturation control the color of the fog (the wavelength of in-scattered light). Value controls scattering (0 = max absorption & no scattering, 1 = no absorption & max scattering).");
static GUIContent s_MeanFreePathLabel = new GUIContent("Mean Free Path", "Controls the density, which determines how far you can seen through the fog. It's the distance in meters at which 50% of background light is lost in the fog (due to absorption and out-scattering).");
static GUIContent s_VolumeTextureLabel = new GUIContent("Density Mask Texture");
static GUIContent s_TextureScrollLabel = new GUIContent("Texture Scroll Speed");
static GUIContent s_TextureTileLabel = new GUIContent("Texture Tiling Amount");
static GUIContent s_TextureSettingsTitle = new GUIContent("Volume Texture Settings");
private bool showTextureParams = false;

public override void OnInspectorGUI()
{
albedo.colorValue = EditorGUILayout.ColorField(albedoLabel, albedo.colorValue, true, false, false);
EditorGUILayout.PropertyField(meanFreePath, meanFreePathLabel);
albedo.colorValue = EditorGUILayout.ColorField(s_AlbedoLabel, albedo.colorValue, true, false, false);
EditorGUILayout.PropertyField(meanFreePath, s_MeanFreePathLabel);
showTextureParams = EditorGUILayout.Foldout(showTextureParams, textureSettingsTitle, true);
showTextureParams = EditorGUILayout.Foldout(showTextureParams, s_TextureSettingsTitle, true);
EditorGUILayout.PropertyField(volumeTexture, volumeTextureLabel);
EditorGUILayout.PropertyField(textureScroll, textureScrollLabel);
EditorGUILayout.PropertyField(textureTile, textureTileLabel);
EditorGUILayout.PropertyField(volumeTexture, s_VolumeTextureLabel);
EditorGUILayout.PropertyField(textureScroll, s_TextureScrollLabel);
EditorGUILayout.PropertyField(textureTile, s_TextureTileLabel);
EditorGUI.indentLevel--;
}

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存