Yao Xiaoling 6 年前
当前提交
a11976bf
共有 290 个文件被更改,包括 2196 次插入2426 次删除
  1. 4
      .gitmodules
  2. 6
      README.md
  3. 8
      TestProjects/HDRP_Tests/Assets/GraphicTests/Common/TestRunner/Editor/SetupProject.cs
  4. 62
      TestProjects/HDRP_Tests/Assets/GraphicTests/Common/TestRunner/HDRP_GraphicTestRunner.cs
  5. 17
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1401_StackLit/TestStackMat_Dielectric_SSS.mat
  6. 435
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity
  7. 2
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity.meta
  8. 58
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2102_GI_Emission.unity
  9. 2
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2102_GI_Emission.unity.meta
  10. 68
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2103_BakeMixed.unity
  11. 2
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2103_BakeMixed.unity.meta
  12. 2
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2601_ColorTemp.meta
  13. 194
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2601_ColorTemp.unity
  14. 2
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2601_ColorTemp.unity.meta
  15. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_All_ColorTint.mat
  16. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask.mat
  17. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_Factor05.mat
  18. 14
      TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_NoAlbedo.mat
  19. 998
      TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/1401_StackLit.png
  20. 1
      TestProjects/HDRP_Tests/Packages/manifest.json
  21. 18
      TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset
  22. 83
      TestProjects/HDRP_Tests/ProjectSettings/ProjectSettings.asset
  23. 11
      TestProjects/LWGraphicsTest/Assets/TestScripts/CustomLWPipe.cs
  24. 1
      TestProjects/LWGraphicsTest/Packages/manifest.json
  25. 2
      TestProjects/PostProcessing/Packages/manifest.json
  26. 1
      TestProjects/ShaderGraph/Packages/manifest.json
  27. 9
      build.py
  28. 5
      com.unity.render-pipelines.core/CHANGELOG.md
  29. 6
      com.unity.render-pipelines.core/CoreRP/ShaderLibrary/ImageBasedLighting.hlsl
  30. 16
      com.unity.render-pipelines.core/CoreRP/Textures/TextureCache.cs
  31. 41
      com.unity.render-pipelines.core/CoreRP/Utilities/CoreUtils.cs
  32. 4
      com.unity.render-pipelines.core/package.json
  33. 17
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  34. 31
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs
  35. 1
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugFullScreen.shader
  36. 5
      com.unity.render-pipelines.high-definition/HDRP/Debug/LightingDebug.cs
  37. 23
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs
  38. 111
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs
  39. 223
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
  40. 78
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
  41. 10
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs
  42. 115
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  43. 19
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.cs
  44. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs
  45. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Drawers.cs
  46. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/ReflectionMenuItem.cs
  47. 85
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs
  48. 44
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedPlanarReflectionProbe.cs
  49. 116
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
  50. 36
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Gizmos.cs
  51. 66
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Handles.cs
  52. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.cs
  53. 38
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/ProxyVolumeUI.cs
  54. 97
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedInfluenceVolume.cs
  55. 12
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/SerializedProxyVolume.cs
  56. 16
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Lit/LitUI.cs
  57. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Unlit/BaseUnlitUI.cs
  58. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDAssetFactory.cs
  59. 44
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template
  60. 14
      com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template
  61. 81
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/HDRISky/HDRISkyEditor.cs
  62. 10
      com.unity.render-pipelines.high-definition/HDRP/Editor/Sky/SkySettingsEditor.cs
  63. 10
      com.unity.render-pipelines.high-definition/HDRP/HDRenderPipelineAsset.asset
  64. 21
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Light/HDAdditionalLightData.cs
  65. 13
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightDefinition.cs
  66. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightEvaluation.hlsl
  67. 58
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs
  68. 1
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.hlsl
  69. 50
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightUtils.cs
  70. 123
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  71. 32
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  72. 34
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs
  73. 80
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ProbeWrapper.cs
  74. 259
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs
  75. 42
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ProxyVolume.cs
  76. 32
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs
  77. 11
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ShapeType.cs
  78. 3
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ShaderVariablesScreenSpaceLighting.hlsl
  79. 3
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/VolumeVoxelization.compute
  80. 6
      com.unity.render-pipelines.high-definition/HDRP/Material/Builtin/BuiltinData.cs
  81. 26
      com.unity.render-pipelines.high-definition/HDRP/Material/Builtin/BuiltinData.cs.hlsl
  82. 5
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalData.hlsl
  83. 6
      com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLitData.hlsl
  84. 24
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs
  85. 15
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs.hlsl
  86. 64
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl
  87. 45
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitBuiltinData.hlsl
  88. 10
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitData.hlsl
  89. 5
      com.unity.render-pipelines.high-definition/HDRP/Material/MaterialEvaluation.hlsl
  90. 66
      com.unity.render-pipelines.high-definition/HDRP/Material/MaterialUtilities.hlsl
  91. 39
      com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.hlsl
  92. 46
      com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLitData.hlsl
  93. 18
      com.unity.render-pipelines.high-definition/HDRP/Material/Unlit/UnlitData.hlsl
  94. 18
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  95. 3
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDStringConstants.cs
  96. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset
  97. 2
      com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/RenderPipelineResources.cs
  98. 3
      com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassDepthOnly.hlsl
  99. 3
      com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassDistortion.hlsl
  100. 4
      com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassForward.hlsl

4
.gitmodules


[submodule "com.unity.postprocessing"]
path = com.unity.postprocessing
url = https://github.com/Unity-Technologies/PostProcessing.git
branch = v2

6
README.md


## NOTE: We are migrating reported issues to fogbugz. Please log issues there.
## NOTE: We have migrate reported issues to fogbugz. Please log issues via the in unity bug tracker.
# Unity Scriptable Render Pipeline
The Scriptable Render Pipeline (SRP) is a new Unity feature in active development. SRP has been designed to give artists and developers the tools they need to create modern, high-fidelity graphics in Unity. Including a built-in Lightweight Render Pipeline for use on all platforms, and a High Definition Render Pipeline (HDRP) for use on compute shader compatible platforms. These features are available in Unity 2018.1+.

For a more detailed overview of the planned features and philosophy behind SRP, refer to the following Gdoc: [ScriptableRenderPipeline](https://docs.google.com/document/d/1e2jkr_-v5iaZRuHdnMrSv978LuJKYZhsIYnrDkNAuvQ/edit?usp=sharing)
Detailed documentation is being added here: [Wiki](https://github.com/Unity-Technologies/ScriptableRenderPipeline/wiki)
This feature is currently in preview. Some features may change or be removed before we move to a full release.

This repository consists of a folder that should be cloned outside the Assets\ folder of your Unity project. We recommend creating a new project to test SRP. Do not clone this repo into an existing project unless you want to break it, or unless you are updating to a newer version of the SRP repo.
After cloning you will need to edit your project's `packages.json` file (in either `UnityPackageManager/` or `Packages/`) to point to the SRP submodules you wish to use. See: https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/build/automation/TestProjects/GraphicsTests/Packages/manifest.json
After cloning you will need to edit your project's `packages.json` file (in either `UnityPackageManager/` or `Packages/`) to point to the SRP submodules you wish to use. See: https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/TestProjects/HDRP_Tests/Packages/manifest.json
This will link your project to the specific version of SRP you have cloned.

8
TestProjects/HDRP_Tests/Assets/GraphicTests/Common/TestRunner/Editor/SetupProject.cs


}
}
[MenuItem("Graphic Tests/Project Setup/RP: Deferred", false, 100)]
[MenuItem("Graphic Tests/Project Setup/RP: Deferred")]
[MenuItem("Graphic Tests/Project Setup/RP: Deferred Depth Prepass", false, 101)]
[MenuItem("Graphic Tests/Project Setup/RP: Deferred Depth Prepass")]
[MenuItem("Graphic Tests/Project Setup/RP: Deferred Depth Prepass Alpha Only", false, 102)]
[MenuItem("Graphic Tests/Project Setup/RP: Deferred Depth Prepass Alpha Only")]
[MenuItem("Graphic Tests/Project Setup/RP: Forward", false, 103)]
[MenuItem("Graphic Tests/Project Setup/RP: Forward")]
public static void SetRP_Forward()
{
SetRPAsset("forward");

62
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")]

yield return null;
ImageAssert.AreEqual(testCase.ReferenceImage, camera, (settings != null)?settings.ImageComparisonSettings:null);
}
public void Setup()
{
#if UNITY_EDITOR
// 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

17
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/1x_Materials/1401_StackLit/TestStackMat_Dielectric_SSS.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TestStackMat_Dielectric_SSS
m_Shader: {fileID: 4800000, guid: 3a796817b9614b347895c0e8db89b63a, type: 3}
m_ShaderKeywords: _MATERIAL_FEATURE_SUBSURFACE_SCATTERING _MATERIAL_FEATURE_TRANSMISSION

serializedVersion: 3
m_TexEnvs:
- _AmbientOcclusionMap:
m_Texture: {fileID: 2800000, guid: 73993dd804df9ad47abfdee49346e56b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Texture: {fileID: 2800000, guid: be4b71c50f9aa414ea41fcfb7a1ea330, type: 3}
m_Scale: {x: 2, y: 2}
m_Offset: {x: -0.05, y: 0.5}
- _AnisotropyMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}

- _Drag: 1
- _DstBlend: 0
- _DualSpecularLobeShow: 0
- _EmissiveColorMapShow: 0
- _EmissiveColorMapShow: 1
- _EmissiveShow: 0
- _EmissiveShow: 1
- _EnableAnisotropy: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableCoat: 0

- _ZWrite: 1
m_Colors:
- _AmbientOcclusionMapChannelMask: {r: 1, g: 0, b: 0, a: 0}
- _AmbientOcclusionMapRange: {r: 0, g: 1, b: 0, a: 0}
- _AmbientOcclusionMapRemap: {r: 0, g: 1, b: 0, a: 0}
- _AmbientOcclusionMapRange: {r: 0, g: 0.9999999, b: 0, a: 0}
- _AmbientOcclusionMapRemap: {r: 0, g: 0.9999999, b: 0, a: 0}
- _AnisotropyMapChannelMask: {r: 1, g: 0, b: 0, a: 0}
- _AnisotropyMapRange: {r: 0, g: 1, b: 0, a: 0}
- _AnisotropyMapRemap: {r: 0, g: 1, b: 0, a: 0}

435
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity
文件差异内容过多而无法显示
查看文件

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


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

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


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

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 306d620c715872046bf76568b7f382d4, type: 3}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a056f0394a2c3a8479aa8bf777a5b865, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 306d620c715872046bf76568b7f382d4, type: 3}
m_StaticBatchInfo:

m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114110876577682668, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114110876577682668, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
objectReference: {fileID: 11400000, guid: cc7b7e628a645144db38289e55e360a8, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
objectReference: {fileID: 11400000, guid: cc7b7e628a645144db38289e55e360a8,
type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114110876577682668, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114110876577682668, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
objectReference: {fileID: 11400000, guid: 23b7439fe7a306c4889c52e465f40911, type: 2}
objectReference: {fileID: 11400000, guid: 23b7439fe7a306c4889c52e465f40911,
type: 2}
- target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
propertyPath: m_LocalPosition.y
value: 9.79

propertyPath: m_LocalPosition.z
value: -9.54
objectReference: {fileID: 0}
- target: {fileID: 114482499083377642, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114482499083377642, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114482499083377642, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114482499083377642, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114482499083377642, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114482499083377642, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: ImageComparisonSettings.AverageCorrectnessThreshold
value: 0.00025
objectReference: {fileID: 0}

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: d8578dc525f3d814abfda01618dd2271, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 306d620c715872046bf76568b7f382d4, type: 3}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: c5473e8b737635345a306da9f38119e5, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 76b11840da66b3042ba92a2c8f8a6a22, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 306d620c715872046bf76568b7f382d4, type: 3}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 306d620c715872046bf76568b7f382d4, type: 3}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 306d620c715872046bf76568b7f382d4, type: 3}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: ddca6846a19ad9f4aa9cf2b0e2b0e22f, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: e5ef88455a605eb4eb0feb7494d6e839, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 02db561e2335c7740aba5dffbc5ce630, type: 2}
m_StaticBatchInfo:

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


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

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


m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 15203, guid: 0000000000000000f000000000000000, type: 0}
m_LightmapParameters: {fileID: 15203, guid: 0000000000000000f000000000000000,
type: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0

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

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114270329781043846, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114270329781043846, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114270329781043846, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114270329781043846, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114733060649624252, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114733060649624252, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114733060649624252, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114733060649624252, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: ImageComparisonSettings.AverageCorrectnessThreshold
value: 0.00025
objectReference: {fileID: 0}

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

- {x: 1.5, y: -1.5, z: -1.5}
- {x: 1.5, y: -1.5, z: 2.5}
- {x: 1.5, y: -1.5, z: -2.5}
m_Dering: 0
--- !u!4 &779090466
Transform:
m_ObjectHideFlags: 0

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6c9be79701956574888010a681a91064, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_IsActive: 1
--- !u!114 &1331608284
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1331608283}

data: 0bd7a33b0000803f
--- !u!114 &1331608285
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1331608283}

useOldInspector: 0
featuresFoldout: 1
showAdditionalSettings: 1
displayLightIntensity: 100
displayLightIntensity: 200
displayAreaLightEmissiveMesh: 0
--- !u!108 &1331608286
Light:

serializedVersion: 8
m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 3.5367763
m_Intensity: 7.0735526
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: f6086a92c29e7fe4cbe16f142620912c, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:

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


fileFormatVersion: 2
guid: d8cfa4fd9319d2444b3bf6dd836ffe31
labels:
- TestRunnerBake
DefaultImporter:
externalObjects: {}
userData:

2
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2601_ColorTemp.meta


fileFormatVersion: 2
guid: 8aec84e69348c114d960ca7cc8dd595b
guid: 2162076be91a8c545b268dbcb97c7658
folderAsset: yes
DefaultImporter:
externalObjects: {}

194
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2601_ColorTemp.unity


m_ReflectionIntensity: 0
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:

m_LightmapEditorSettings:
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 20
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1

m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 112000008, guid: 9b7aa6ae5c6da1548a211f040a7017b7, type: 2}
m_LightingDataAsset: {fileID: 112000004, guid: fcaf9eccbaa13734a915b4a09ad3ff8f,
type: 2}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 32
m_RootOrder: 31
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &116114150
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 37
m_RootOrder: 36
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &216308120
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 27
m_RootOrder: 26
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &257057735
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 38
m_RootOrder: 37
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &259199003
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 29
m_RootOrder: 28
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &267472392
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 23
m_RootOrder: 22
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &318928070
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 17
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &498933441
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 30
m_RootOrder: 29
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &533832108
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 33
m_RootOrder: 32
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &558086321
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 13
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &560421919
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 14
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &587617193
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 15
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &621608806
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 20
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &661728039
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 24
m_RootOrder: 23
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &844482178
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &887527257
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &916887742
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 18
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &960753678
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &965611802
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 28
m_RootOrder: 27
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &986121663
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!114 &986121666
MonoBehaviour:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 41
m_RootOrder: 40
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1081699464
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1207281478
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 34
m_RootOrder: 33
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1224049267
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1244967709
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 22
m_RootOrder: 21
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1248841136
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 12
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1322909810
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 36
m_RootOrder: 35
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1348755772
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1355112477
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 42
m_RootOrder: 41
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1370971663
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 16
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1378617740
GameObject:

m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &1378617741
Transform:

m_GameObject: {fileID: 1378617740}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 5, y: 0, z: -5.5}
m_LocalScale: {x: 3, y: 3, z: 3}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 10, y: 1, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0

serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_SkinWidth: 0.01
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1378617743
MeshRenderer:

m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 40
m_RootOrder: 39
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1508209860
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 19
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1537588142
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 35
m_RootOrder: 34
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1541755983
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1001 &1750108495
Prefab:

objectReference: {fileID: 0}
- target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
propertyPath: m_RootOrder
value: 2
value: 1
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: field of view
value: 55.6
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
propertyPath: waitForLightBake
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 25
m_RootOrder: 24
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &1953243359
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 39
m_RootOrder: 38
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &2006468835
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 31
m_RootOrder: 30
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &2044384723
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 26
m_RootOrder: 25
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &2073809735
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 21
m_RootOrder: 20
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!1 &2084815366
GameObject:

m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 8
--- !u!1 &2108040534
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2108040538}
- component: {fileID: 2108040537}
- component: {fileID: 2108040536}
- component: {fileID: 2108040535}
m_Layer: 0
m_Name: Plane (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!64 &2108040535
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2108040534}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &2108040536
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2108040534}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &2108040537
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2108040534}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &2108040538
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2108040534}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 35, y: 0, z: -5.5}
m_LocalScale: {x: 3, y: 3, z: 3}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

2
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2601_ColorTemp.unity.meta


fileFormatVersion: 2
guid: 34a3a4a7a56d3014dad3114e6b523742
labels:
- TestRunnerBake
- DoLightmap
DefaultImporter:
externalObjects: {}
userData:

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_All_ColorTint.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_All_ColorTint
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _ALBEDOCONTRIBUTION _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_BlendMask
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _ALBEDOCONTRIBUTION _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_Factor05.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_BlendMask_Factor05
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _ALBEDOCONTRIBUTION _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

14
TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9001_Decals/Decal_BlendMask_NoAlbedo.mat


serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Decal_BlendMask_NoAlbedo
m_Shader: {fileID: 4800000, guid: 1d64af84bdc970c4fae0c1e06dd95b73, type: 3}
m_ShaderKeywords: _COLORMAP _MASKMAP _NORMALMAP

m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DBufferMesh_M
- DBufferMesh_AO
- DBufferMesh_MAO
- DBufferMesh_MAOS
- DBufferMesh_MS
- DBufferMesh_AOS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:

- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DrawOrder: 0
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EnableBlendModePreserveSpecularLighting: 1

- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaskBlendMode: 4
- _MaskBlendSrc: 1
- _MaskBlendSrc: 0
- _MaskmapAO: 0
- _MaskmapMetal: 0
- _MaskmapSmoothness: 1

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

1
TestProjects/HDRP_Tests/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
"com.unity.render-pipelines.high-definition": "file:../../../com.unity.render-pipelines.high-definition",
"com.unity.shadergraph": "file:../../../com.unity.shadergraph",

18
TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset


path: Assets/GraphicTests/Scenes/1x_Materials/1101_Unlit.unity
guid: 7fe3f9e94b4355641ba1534c54d5c356
- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1102_Unlit_Distortion.unity
guid: a6e4a81e1988f24459f57a881905a465
- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1103_Unlit_Distortion_DepthTest.unity
guid: 27d04b0368c7fef4eb423d76cc0e48dc
- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1201_Lit_Features.unity
guid: 51392325eef9416439dc126a37256e6f
- enabled: 1

- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1205_Lit_Transparent_Refraction.unity
guid: 530aef5d08a1569479cc65b219b8f9fb
- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1206_Lit_Transparent_Distortion.unity
guid: fc3cc4c68d873e64ca12fcfc828d7ee4
- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1207_Lit_Displacement.unity
guid: ac4701d765fa26b4f83d2fb9ed6b3c08

- enabled: 1
path: Assets/GraphicTests/Scenes/2x_Lighting/2005_Area_Light_Meshes.unity
guid: 359ded33a047fd540b5e19a98547f5e2
- enabled: 1
path: Assets/GraphicTests/Scenes/2x_Lighting/2101_GI_Metapass.unity
guid: 8747b43f8bcf2b44cbc3ece373da65a9
- enabled: 1
path: Assets/GraphicTests/Scenes/2x_Lighting/2102_GI_Emission.unity
guid: b8f49ca9a12abb4468116e9422139e63
- enabled: 1
path: Assets/GraphicTests/Scenes/2x_Lighting/2103_BakeMixed.unity
guid: d8cfa4fd9319d2444b3bf6dd836ffe31
- enabled: 1
path: Assets/GraphicTests/Scenes/2x_Lighting/2201_ReflectionProbes_Priority.unity
guid: d485acf0535eb4b42a9a3847f4a8274a

83
TestProjects/HDRP_Tests/ProjectSettings/ProjectSettings.asset


use32BitDisplayBuffer: 1
preserveFramebufferAlpha: 0
disableDepthAndStencilBuffers: 0
androidStartInFullscreen: 1
androidBlitType: 0
defaultIsNativeResolution: 1
macRetinaSupport: 1

xboxOneDisableEsram: 0
xboxOnePresentImmediateThreshold: 0
switchQueueCommandMemory: 0
videoMemoryForVertexBuffers: 0
psp2PowerMode: 0
psp2AcquireBGM: 1
vulkanUseSWCommandBuffers: 0
m_SupportedAspectRatios:
4:3: 1
5:4: 1

dashSupport: 0
enable360StereoCapture: 0
protectGraphicsMemory: 0
enableFrameTimingStats: 0
useHDRDisplay: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30

appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
appleEnableProMotion: 0
vulkanEditorSupport: 0
clonedFromGUID: 00000000000000000000000000000000
templatePackageId:
templateDefaultScene:

ps4pnGameCustomData: 1
playerPrefsSupport: 0
enableApplicationExit: 0
resetTempFolder: 1
restrictedAudioUsageRights: 0
ps4UseResolutionFallback: 0
ps4ReprojectionSupport: 0

ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
monoEnv:
psp2Splashimage: {fileID: 0}
psp2NPTrophyPackPath:
psp2NPSupportGBMorGJP: 0
psp2NPAgeRating: 12
psp2NPTitleDatPath:
psp2NPCommsID:
psp2NPCommunicationsID:
psp2NPCommsPassphrase:
psp2NPCommsSig:
psp2ParamSfxPath:
psp2ManualPath:
psp2LiveAreaGatePath:
psp2LiveAreaBackroundPath:
psp2LiveAreaPath:
psp2LiveAreaTrialPath:
psp2PatchChangeInfoPath:
psp2PatchOriginalPackage:
psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui
psp2KeystoneFile:
psp2MemoryExpansionMode: 0
psp2DRMType: 0
psp2StorageType: 0
psp2MediaCapacity: 0
psp2DLCConfigPath:
psp2ThumbnailPath:
psp2BackgroundPath:
psp2SoundPath:
psp2TrophyCommId:
psp2TrophyPackagePath:
psp2PackagedResourcesPath:
psp2SaveDataQuota: 10240
psp2ParentalLevel: 1
psp2ShortTitle: Not Set
psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF
psp2Category: 0
psp2MasterVersion: 01.00
psp2AppVersion: 01.00
psp2TVBootMode: 0
psp2EnterButtonAssignment: 2
psp2TVDisableEmu: 0
psp2AllowTwitterDialog: 1
psp2Upgradable: 0
psp2HealthWarning: 0
psp2UseLibLocation: 0
psp2InfoBarOnStartup: 0
psp2InfoBarColor: 0
psp2ScriptOptimizationLevel: 2
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
spritePackerPolicy:

webGLUseEmbeddedResources: 0
webGLCompressionFormat: 1
webGLLinkerTarget: 0
webGLThreadsSupport: 0
14: UNITY_POST_PROCESSING_STACK_V2
17: UNITY_POST_PROCESSING_STACK_V2
18: UNITY_POST_PROCESSING_STACK_V2
19: UNITY_POST_PROCESSING_STACK_V2

26: UNITY_POST_PROCESSING_STACK_V2
27: UNITY_POST_PROCESSING_STACK_V2
28: UNITY_POST_PROCESSING_STACK_V2
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
allowUnsafeCode: 0
additionalIl2CppArgs:

metroMediumTileShowName: 0
metroLargeTileShowName: 0
metroWideTileShowName: 0
metroSupportStreamingInstall: 0
metroLastRequiredScene: 0
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1}
metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628,
a: 1}
metroSplashScreenUseBackgroundColor: 0
platformCapabilities: {}
metroFTAName:

daydreamIconForeground: {fileID: 0}
daydreamIconBackground: {fileID: 0}
cloudServicesEnabled: {}
luminIcon:
m_Name:
m_ModelFolderPath:
m_PortalFolderPath:
luminCert:
m_CertPath:
m_PrivateKeyPath:
luminIsChannelApp: 0
luminVersion:
m_VersionCode: 1
m_VersionName:
facebookAppId:
facebookCookies: 1
facebookLogging: 1
facebookStatus: 1
facebookXfbml: 0
facebookFrictionlessRequests: 1
framebufferDepthMemorylessMode: 0
legacyClampBlendShapeWeights: 1

11
TestProjects/LWGraphicsTest/Assets/TestScripts/CustomLWPipe.cs


if (m_Initialized)
return;
m_SetupForwardRenderingPass = new SetupForwardRenderingPass(renderer);
m_CreateLightweightRenderTexturesPass = new CreateLightweightRenderTexturesPass(renderer);
m_SetupLightweightConstants = new SetupLightweightConstanstPass(renderer);
m_RenderOpaqueForwardPass = new RenderOpaqueForwardPass(renderer);
m_SetupForwardRenderingPass = new SetupForwardRenderingPass();
m_CreateLightweightRenderTexturesPass = new CreateLightweightRenderTexturesPass();
m_SetupLightweightConstants = new SetupLightweightConstanstPass();
m_RenderOpaqueForwardPass = new RenderOpaqueForwardPass(renderer.GetMaterial(MaterialHandles.Error));
m_Initialized = true;
}

renderer.Clear();
renderer.SetupPerObjectLightIndices(ref cullResults, ref renderingData.lightData);
RenderTextureDescriptor baseDescriptor = renderer.CreateRTDesc(ref renderingData.cameraData);
RenderTextureDescriptor baseDescriptor = LightweightForwardRenderer.CreateRTDesc(ref renderingData.cameraData);
RenderTextureDescriptor shadowDescriptor = baseDescriptor;
shadowDescriptor.dimension = TextureDimension.Tex2D;

bool dynamicBatching = renderingData.supportsDynamicBatching;
RendererConfiguration rendererConfiguration = LightweightForwardRenderer.GetRendererConfiguration(renderingData.lightData.totalAdditionalLightsCount);
m_SetupLightweightConstants.Setup(renderer.maxVisibleLocalLights, renderer.perObjectLightIndices);
renderer.EnqueuePass(m_SetupLightweightConstants);
m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, LightweightForwardRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration, dynamicBatching);

1
TestProjects/LWGraphicsTest/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
"com.unity.render-pipelines.lightweight": "file:../../../com.unity.render-pipelines.lightweight",
"com.unity.shadergraph": "file:../../../com.unity.shadergraph",

2
TestProjects/PostProcessing/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.postprocessing": "2.0.10-preview",
"com.unity.testframework.graphics": "file:../../../com.unity.testframework.graphics",
"com.unity.textmeshpro": "1.2.4"
},

1
TestProjects/ShaderGraph/Packages/manifest.json


{
"dependencies": {
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",
"com.unity.render-pipelines.high-definition": "file:../../../com.unity.render-pipelines.high-definition",
"com.unity.render-pipelines.lightweight": "file:../../../com.unity.render-pipelines.lightweight",

9
build.py


def packages_list():
return [
#ORDER IS IMPORTANT
("com.unity.shadergraph", os.path.join("com.unity.shadergraph")),
("com.unity.shadergraph", os.path.join("com.unity.shadergraph")),
("com.unity.postprocessing", os.path.join("com.unity.postprocessing")),
("com.unity.testframework.graphics", os.path.join("com.unity.testframework.graphics")),
("com.unity.testframework.graphics", os.path.join("com.unity.testframework.graphics"))
]
def test_packages_list():

"com.unity.render-pipelines.high-definition",
"com.unity.shadergraph",
"com.unity.postprocessing"
"com.unity.shadergraph"
]
if __name__ == "__main__":

5
com.unity.render-pipelines.core/CHANGELOG.md


The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [3.1.0]
- Added Core EditMode tests
- Added Core unsafe utilities
- Fixed CoreUtils.QuickSort infinite loop when two elements in the list are equals.
### Changed
- Moved root files into folders for easier maintenance

6
com.unity.render-pipelines.core/CoreRP/ShaderLibrary/ImageBasedLighting.hlsl


return PerceptualRoughnessToMipmapLevel(perceptualRoughness, UNITY_SPECCUBE_LOD_STEPS);
}
// Mapping for convolved Texture2D, this is an empirical remapping to match GGX version of cubemap convolution
real PlanarPerceptualRoughnessToMipmapLevel(real perceptualRoughness, uint mipMapcount)
{
return PositivePow(perceptualRoughness, 0.8) * uint(max(mipMapcount - 1, 0));
}
// The *accurate* version of the non-linear remapping. It works by
// approximating the cone of the specular lobe, and then computing the MIP map level
// which (approximately) covers the footprint of the lobe with a single texel.

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


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

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

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


buffer.Release();
}
// Just a sort function that doesn't allocate memory
// Note: Shoud be repalc by a radix sort for positive integer
public static int Partition(uint[] numbers, int left, int right)
public static unsafe void QuickSort(uint[] arr, int left, int right)
uint pivot = numbers[left];
while (true)
{
while (numbers[left] < pivot)
left++;
while (numbers[right] > pivot)
right--;
if (left < right)
{
uint temp = numbers[right];
numbers[right] = numbers[left];
numbers[left] = temp;
}
else
{
return right;
}
}
}
public static void QuickSort(uint[] arr, int left, int right)
{
// For Recursion
if (left < right)
{
int pivot = Partition(arr, left, right);
if (pivot > 1)
QuickSort(arr, left, pivot - 1);
if (pivot + 1 < right)
QuickSort(arr, pivot + 1, right);
}
fixed (uint* ptr = arr)
CoreUnsafeUtils.QuickSort<uint>(ptr, left, right);
}
public static Mesh CreateCubeMesh(Vector3 min, Vector3 max)

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


{
"name": "com.unity.render-pipelines.core",
"description": "Core library for Unity render pipelines.",
"version": "3.0.1-preview",
"unity": "2018.2",
"version": "3.1.0-preview",
"unity": "2018.3",
"displayName": "Render Pipeline Core Library"
}

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


The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [unreleased]
## [3.0.1-preview]
## [3.1.0-preview]
### Added
- Decal now support per channel selection mask. There is now two mode. One with BaseColor, Normal and Smoothness and another one more expensive with BaseColor, Normal, Smoothness, Metal and AO. Control is on HDRP Asset. This may require to launch an update script for old scene: 'Edit/Render Pipeline/Single step upgrade script/Upgrade all DecalMaterial MaskBlendMode'.

- When LightLayers is enabled, the AmbientOclusion is store in the GBuffer in deferred path allowing to avoid double occlusion with SSAO. In forward the double occlusion is now always avoided.
- Added the possibility to add an override transform on the camera for volume interpolation
- Added desired lux intensity and auto multiplier for HDRI sky
- Added an option to disable light by type in the debug menu
- Added gradient sky
- Split EmissiveColor and bakeDiffuseLighting in forward avoiding the emissiveColor to be affect by SSAO
- Added a volume to control indirect light intensity
- Added EV 100 intensity unit for area lights
### Fixed
- Fixed an issue with PreIntegratedFGD texture being sometimes destroyed and not regenerated causing rendering to break

- Refactored Constant Buffers to avoid hitting the maximum number of bound CBs in some cases.
- Fixed the light range affecting the transform scale when changed.
- Snap to grid now works for Decal projector resizing.
- Added a warning for 128x128 cookie texture without mipmaps
- Replace the sampler used for density volumes for correct wrap mode handling
### Changed
- Movde Render Pipeline Debug "Windows from Windows->General-> Render Pipeline debug windows" to "Windows from Windows->Analysis-> Render Pipeline debug windows"

- Refactor shader code: BakeLightingData structure have been replace by BuiltinData. Lot of shader code have been remove/change.
- Refactor shader code: All GBuffer are now handled by the deferred material. Mean ShadowMask and LightLayers are control by lit material in lit.hlsl and not outside anymore. Lot of shader code have been remove/change.
- Refactor shader code: Rename GetBakedDiffuseLighting to ModifyBakedDiffuseLighting. This function now handle lighting model for transmission too. Lux meter debug mode is factor outisde.
- Refactor shader code: GetBakedDiffuseLighting is not call anymore in GBuffer or forward pass, including the ConvertSurfaceDataToBSDFData and GetPreLightData, this is done in ModifyBakedDiffuseLighting now
- Refactor shader code: Added a backBakeDiffuseLighting to BuiltinData to handle lighting for transmission
- Refactor shader code: Material must now call InitBuiltinData (Init all to zero + init bakeDiffuseLighting and backBakeDiffuseLighting ) and PostInitBuiltinData
- Add Coupling of (HD)ReflectionProbe and HDAdditionalReflectionData for reset and remove in inspector contextual menu of ReflectoinProbe
- Add macro to forbid unity_ObjectToWorld/unity_WorldToObject to be use as it doesn't handle camera relative rendering
- Add opacity control on contact shadow

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


{
// Used to debug SSRay model
// 1x32 bits
public Lit.ProjectionModel tracingModel;
public ScreenSpaceLighting.ProjectionModel tracingModel;
// 6x32 bits
public uint loopStartPositionSSX; // Proxy, HiZ, Linear

public float iterationLinearDepthBufferMin; // HiZ, Linear
public float iterationLinearDepthBufferMax; // HiZ, Linear
public float iterationLinearDepthBufferMinThickness; // HiZ, Linear
public Lit.HiZIntersectionKind iterationIntersectionKind; // HiZ
public ScreenSpaceLighting.HiZIntersectionKind iterationIntersectionKind; // HiZ
public uint iterationCellSizeW; // HiZ, Linear
public uint iterationCellSizeH; // HiZ, Linear
public EnvShapeType proxyShapeType; // Proxy

public static GUIContent[] debuggedAlgorithmStrings = null;
public static int[] debuggedAlgorithmValues = null;
Lit.ProjectionModel m_LastProjectionModel = Lit.ProjectionModel.None;
ScreenSpaceLighting.ProjectionModel m_LastProjectionModel = ScreenSpaceLighting.ProjectionModel.None;
ScreenSpaceTracingDebug m_ScreenSpaceTracingDebugData;
public ScreenSpaceTracingDebug screenSpaceTracingDebugData
{

if (m_LastProjectionModel != m_ScreenSpaceTracingDebugData.tracingModel)
{
m_LastProjectionModel = m_ScreenSpaceTracingDebugData.tracingModel;
RefreshScreenSpaceTracingDebug<Lit.ProjectionModel>(null, m_LastProjectionModel);
RefreshScreenSpaceTracingDebug<ScreenSpaceLighting.ProjectionModel>(null, m_LastProjectionModel);
if (m_ScreenSpaceTracingDebugData.tracingModel == Lit.ProjectionModel.Proxy)
if (m_ScreenSpaceTracingDebugData.tracingModel == ScreenSpaceLighting.ProjectionModel.Proxy)
{
showSSRayDepthPyramid = false;
showSSRayGrid = false;

debugScreenSpaceTracingProxyValues = debugScreenSpaceTracingProxyValueList.ToArray();
debugScreenSpaceTracingLinearStrings = debugScreenSpaceTracingLinearStringsList.ToArray();
debugScreenSpaceTracingLinearValues = debugScreenSpaceTracingLinearValueList.ToArray();
debuggedAlgorithmStrings = Enum.GetNames(typeof(Lit.ProjectionModel))
debuggedAlgorithmStrings = Enum.GetNames(typeof(ScreenSpaceLighting.ProjectionModel))
debuggedAlgorithmValues = (int[])Enum.GetValues(typeof(Lit.ProjectionModel));
debuggedAlgorithmValues = (int[])Enum.GetValues(typeof(ScreenSpaceLighting.ProjectionModel));
}
public int GetDebugMaterialIndex()

switch (screenSpaceTracingDebugData.tracingModel)
{
case Lit.ProjectionModel.Proxy:
case ScreenSpaceLighting.ProjectionModel.Proxy:
{
debugSettingsContainer.children.Add(
new DebugUI.EnumField { displayName = "Debug Mode", getter = GetDebugLightingSubMode, setter = SetScreenSpaceTracingDebugMode, enumNames = debugScreenSpaceTracingProxyStrings, enumValues = debugScreenSpaceTracingProxyValues, onValueChanged = RefreshScreenSpaceTracingDebug }

);
break;
}
case Lit.ProjectionModel.HiZ:
case ScreenSpaceLighting.ProjectionModel.HiZ:
{
debugSettingsContainer.children.Insert(1, new DebugUI.Value { displayName = string.Empty, getter = () => "Press PageUp/PageDown to Increase/Decrease the HiZ step." });
debugSettingsContainer.children.Add(

);
break;
}
case Lit.ProjectionModel.Linear:
case ScreenSpaceLighting.ProjectionModel.Linear:
{
debugSettingsContainer.children.Add(
new DebugUI.EnumField { displayName = "Debug Mode", getter = GetDebugLightingSubMode, setter = SetScreenSpaceTracingDebugMode, enumNames = debugScreenSpaceTracingLinearStrings, enumValues = debugScreenSpaceTracingLinearValues, onValueChanged = RefreshScreenSpaceTracingDebug },

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

1
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugFullScreen.shader


#include "HDRP/ShaderVariables.hlsl"
#include "HDRP/Debug/DebugDisplay.cs.hlsl"
#include "HDRP/Material/Builtin/BuiltinData.hlsl"
#include "HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.hlsl"
CBUFFER_START (UnityDebug)
float _FullScreenDebugMode;

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


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

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


{
Lumen = LightUnit.Lumen,
Luminance = LightUnit.Luminance,
Ev100 = LightUnit.Ev100,
}
enum PunctualLightUnit

// 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);
}
intensity = LightUtils.ConvertAreaLightLumenToLuminance((LightTypeExtent)m_AdditionalLightData.lightTypeExtent.enumValueIndex, intensity, m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue);
{
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);
}
intensity = LightUtils.ConvertAreaLightLuminanceToLumen((LightTypeExtent)m_AdditionalLightData.lightTypeExtent.enumValueIndex, intensity, m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue);
if (oldLightUnit == LightUnit.Luminance && newLightUnit == LightUnit.Ev100)
intensity = LightUtils.ConvertLuminanceToEv(intensity);
if (oldLightUnit == LightUnit.Ev100 && newLightUnit == LightUnit.Luminance)
intensity = LightUtils.ConvertEvToLuminance(intensity);
if (oldLightUnit == LightUnit.Ev100 && newLightUnit == LightUnit.Lumen)
intensity = LightUtils.ConvertAreaLightEvToLumen((LightTypeExtent)m_AdditionalLightData.lightTypeExtent.enumValueIndex, intensity, m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue);
if (oldLightUnit == LightUnit.Lumen && newLightUnit == LightUnit.Ev100)
intensity = LightUtils.ConvertAreaLightLumenToEv((LightTypeExtent)m_AdditionalLightData.lightTypeExtent.enumValueIndex, intensity, m_AdditionalLightData.shapeWidth.floatValue, m_AdditionalLightData.shapeHeight.floatValue);
m_AdditionalLightData.intensity.floatValue = intensity;
}

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


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

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

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

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


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

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

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

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

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


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

[CanEditMultipleObjects]
partial class HDReflectionProbeEditor : Editor
{
[MenuItem("CONTEXT/ReflectionProbe/Remove HD Reflection Probe", false, 0)]
static void RemoveLight(MenuCommand menuCommand)
[MenuItem("CONTEXT/ReflectionProbe/Remove Component", false, 0)]
static void RemoveReflectionProbe(MenuCommand menuCommand)
{
GameObject go = ((ReflectionProbe)menuCommand.context).gameObject;

Undo.DestroyObjectImmediate(go.GetComponent<HDAdditionalReflectionData>());
}
[MenuItem("CONTEXT/ReflectionProbe/Reset", false, 0)]
static void ResetReflectionProbe(MenuCommand menuCommand)
{
GameObject go = ((ReflectionProbe)menuCommand.context).gameObject;
Assert.IsNotNull(go);
ReflectionProbe reflectionProbe = go.GetComponent<ReflectionProbe>();
HDAdditionalReflectionData reflectionProbeAdditionalData = go.GetComponent<HDAdditionalReflectionData>();
Assert.IsNotNull(reflectionProbe);
Assert.IsNotNull(reflectionProbeAdditionalData);
Undo.SetCurrentGroupName("Reset HD Reflection Probe");
Undo.RecordObjects(new UnityEngine.Object[] { reflectionProbe, reflectionProbeAdditionalData }, "Reset HD Reflection Probe");
reflectionProbe.Reset();
// To avoid duplicating init code we copy default settings to Reset additional data
// Note: we can't call this code inside the HDAdditionalReflectionData, thus why we don't wrap it in Reset() function
if(HDUtils.s_DefaultHDAdditionalReflectionData.influenceVolume == null)
{
HDUtils.s_DefaultHDAdditionalReflectionData.Awake();
}
HDUtils.s_DefaultHDAdditionalReflectionData.CopyTo(reflectionProbeAdditionalData);
}
static Dictionary<ReflectionProbe, HDReflectionProbeEditor> s_ReflectionProbeEditors = new Dictionary<ReflectionProbe, HDReflectionProbeEditor>();
static HDReflectionProbeEditor GetEditorFor(ReflectionProbe p)

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

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

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

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


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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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


public override void OnInspectorGUI()
{
OnCommonInspectorGUI();
var projectionModel = (Lit.ProjectionModel)m_DeferredProjectionModel.value.enumValueIndex;
var projectionModel = (ScreenSpaceLighting.ProjectionModel)m_DeferredProjectionModel.value.enumValueIndex;
case Lit.ProjectionModel.HiZ:
case ScreenSpaceLighting.ProjectionModel.HiZ:
case Lit.ProjectionModel.Proxy:
case ScreenSpaceLighting.ProjectionModel.Proxy:
EditorGUILayout.Separator();
OnProxyInspectorGUI();
break;

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


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

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

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

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


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

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

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


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

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

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

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

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


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

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

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


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

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

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

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

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

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

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

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


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

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

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

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

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


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

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

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

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

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

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


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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

16
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Lit/LitUI.cs


&& !isPrepass)
{
m_MaterialEditor.ShaderProperty(refractionModel, Styles.refractionModelText);
var mode = (Lit.RefractionModel)refractionModel.floatValue;
if (mode != Lit.RefractionModel.None)
var mode = (ScreenSpaceLighting.RefractionModel)refractionModel.floatValue;
if (mode != ScreenSpaceLighting.RefractionModel.None)
{
m_MaterialEditor.ShaderProperty(ssrefractionProjectionModel, Styles.refractionProjectionModelText);
m_MaterialEditor.ShaderProperty(ior, Styles.refractionIorText);

CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_IRIDESCENCE", materialId == BaseLitGUI.MaterialId.LitIridescence);
CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_SPECULAR_COLOR", materialId == BaseLitGUI.MaterialId.LitSpecular);
var refractionModelValue = (Lit.RefractionModel)material.GetFloat(kRefractionModel);
var refractionProjectionModelValue = (Lit.ProjectionModel)material.GetFloat(kSSRefractionProjectionModel);
var refractionModelValue = (ScreenSpaceLighting.RefractionModel)material.GetFloat(kRefractionModel);
var refractionProjectionModelValue = (ScreenSpaceLighting.ProjectionModel)material.GetFloat(kSSRefractionProjectionModel);
CoreUtils.SetKeyword(material, "_REFRACTION_PLANE", (refractionModelValue == Lit.RefractionModel.Plane) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SPHERE", (refractionModelValue == Lit.RefractionModel.Sphere) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_PLANE", (refractionModelValue == ScreenSpaceLighting.RefractionModel.Plane) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SPHERE", (refractionModelValue == ScreenSpaceLighting.RefractionModel.Sphere) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_PROXY", (refractionProjectionModelValue == Lit.ProjectionModel.Proxy) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_HIZ", (refractionProjectionModelValue == Lit.ProjectionModel.HiZ) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_PROXY", (refractionProjectionModelValue == ScreenSpaceLighting.ProjectionModel.Proxy) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_HIZ", (refractionProjectionModelValue == ScreenSpaceLighting.ProjectionModel.HiZ) && canHaveRefraction);
}
}
} // namespace UnityEditor

4
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Unlit/BaseUnlitUI.cs


EditorGUI.indentLevel--;
}
if (transparentBackfaceEnable != null && (surfaceTypeValue == SurfaceType.Transparent))
if (transparentBackfaceEnable != null && surfaceTypeValue == SurfaceType.Transparent)
if (transparentSortPriority != null && (surfaceTypeValue == SurfaceType.Transparent))
if (transparentSortPriority != null && surfaceTypeValue == SurfaceType.Transparent)
{
EditorGUI.BeginChangeCheck();
m_MaterialEditor.ShaderProperty(transparentSortPriority, StylesBaseUnlit.transparentSortPriorityText);

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


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

44
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDPBRPass.template


$SurfaceDescription.Normal: normalTS = surfaceDescription.Normal;
// compute world space normal
GetNormalWS(fragInputs, V, normalTS, surfaceData.normalWS);
GetNormalWS(fragInputs, normalTS, surfaceData.normalWS);
// TODO: use surfaceDescription tangent definition for anisotropy
surfaceData.tangentWS = normalize(fragInputs.worldToTangent[0].xyz); // The tangent is not normalize in worldToTangent for mikkt. TODO: Check if it expected that we normalize with Morten. Tag: SURFACE_GRADIENT

BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
// Builtin Data -- we don't call GetBuiltinData(fragInputs, surfaceData, ...)
// that function assumes there are specific global properties defined
// for shadergraph shaders, we fill it out here instead
ZERO_INITIALIZE(BuiltinData, builtinData);
float3 bentNormalWS = surfaceData.normalWS; // TODO : make bent normals work
builtinData.opacity = surfaceDescription.Alpha;
builtinData.bakeDiffuseLighting = SampleBakedGI(fragInputs.positionRWS, bentNormalWS, fragInputs.texCoord1, fragInputs.texCoord2); // see GetBuiltinData()
// It is safe to call this function here as surfaceData have been filled
// We want to know if we must enable transmission on GI for SSS material, if the material have no SSS, this code will be remove by the compiler.
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS.xy, surfaceData);
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
{
// For now simply recall the function with inverted normal, the compiler should be able to optimize the lightmap case to not resample the directional lightmap
// however it will not optimize the lightprobe case due to the proxy volume relying on dynamic if (we rely must get right of this dynamic if), not a problem for SH9, but a problem for proxy volume.
// TODO: optimize more this code.
// Add GI transmission contribution by resampling the GI for inverted vertex normal
builtinData.bakeDiffuseLighting += SampleBakedGI(fragInputs.positionRWS, -fragInputs.worldToTangent[2], fragInputs.texCoord1, fragInputs.texCoord2) * bsdfData.transmittance;
}
// Builtin Data
// For back lighting we use the oposite vertex normal
InitBuiltinData(surfaceDescription.Alpha, surfaceData.normalWS, -fragInputs.worldToTangent[2], fragInputs.positionRWS, fragInputs.texCoord1, fragInputs.texCoord2, builtinData);
builtinData.velocity = float2(0.0, 0.0);
#ifdef SHADOWS_SHADOWMASK
float4 shadowMask = SampleShadowMask(fragInputs.positionRWS, fragInputs.texCoord1);
builtinData.shadowMask0 = shadowMask.x;
builtinData.shadowMask1 = shadowMask.y;
builtinData.shadowMask2 = shadowMask.z;
builtinData.shadowMask3 = shadowMask.w;
#else
builtinData.shadowMask0 = 0.0;
builtinData.shadowMask1 = 0.0;
builtinData.shadowMask2 = 0.0;
builtinData.shadowMask3 = 0.0;
#endif
// Use uniform directly - The float need to be cast to uint (as unity don't support to set a uint as uniform)
builtinData.renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
}
//-------------------------------------------------------------------------------------

14
com.unity.render-pipelines.high-definition/HDRP/Editor/ShaderGraph/HDUnlitPassForward.template


BuildSurfaceData(fragInputs, surfaceDescription, V, surfaceData);
// Builtin Data -- we don't call GetBuiltinData(fragInputs, surfaceData, ...)
// that function assumes there are specific global properties defined
// for shadergraph shaders, we fill it out here instead
ZERO_INITIALIZE(BuiltinData, builtinData);
// Builtin Data
ZERO_INITIALIZE(BuiltinData, builtinData); // No call to InitBuiltinData as we don't have any lighting
builtinData.bakeDiffuseLighting = float3(0.0, 0.0, 0.0);
builtinData.velocity = float2(0.0, 0.0);
builtinData.shadowMask0 = 0.0;
builtinData.shadowMask1 = 0.0;
builtinData.shadowMask2 = 0.0;
builtinData.shadowMask3 = 0.0;
builtinData.renderingLayers = 0.0;
builtinData.depthOffset = 0.0; // ApplyPerPixelDisplacement(input, V, layerTexCoord, blendMasks); #ifdef _DEPTHOFFSET_ON : ApplyDepthOffsetPositionInput(V, depthOffset, GetWorldToHClipMatrix(), posInput);
}
//-------------------------------------------------------------------------------------

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


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

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

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

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


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

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

PropertyField(m_IncludeSunInBaking);
}
}
}
}

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


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

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

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

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

21
com.unity.render-pipelines.high-definition/HDRP/Lighting/Light/HDAdditionalLightData.cs


Candela,
Lux,
Luminance,
Ev100,
}
// Light layering

if (lightUnit == LightUnit.Lumen)
{
switch (lightTypeExtent)
{
case LightTypeExtent.Punctual:
SetLightIntensityPunctual(intensity);
break;
case LightTypeExtent.Line:
m_Light.intensity = LightUtils.CalculateLineLightLumenToLuminance(intensity, shapeWidth);
break;
case LightTypeExtent.Rectangle:
m_Light.intensity = LightUtils.ConvertRectLightLumenToLuminance(intensity, shapeWidth, shapeHeight);
break;
}
if (lightTypeExtent == LightTypeExtent.Punctual)
SetLightIntensityPunctual(intensity);
else
m_Light.intensity = LightUtils.ConvertAreaLightLumenToLuminance(lightTypeExtent, intensity, shapeWidth, shapeHeight);
}
else if (lightUnit == LightUnit.Ev100)
{
m_Light.intensity = LightUtils.ConvertEvToLuminance(intensity);
}
else
m_Light.intensity = intensity;

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


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

2
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightEvaluation.hlsl


// Note: we do not modify the distance to the light, or the light angle for the back face.
// This is a performance-saving optimization which makes sense as long as the thickness is small.
}
transmittance = lerp( bsdfData.transmittance, transmittance, lightData.shadowDimmer);
}
return transmittance;

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


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

ContactShadows m_ContactShadows = null;
bool m_EnableContactShadow = false;
IndirectLightingController m_indirectLightingController = null;
// Following is an array of material of size eight for all combination of keyword: OUTPUT_SPLIT_LIGHTING - LIGHTLOOP_TILE_PASS - SHADOWS_SHADOWMASK - USE_FPTL_LIGHTLIST/USE_CLUSTERED_LIGHTLIST - DEBUG_DISPLAY
Material[] m_deferredLightingMaterial;

m_ContactShadows = VolumeManager.instance.stack.GetComponent<ContactShadows>();
m_EnableContactShadow = m_FrameSettings.enableContactShadows && m_ContactShadows.enable && m_ContactShadows.length > 0;
m_indirectLightingController = VolumeManager.instance.stack.GetComponent<IndirectLightingController>();
// Cluster
{

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

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

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

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

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

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

// Build light data
var envLightData = new EnvLightData();
envLightData.multiplier = probe.multiplier;
envLightData.multiplier = probe.multiplier * m_indirectLightingController.indirectSpecularIntensity;
envLightData.influenceExtents = probe.influenceExtents;
envLightData.blendNormalDistancePositive = probe.blendNormalDistancePositive;
envLightData.blendNormalDistanceNegative = probe.blendNormalDistanceNegative;

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

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

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

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

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

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

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

1
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.hlsl


return (lightLayers & renderingLayers) != 0;
}
// bakeDiffuseLighting is part of the prototype so a user is able to implement a "base pass" with GI and multipass direct light (aka old unity rendering path)
void LightLoop( float3 V, PositionInputs posInput, PreLightData preLightData, BSDFData bsdfData, BuiltinData builtinData, uint featureFlags,
out float3 diffuseLighting,
out float3 specularLighting)

50
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightUtils.cs


return intensity * ((width * height) * Mathf.PI);
}
public static float ConvertEvToLuminance(float ev)
{
return Mathf.Pow(2, ev - 3);
}
public static float ConvertLuminanceToEv(float luminance)
{
const float k = 12.5f;
return (float)Math.Log((luminance * 100f) / k, 2);
}
public static float ConvertAreaLightLumenToLuminance(LightTypeExtent areaLightType, float lumen, float width, float height = 0)
{
switch (areaLightType)
{
case LightTypeExtent.Line:
return LightUtils.CalculateLineLightLumenToLuminance(lumen, width);
case LightTypeExtent.Rectangle:
return LightUtils.ConvertRectLightLumenToLuminance(lumen, width, height);
}
return lumen;
}
public static float ConvertAreaLightLuminanceToLumen(LightTypeExtent areaLightType, float luminance, float width, float height = 0)
{
switch (areaLightType)
{
case LightTypeExtent.Line:
return LightUtils.CalculateLineLightLuminanceToLumen(luminance, width);
case LightTypeExtent.Rectangle:
return LightUtils.ConvertRectLightLuminanceToLumen(luminance, width, height);
}
return luminance;
}
public static float ConvertAreaLightLumenToEv(LightTypeExtent areaLightType, float lumen, float width, float height)
{
float luminance = ConvertAreaLightLumenToLuminance(areaLightType, lumen, width, height);
return ConvertLuminanceToEv(luminance);
}
public static float ConvertAreaLightEvToLumen(LightTypeExtent areaLightType, float ev, float width, float height)
{
float luminance = ConvertEvToLuminance(ev);
return ConvertAreaLightLuminanceToLumen(areaLightType, luminance, width, height);
}
// convert intensity (lumen) to nits
public static float CalculateLineLightLumenToLuminance(float intensity, float lineWidth)
{

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


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

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

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

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

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

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


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

/// <summary>ProxyVolume currently used by this probe.</summary>
public ReflectionProxyVolumeComponent proxyVolume { get { return m_ProxyVolume; } }
/// <summary>InfluenceVolume of the probe.</summary>
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } private set { m_InfluenceVolume = value; } }
public float multiplier { get { return m_Multiplier; } }
public float multiplier { get { return m_Multiplier; } protected set { m_Multiplier = value; } }
public float weight { get { return m_Weight; } }
public float weight { get { return m_Weight; } protected set { m_Weight = value; } }
/// <summary>The capture mode.</summary>
public virtual ReflectionProbeMode mode

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

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


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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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


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

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

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


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

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

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


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

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


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

3
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ShaderVariablesScreenSpaceLighting.hlsl


// Ambiant occlusion
float4 _AmbientOcclusionParam; // xyz occlusion color, w directLightStrenght
float4 _IndirectLightingMultiplier; // .x indirect diffuse multiplier (use with indirect lighting volume controler)
#else
// Rough refraction texture
// Color pyramid (width, height, lodcount, Unused)

3
com.unity.render-pipelines.high-definition/HDRP/Lighting/Volumetrics/VolumeVoxelization.compute


float halfTexelSize = 0.5f * rcp(mipSize);
voxelCenterUVW.z = clamp(voxelCenterUVW.z, offset + halfTexelSize, offset + rcpNumTextures - halfTexelSize);
return SAMPLE_TEXTURE3D_LOD(_VolumeMaskAtlas, s_trilinear_clamp_sampler, voxelCenterUVW, lod).a;
// Reminder: still no filtering across the the wrap in Z.
return SAMPLE_TEXTURE3D_LOD(_VolumeMaskAtlas, s_trilinear_repeat_sampler, voxelCenterUVW, lod).a;
}

6
com.unity.render-pipelines.high-definition/HDRP/Material/Builtin/BuiltinData.cs


// BuiltinData
// This structure include common data that should be present in all material
// and are independent from the BSDF parametrization.
// Note: These parameters can be store in GBuffer if the writer wants
// Note: These parameters can be store in GBuffer or not depends on storage available
//-----------------------------------------------------------------------------
[GenerateHLSL(PackingRules.Exact, false, true, 100)]
public struct BuiltinData

// at the same time than material information.
[SurfaceDataAttributes("Bake Diffuse Lighting", false, true)]
public Vector3 bakeDiffuseLighting; // This is the result of sampling lightmap/lightprobe/proxyvolume
[SurfaceDataAttributes("Back Bake Diffuse Lighting", false, true)]
public Vector3 backBakeDiffuseLighting; // This is the result of sampling lightmap/lightprobe/proxyvolume from the back for transmission
// Use for float instead of vector4 to ease the debug (no performance impact)
// Note: We have no way to remove these value automatically based on either SHADEROPTIONS_BAKED_SHADOW_MASK_ENABLE or s_BakedShadowMaskEnable here. Unless we make two structure... For now always keep this value

[SurfaceDataAttributes("Distortion Blur")]
public float distortionBlur; // Define the color buffer mipmap level to use
// Misc
// Depth
[SurfaceDataAttributes("Depth Offset")]
public float depthOffset; // define the depth in unity unit to add in Z forward direction
};

26
com.unity.render-pipelines.high-definition/HDRP/Material/Builtin/BuiltinData.cs.hlsl


//
#define DEBUGVIEW_BUILTIN_BUILTINDATA_OPACITY (100)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_BAKE_DIFFUSE_LIGHTING (101)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_0 (102)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_1 (103)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_2 (104)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_3 (105)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_EMISSIVE_COLOR (106)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_VELOCITY (107)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_DISTORTION (108)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_DISTORTION_BLUR (109)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_RENDERING_LAYERS (110)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_DEPTH_OFFSET (111)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_BACK_BAKE_DIFFUSE_LIGHTING (102)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_0 (103)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_1 (104)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_2 (105)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_3 (106)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_EMISSIVE_COLOR (107)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_VELOCITY (108)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_DISTORTION (109)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_DISTORTION_BLUR (110)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_RENDERING_LAYERS (111)
#define DEBUGVIEW_BUILTIN_BUILTINDATA_DEPTH_OFFSET (112)
// Generated from UnityEngine.Experimental.Rendering.HDPipeline.Builtin+BuiltinData
// PackingRules = Exact

float3 bakeDiffuseLighting;
float3 backBakeDiffuseLighting;
float shadowMask0;
float shadowMask1;
float shadowMask2;

break;
case DEBUGVIEW_BUILTIN_BUILTINDATA_BAKE_DIFFUSE_LIGHTING:
result = builtindata.bakeDiffuseLighting;
needLinearToSRGB = true;
break;
case DEBUGVIEW_BUILTIN_BUILTINDATA_BACK_BAKE_DIFFUSE_LIGHTING:
result = builtindata.backBakeDiffuseLighting;
needLinearToSRGB = true;
break;
case DEBUGVIEW_BUILTIN_BUILTINDATA_SHADOW_MASK_0:

5
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/DecalData.hlsl


#include "CoreRP/ShaderLibrary/Packing.hlsl"
#include "CoreRP/ShaderLibrary/Sampling/SampleUVMapping.hlsl"
#include "CoreRP/ShaderLibrary/EntityLighting.hlsl"
#include "../MaterialUtilities.hlsl"
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR)
void GetSurfaceData(float2 texCoordDS, float4x4 normalToWorld, out DecalSurfaceData surfaceData)

#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR)
float3 normalWS = mul((float3x3)normalToWorld, normalTS);
#elif (SHADERPASS == SHADERPASS_DBUFFER_MESH)
float3 normalWS;
GetNormalWS(input, 0, normalTS, normalWS);
// We need to normalize as we use mikkt tangent space and this is expected (tangent space is not normalize)
float3 normalWS = normalize(TransformTangentToWorld(normalTS, input.worldToTangent));
#endif
surfaceData.normalWS.xyz = normalWS * 0.5f + 0.5f;
surfaceData.HTileMask |= DBUFFERHTILEBIT_NORMAL;

6
com.unity.render-pipelines.high-definition/HDRP/Material/LayeredLit/LayeredLitData.hlsl


surfaceData.atDistance = 1000000.0;
surfaceData.transmittanceMask = 0.0;
GetNormalWS(input, V, normalTS, surfaceData.normalWS);
GetNormalWS(input, normalTS, surfaceData.normalWS);
GetNormalWS(input, V, bentNormalTS, bentNormalWS);
GetNormalWS(input, bentNormalTS, bentNormalWS);
#else // if no bent normal are available at all just keep the calculation fully
bentNormalWS = surfaceData.normalWS;
#endif

surfaceData.perceptualSmoothness = GeometricNormalFiltering(surfaceData.perceptualSmoothness, input.worldToTangent[2], _SpecularAAScreenSpaceVariance, _SpecularAAThreshold);
#endif
GetBuiltinData(input, surfaceData, alpha, bentNormalWS, depthOffset, builtinData);
GetBuiltinData(input, V, posInput, surfaceData, alpha, bentNormalWS, depthOffset, builtinData);
}
#include "../Lit/LitDataMeshModification.hlsl"

24
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs


LitClearCoat = 1 << 6
};
public enum RefractionModel
{
None = 0,
Plane = 1,
Sphere = 2
};
[GenerateHLSL]
public enum ProjectionModel
{
None = 0,
Proxy = 1,
HiZ = 2,
Linear = 3
};
[GenerateHLSL]
public enum HiZIntersectionKind
{
None,
Cell,
Depth
}
//-----------------------------------------------------------------------------
// SurfaceData
//-----------------------------------------------------------------------------

15
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs.hlsl


#define MATERIALFEATUREFLAGS_LIT_CLEAR_COAT (64)
//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+ProjectionModel: static fields
//
#define PROJECTIONMODEL_NONE (0)
#define PROJECTIONMODEL_PROXY (1)
#define PROJECTIONMODEL_HI_Z (2)
#define PROJECTIONMODEL_LINEAR (3)
//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+HiZIntersectionKind: static fields
//
#define HIZINTERSECTIONKIND_NONE (0)
#define HIZINTERSECTIONKIND_CELL (1)
#define HIZINTERSECTIONKIND_DEPTH (2)
//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+SurfaceData: static fields
//
#define DEBUGVIEW_LIT_SURFACEDATA_MATERIAL_FEATURES (1000)

64
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl


#include "HDRP/Lighting/LightDefinition.cs.hlsl"
#include "HDRP/Lighting/Reflection/VolumeProjection.hlsl"
#define SSRTID Reflection
#include "HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl"
#undef SSRTID
#include "HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.hlsl"
#include "CoreRP/ShaderLibrary/Refraction.hlsl"
#define SSRTID Refraction
#include "HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl"
#undef SSRTID
#if defined(_REFRACTION_PLANE)
#define REFRACTION_MODEL(V, posInputs, bsdfData) RefractionModelPlane(V, posInputs.positionWS, bsdfData.normalWS, bsdfData.ior, bsdfData.thickness)
#elif defined(_REFRACTION_SPHERE)

outGBuffer2.a = PackFloatInt8bit(coatMask, materialFeatureId, 8);
// RT3 - 11f:11f:10f
outGBuffer3 = float4(builtinData.bakeDiffuseLighting, 0.0);
// In deferred we encode emissive color with bakeDiffuseLighting. We don't have the room to store emissiveColor.
// It mean that any futher process that affect bakeDiffuseLighting will also affect emissiveColor, like SSAO for example.
// Also if we don't have the room to store AO, then we apply it at this time on bakeDiffuseLighting which will cause a double occlusion with SSAO
outGBuffer3 = float4(builtinData.bakeDiffuseLighting + builtinData.emissiveColor, 0.0);
#else
outGBuffer3 = float4(builtinData.bakeDiffuseLighting * surfaceData.ambientOcclusion + builtinData.emissiveColor, 0.0);
#endif
#ifdef SHADOWS_SHADOWMASK

GBufferType2 inGBuffer2 = LOAD_TEXTURE2D(_GBufferTexture2, positionSS);
// BuiltinData
builtinData.bakeDiffuseLighting = LOAD_TEXTURE2D(_GBufferTexture3, positionSS).rgb; // This also contain emissive
builtinData.bakeDiffuseLighting = LOAD_TEXTURE2D(_GBufferTexture3, positionSS).rgb; // This also contain emissive (and * AO if no lightlayers)
// Avoid to introduce a new variant for light layer as it is already long to compile
if (_EnableLightLayers)

// bake lighting function
//-----------------------------------------------------------------------------
// GetBakedDiffuseLighting function compute the bake lighting + emissive color to be store in emissive buffer (Deferred case)
// In forward it must be add to the final contribution.
// This function require the 3 structure surfaceData, builtinData, bsdfData because it may require both the engine side data, and data that will not be store inside the gbuffer.
float3 GetBakedDiffuseLighting(SurfaceData surfaceData, BuiltinData builtinData, BSDFData bsdfData, PreLightData preLightData)
// This define allow to say that we implement a ModifyBakedDiffuseLighting function to be call in PostInitBuiltinData
#define MODIFY_BAKED_DIFFUSE_LIGHTING
// This function allow to modify the content of (back) baked diffuse lighting when we gather builtinData
// This is use to apply lighting model specific code, like pre-integration, transmission etc...
// It is up to the lighting model implementer to chose if the modification are apply here or in PostEvaluateBSDF
void ModifyBakedDiffuseLighting(float3 V, PositionInputs posInput, SurfaceData surfaceData, inout BuiltinData builtinData)
#ifdef DEBUG_DISPLAY
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER)
{
// The lighting in SH or lightmap is assume to contain bounced light only (i.e no direct lighting), and is divide by PI (i.e Lambert is apply), so multiply by PI here to get back the illuminance
return builtinData.bakeDiffuseLighting * PI;
// In case of deferred, all lighting model operation are done before storage in GBuffer, as we store emissive with bakeDiffuseLighting
// To get the data we need to do the whole process - compiler should optimize everything
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS, surfaceData);
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData);
// Add GI transmission contribution to bakeDiffuseLighting, we then drop backBakeDiffuseLighting (i.e it is not used anymore, this save VGPR in forward and in deferred we can't store it anyway)
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
{
builtinData.bakeDiffuseLighting += builtinData.backBakeDiffuseLighting * bsdfData.transmittance;
#endif
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING)) // This test is static as it is done in GBuffer or forward pass, will be remove by compiler
// For SSS we need to take into account the state of diffuseColor
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING))
bsdfData.diffuseColor = GetModifiedDiffuseColorForSSS(bsdfData); // local modification of bsdfData
bsdfData.diffuseColor = GetModifiedDiffuseColorForSSS(bsdfData);
// Premultiply bake diffuse lighting information with DisneyDiffuse pre-integration
return builtinData.bakeDiffuseLighting * preLightData.diffuseFGD * surfaceData.ambientOcclusion * bsdfData.diffuseColor + builtinData.emissiveColor;
// Premultiply (back) bake diffuse lighting information with DisneyDiffuse pre-integration
builtinData.bakeDiffuseLighting *= preLightData.diffuseFGD * bsdfData.diffuseColor;
}
//-----------------------------------------------------------------------------

{
rayOriginWS = posInput.positionWS;
rayDirWS = preLightData.iblR;
mipLevel = PositivePow(preLightData.iblPerceptualRoughness, 0.8) * uint(max(_ColorPyramidScale.z - 1, 0));
mipLevel = PlanarPerceptualRoughnessToMipmapLevel(preLightData.iblPerceptualRoughness, _ColorPyramidScale.z);
invScreenWeightDistance = _SSReflectionInvScreenWeightDistance;
#ifdef DEBUG_DISPLAY
debugMode = DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFLECTION;

if (IsEnvIndexTexture2D(lightData.envIndex))
{
// Empirical remapping
iblMipLevel = PositivePow(preLightData.iblPerceptualRoughness, 0.8) * uint(max(_ColorPyramidScale.z - 1, 0));
iblMipLevel = PlanarPerceptualRoughnessToMipmapLevel(preLightData.iblPerceptualRoughness, _ColorPyramidScale.z);
}
else
#endif

float3 modifiedDiffuseColor = GetModifiedDiffuseColorForSSS(bsdfData);
// Apply the albedo to the direct diffuse lighting (only once). The indirect (baked)
// diffuse lighting has already had the albedo applied in GetBakedDiffuseLighting().
diffuseLighting = modifiedDiffuseColor * lighting.direct.diffuse + builtinData.bakeDiffuseLighting;
// diffuse lighting has already multiply the albedo in ModifyBakedDiffuseLighting().
// Note: In deferred bakeDiffuseLighting also contain emissive and in this case emissiveColor is 0
diffuseLighting = modifiedDiffuseColor * lighting.direct.diffuse + builtinData.bakeDiffuseLighting + builtinData.emissiveColor;
// If refraction is enable we use the transmittanceMask to lerp between current diffuse lighting and refraction value
// Physically speaking, transmittanceMask should be 1, but for artistic reasons, we let the value vary

45
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitBuiltinData.hlsl


void GetBuiltinData(FragInputs input, SurfaceData surfaceData, float alpha, float3 bentNormalWS, float depthOffset, out BuiltinData builtinData)
void GetBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, SurfaceData surfaceData, float alpha, float3 bentNormalWS, float depthOffset, out BuiltinData builtinData)
// Builtin Data
builtinData.opacity = alpha;
// TODO: Sample lightmap/lightprobe/volume proxy
// This should also handle projective lightmap
builtinData.bakeDiffuseLighting = SampleBakedGI(input.positionRWS, bentNormalWS, input.texCoord1, input.texCoord2);
// It is safe to call this function here as surfaceData have been filled
// We want to know if we must enable transmission on GI for SSS material, if the material have no SSS, this code will be remove by the compiler.
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData);
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_TRANSMISSION))
{
// For now simply recall the function with inverted normal, the compiler should be able to optimize the lightmap case to not resample the directional lightmap
// however it will not optimize the lightprobe case due to the proxy volume relying on dynamic if (we rely must get right of this dynamic if), not a problem for SH9, but a problem for proxy volume.
// TODO: optimize more this code.
// Add GI transmission contribution by resampling the GI for inverted vertex normal
builtinData.bakeDiffuseLighting += SampleBakedGI(input.positionRWS, -input.worldToTangent[2], input.texCoord1, input.texCoord2) * bsdfData.transmittance;
}
#ifdef SHADOWS_SHADOWMASK
float4 shadowMask = SampleShadowMask(input.positionRWS, input.texCoord1);
builtinData.shadowMask0 = shadowMask.x;
builtinData.shadowMask1 = shadowMask.y;
builtinData.shadowMask2 = shadowMask.z;
builtinData.shadowMask3 = shadowMask.w;
#else
builtinData.shadowMask0 = 0.0;
builtinData.shadowMask1 = 0.0;
builtinData.shadowMask2 = 0.0;
builtinData.shadowMask3 = 0.0;
#endif
// For back lighting we use the oposite vertex normal
InitBuiltinData(alpha, bentNormalWS, -input.worldToTangent[2], input.positionRWS, input.texCoord1, input.texCoord2, builtinData);
builtinData.emissiveColor = _EmissiveColor * lerp(float3(1.0, 1.0, 1.0), surfaceData.baseColor.rgb, _AlbedoAffectEmissive);
#ifdef _EMISSIVE_COLOR_MAP

builtinData.emissiveColor *= SAMPLE_UVMAPPING_TEXTURE2D(_EmissiveColorMap, sampler_EmissiveColorMap, emissiveMapMapping).rgb;
#endif // _EMISSIVE_COLOR_MAP
builtinData.velocity = float2(0.0, 0.0);
#else
builtinData.distortion = float2(0.0, 0.0);
builtinData.distortionBlur = 0.0;
// Use uniform directly - The float need to be cast to uint (as unity don't support to set a uint as uniform)
builtinData.renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
builtinData.depthOffset = depthOffset;
builtinData.depthOffset = depthOffset;
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
}

10
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/LitData.hlsl


// Fill SurfaceData/Builtin data function
//-------------------------------------------------------------------------------------
#include "CoreRP/ShaderLibrary/Sampling/SampleUVMapping.hlsl"
#include "../MaterialUtilities.hlsl"
#include "../Decal/DecalUtilities.hlsl"
#include "HDRP/Material/MaterialUtilities.hlsl"
#include "HDRP/Material/Decal/DecalUtilities.hlsl"
// TODO: move this function to commonLighting.hlsl once validated it work correctly
float GetSpecularOcclusionFromBentAO(float3 V, float3 bentNormalWS, SurfaceData surfaceData)

float3 bentNormalTS;
float3 bentNormalWS;
float alpha = GetSurfaceData(input, layerTexCoord, surfaceData, normalTS, bentNormalTS);
GetNormalWS(input, V, normalTS, surfaceData.normalWS);
GetNormalWS(input, normalTS, surfaceData.normalWS);
GetNormalWS(input, V, bentNormalTS, bentNormalWS);
GetNormalWS(input, bentNormalTS, bentNormalWS);
#else
bentNormalWS = surfaceData.normalWS;
#endif

#endif
// Caution: surfaceData must be fully initialize before calling GetBuiltinData
GetBuiltinData(input, surfaceData, alpha, bentNormalWS, depthOffset, builtinData);
GetBuiltinData(input, V, posInput, surfaceData, alpha, bentNormalWS, depthOffset, builtinData);
}
#include "LitDataMeshModification.hlsl"

5
com.unity.render-pipelines.high-definition/HDRP/Material/MaterialEvaluation.hlsl


void ApplyAmbientOcclusionFactor(AmbientOcclusionFactor aoFactor, inout BuiltinData builtinData, inout AggregateLighting lighting)
{
// Note: in case of deferred Lit, builtinData.bakeDiffuseLighting contain indirect diffuse + emissive,
// so Ambient occlusion is multiply by emissive which is wrong but not a big deal
// Note: in case of deferred Lit, builtinData.bakeDiffuseLighting contain indirect diffuse * surfaceData.ambientOcclusion + emissive,
// so emissive is affected by SSAO and we get a double darkening from SSAO and from AO which is incorrect but we accept the tradeoff
builtinData.bakeDiffuseLighting *= aoFactor.indirectAmbientOcclusion;
lighting.indirect.specularReflected *= aoFactor.indirectSpecularOcclusion;
lighting.direct.diffuse *= aoFactor.directAmbientOcclusion;

switch (_DebugLightingMode)
{
case DEBUGLIGHTINGMODE_LUX_METER:
// Note: We don't include emissive here (and in deferred it is correct as lux calculation of bakeDiffuseLighting don't consider emissive)
diffuseLighting = lighting.direct.diffuse + builtinData.bakeDiffuseLighting;
//Compress lighting values for color picker if enabled

66
com.unity.render-pipelines.high-definition/HDRP/Material/MaterialUtilities.hlsl


#endif
}
// For builtinData we want to allow the user to overwrite default GI in the surface shader / shader graph.
// So we perform the following order of operation:
// 1. InitBuiltinData - Init bakeDiffuseLighting and backBakeDiffuseLighting
// 2. User can overwrite these value in the surface shader / shader graph
// 3. PostInitBuiltinData - Handle debug mode + allow the current lighting model to update the data with ModifyBakedDiffuseLighting
// This method initialize BuiltinData usual values and after update of builtinData by the caller must be follow by PostInitBuiltinData
void InitBuiltinData( float alpha, float3 normalWS, float3 backNormalWS, float3 positionRWS, float2 texCoord1, float2 texCoord2,
out BuiltinData builtinData)
{
ZERO_INITIALIZE(BuiltinData, builtinData);
builtinData.opacity = alpha;
// Sample lightmap/lightprobe/volume proxy
builtinData.bakeDiffuseLighting = SampleBakedGI(positionRWS, normalWS, texCoord1, texCoord2);
// We also sample the back lighting in case we have transmission. If not use this will be optimize out by the compiler
// For now simply recall the function with inverted normal, the compiler should be able to optimize the lightmap case to not resample the directional lightmap
// however it may not optimize the lightprobe case due to the proxy volume relying on dynamic if (to verify), not a problem for SH9, but a problem for proxy volume.
// TODO: optimize more this code.
builtinData.backBakeDiffuseLighting = SampleBakedGI(positionRWS, backNormalWS, texCoord1, texCoord2);
#ifdef SHADOWS_SHADOWMASK
float4 shadowMask = SampleShadowMask(positionRWS, texCoord1);
builtinData.shadowMask0 = shadowMask.x;
builtinData.shadowMask1 = shadowMask.y;
builtinData.shadowMask2 = shadowMask.z;
builtinData.shadowMask3 = shadowMask.w;
#endif
// Use uniform directly - The float need to be cast to uint (as unity don't support to set a uint as uniform)
builtinData.renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
}
// InitBuiltinData must be call before calling PostInitBuiltinData
void PostInitBuiltinData( float3 V, inout PositionInputs posInput, SurfaceData surfaceData,
inout BuiltinData builtinData)
{
#ifdef DEBUG_DISPLAY
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER)
{
// The lighting in SH or lightmap is assume to contain bounced light only (i.e no direct lighting),
// and is divide by PI (i.e Lambert is apply), so multiply by PI here to get back the illuminance
builtinData.bakeDiffuseLighting *= PI; // don't take into account backBakeDiffuseLighting
}
else
#endif
{
// Apply control from the indirect lighting volume settings - This is apply here so we don't affect emissive
// color in case of lit deferred for example and avoid material to have to deal with it
builtinData.bakeDiffuseLighting *= _IndirectLightingMultiplier.x;
builtinData.backBakeDiffuseLighting *= _IndirectLightingMultiplier.x;
#ifdef MODIFY_BAKED_DIFFUSE_LIGHTING
ModifyBakedDiffuseLighting(V, posInput, surfaceData, builtinData);
#endif
}
}
// Flipping or mirroring a normal can be done directly on the tangent space. This has the benefit to apply to the whole process either in surface gradient or not.
// This function will modify FragInputs and this is not propagate outside of GetSurfaceAndBuiltinData(). This is ok as tangent space is not use outside of GetSurfaceAndBuiltinData().
void ApplyDoubleSidedFlipOrMirror(inout FragInputs input)

}
// This function convert the tangent space normal/tangent to world space and orthonormalize it + apply a correction of the normal if it is not pointing towards the near plane
void GetNormalWS(FragInputs input, float3 V, float3 normalTS, out float3 normalWS)
void GetNormalWS(FragInputs input, float3 normalTS, out float3 normalWS)
#ifdef SURFACE_GRADIENT
#ifdef SURFACE_GRADIENT
#else
#else
#endif
#endif
}

39
com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.hlsl


// bake lighting function
//-----------------------------------------------------------------------------
//
// GetBakedDiffuseLighting will be called from ShaderPassForward.hlsl.
//
// GetBakedDiffuseLighting function compute the bake lighting + emissive color to be store in emissive buffer (Deferred case)
// In forward it must be add to the final contribution.
// This function require the 3 structure surfaceData, builtinData, bsdfData because it may require both the engine side data, and data that will not be store inside the gbuffer.
float3 GetBakedDiffuseLighting(SurfaceData surfaceData, BuiltinData builtinData, BSDFData bsdfData, PreLightData preLightData)
// This define allow to say that we implement a ModifyBakedDiffuseLighting function to be call in PostInitBuiltinData
#define MODIFY_BAKED_DIFFUSE_LIGHTING
void ModifyBakedDiffuseLighting(float3 V, PositionInputs posInput, SurfaceData surfaceData, inout BuiltinData builtinData)
#ifdef DEBUG_DISPLAY
if (_DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER)
// To get the data we need to do the whole process - compiler should optimize everything
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(posInput.positionSS, surfaceData);
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData);
// Add GI transmission contribution to bakeDiffuseLighting, we then drop backBakeDiffuseLighting (i.e it is not used anymore, this save VGPR)
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_STACK_LIT_TRANSMISSION))
// The lighting in SH or lightmap is assume to contain bounced light only (i.e no direct lighting), and is divide by PI (i.e Lambert is apply), so multiply by PI here to get back the illuminance
return builtinData.bakeDiffuseLighting * PI;
builtinData.bakeDiffuseLighting += builtinData.backBakeDiffuseLighting * bsdfData.transmittance;
#endif
// Note bsdfData isn't modified outside of this function scope.
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_STACK_LIT_SUBSURFACE_SCATTERING)) // This test is static as it is done in GBuffer or forward pass, will be remove by compiler
// For SSS we need to take into account the state of diffuseColor
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_STACK_LIT_SUBSURFACE_SCATTERING))
// SSS Texturing mode can change albedo because diffuse maps can already contain some SSS too
bsdfData.diffuseColor = GetModifiedDiffuseColorForSSS(bsdfData); // local modification of bsdfData
bsdfData.diffuseColor = GetModifiedDiffuseColorForSSS(bsdfData);
// Premultiply bake diffuse lighting information
// Premultiply (back) bake diffuse lighting information with diffuse pre-integration
return builtinData.bakeDiffuseLighting * preLightData.diffuseFGD * preLightData.diffuseEnergy * surfaceData.ambientOcclusion * bsdfData.diffuseColor + builtinData.emissiveColor;
builtinData.bakeDiffuseLighting *= preLightData.diffuseFGD * preLightData.diffuseEnergy * bsdfData.diffuseColor;
//-----------------------------------------------------------------------------
// light transport functions

float3 modifiedDiffuseColor = GetModifiedDiffuseColorForSSS(bsdfData);
// Apply the albedo to the direct diffuse lighting (only once). The indirect (baked)
// diffuse lighting has already had the albedo applied in GetBakedDiffuseLighting().
diffuseLighting = modifiedDiffuseColor * lighting.direct.diffuse + builtinData.bakeDiffuseLighting;
// diffuse lighting has already multiply the albedo in ModifyBakedDiffuseLighting().
diffuseLighting = modifiedDiffuseColor * lighting.direct.diffuse + builtinData.bakeDiffuseLighting + builtinData.emissiveColor;
specularLighting = lighting.direct.specular + lighting.indirect.specularReflected;

46
com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLitData.hlsl


// Fill SurfaceData/Builtin data function
//-------------------------------------------------------------------------------------
#include "CoreRP/ShaderLibrary/Sampling/SampleUVMapping.hlsl"
#include "../MaterialUtilities.hlsl"
#include "HDRP/Material/MaterialUtilities.hlsl"
//-----------------------------------------------------------------------------
// Texture Mapping

// Builtin Data:
// -------------------------------------------------------------
// NEWLITTODO: for all BuiltinData, might need to just refactor and use a comon function like that
// contained in LitBuiltinData.hlsl
builtinData.opacity = alpha;
builtinData.bakeDiffuseLighting = SampleBakedGI(input.positionRWS, surfaceData.normalWS, input.texCoord1, input.texCoord2);
// It is safe to call this function here as surfaceData have been filled
// We want to know if we must enable transmission on GI for SSS material, if the material have no SSS, this code will be remove by the compiler.
BSDFData bsdfData = ConvertSurfaceDataToBSDFData(input.positionSS.xy, surfaceData);
if (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_STACK_LIT_TRANSMISSION))
{
// For now simply recall the function with inverted normal, the compiler should be able to optimize the lightmap case to not resample the directional lightmap
// however it will not optimize the lightprobe case due to the proxy volume relying on dynamic if (we rely must get right of this dynamic if), not a problem for SH9, but a problem for proxy volume.
// TODO: optimize more this code.
// Add GI transmission contribution by resampling the GI for inverted vertex normal
builtinData.bakeDiffuseLighting += SampleBakedGI(input.positionRWS, -input.worldToTangent[2], input.texCoord1, input.texCoord2) * bsdfData.transmittance;
}
// For back lighting we use the oposite vertex normal
InitBuiltinData(alpha, surfaceData.normalWS, -input.worldToTangent[2], input.positionRWS, input.texCoord1, input.texCoord2, builtinData);
// TODO:
builtinData.velocity = float2(0.0, 0.0);
#ifdef SHADOWS_SHADOWMASK
float4 shadowMask = SampleShadowMask(input.positionRWS, input.texCoord1);
builtinData.shadowMask0 = shadowMask.x;
builtinData.shadowMask1 = shadowMask.y;
builtinData.shadowMask2 = shadowMask.z;
builtinData.shadowMask3 = shadowMask.w;
#else
builtinData.shadowMask0 = 0.0;
builtinData.shadowMask1 = 0.0;
builtinData.shadowMask2 = 0.0;
builtinData.shadowMask3 = 0.0;
#endif
#else
builtinData.distortion = float2(0.0, 0.0);
builtinData.distortionBlur = 0.0;
// Use uniform directly - The float need to be cast to uint (as unity don't support to set a uint as uniform)
builtinData.renderingLayers = _EnableLightLayers ? asuint(unity_RenderingLayer.x) : DEFAULT_LIGHT_LAYERS;
builtinData.depthOffset = 0.0;
PostInitBuiltinData(V, posInput, surfaceData, builtinData);
}

18
com.unity.render-pipelines.high-definition/HDRP/Material/Unlit/UnlitData.hlsl


//-------------------------------------------------------------------------------------
// Fill SurfaceData/Builtin data function
//-------------------------------------------------------------------------------------
#include "../MaterialUtilities.hlsl"
void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
{

#endif
// Builtin Data
ZERO_INITIALIZE(BuiltinData, builtinData); // No call to InitBuiltinData as we don't have any lighting
builtinData.bakeDiffuseLighting = float3(0.0, 0.0, 0.0);
#ifdef _EMISSIVE_COLOR_MAP
builtinData.emissiveColor = SAMPLE_TEXTURE2D(_EmissiveColorMap, sampler_EmissiveColorMap, TRANSFORM_TEX(input.texCoord0, _EmissiveColorMap)).rgb * _EmissiveColor;

builtinData.velocity = float2(0.0, 0.0);
builtinData.shadowMask0 = 0.0;
builtinData.shadowMask1 = 0.0;
builtinData.shadowMask2 = 0.0;
builtinData.shadowMask3 = 0.0;
#else
builtinData.distortion = float2(0.0, 0.0);
builtinData.distortionBlur = 0.0;
builtinData.renderingLayers = 0;
builtinData.depthOffset = 0.0;
#if defined(DEBUG_DISPLAY)
if (_DebugMipMapMode != DEBUGMIPMAPMODE_NONE)

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


hdCamera.SetupGlobalStereoParams(cmd);
cmd.SetGlobalInt(HDShaderIDs._SSReflectionEnabled, hdCamera.frameSettings.enableSSR ? 1 : 0);
cmd.SetGlobalVector(HDShaderIDs._IndirectLightingMultiplier, new Vector4(VolumeManager.instance.stack.GetComponent<IndirectLightingController>().indirectDiffuseIntensity, 0, 0 , 0));
PushGlobalRTHandle(
cmd,

using (new ProfilingSample(cmd, "HDRenderPipeline::Render", CustomSamplerId.HDRenderPipelineRender.GetSampler()))
{
// Do anything we need to do upon a new frame.
m_LightLoop.NewFrame(currentFrameSettings);
// If we render a reflection view or a preview we should not display any debug information
// This need to be call before ApplyDebugDisplaySettings()
if (camera.cameraType == CameraType.Reflection || camera.cameraType == CameraType.Preview)

{
VolumeManager.instance.Update(hdCamera.volumeAnchor, hdCamera.volumeLayerMask);
}
// Do anything we need to do upon a new frame.
// The NewFrame must be after the VolumeManager update and before Resize because it uses properties set in NewFrame
m_LightLoop.NewFrame(currentFrameSettings);
Resize(hdCamera);

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

// In both forward and deferred, everything opaque should have been rendered at this point so we can safely copy the depth buffer for later processing.
CopyDepthBufferIfNeeded(cmd);
// Depth texture is now ready, bind it (Depth buffer could have been bind before if DBuffer is enable)
cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, GetDepthTexture());
RenderDepthPyramid(hdCamera, cmd, renderContext, FullScreenDebugMode.DepthPyramid);
// TODO: In the future we will render object velocity at the same time as depth prepass (we need C++ modification for this)

RenderCameraVelocity(m_CullResults, hdCamera, renderContext, cmd);
// Depth texture is now ready, bind it (Depth buffer could have been bind before if DBuffer is enable)
cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, GetDepthTexture());
// Caution: We require sun light here as some skies use the sun light to render, it means that UpdateSkyEnvironment must be called after PrepareLightsForGPU.
// TODO: Try to arrange code so we can trigger this call earlier and use async compute here to run sky convolution during other passes (once we move convolution shader to compute).

// Assign -1 in tracing model to notifiy we took the data.
// When debugging in forward, we want only the first time the pixel is drawn
data.tracingModel = (Lit.ProjectionModel)(-1);
data.tracingModel = (ScreenSpaceLighting.ProjectionModel)(-1);
m_DebugScreenSpaceTracingDataArray[0] = data;
m_DebugScreenSpaceTracingData.SetData(m_DebugScreenSpaceTracingDataArray);
}

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


public static readonly int _NumTileFtplY = Shader.PropertyToID("_NumTileFtplY");
public static readonly int _NumTileClusteredX = Shader.PropertyToID("_NumTileClusteredX");
public static readonly int _NumTileClusteredY = Shader.PropertyToID("_NumTileClusteredY");
public static readonly int _IndirectLightingMultiplier = Shader.PropertyToID("_IndirectLightingMultiplier");
public static readonly int g_isLogBaseBufferEnabled = Shader.PropertyToID("g_isLogBaseBufferEnabled");
public static readonly int g_vLayeredOffsetsBuffer = Shader.PropertyToID("g_vLayeredOffsetsBuffer");

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

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


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

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


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

3
com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassDepthOnly.hlsl


#ifdef VARYINGS_NEED_POSITION_WS
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
#else
float3 V = 0; // Avoid the division by 0
// Unused
float3 V = float3(1.0, 1.0, 1.0); // Avoid the division by 0
#endif
SurfaceData surfaceData;

3
com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassDistortion.hlsl


#ifdef VARYINGS_NEED_POSITION_WS
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
#else
float3 V = 0; // Avoid the division by 0
// Unused
float3 V = float3(1.0, 1.0, 1.0); // Avoid the division by 0
#endif
// Perform alpha testing + get distortion

4
com.unity.render-pipelines.high-definition/HDRP/ShaderPass/ShaderPassForward.hlsl


#ifdef VARYINGS_NEED_POSITION_WS
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
#else
float3 V = 0; // Avoid the division by 0
// Unused
float3 V = float3(1.0, 1.0, 1.0); // Avoid the division by 0
#endif
SurfaceData surfaceData;

float3 diffuseLighting;
float3 specularLighting;
builtinData.bakeDiffuseLighting = GetBakedDiffuseLighting(surfaceData, builtinData, bsdfData, preLightData);
LightLoop(V, posInput, preLightData, bsdfData, builtinData, featureFlags, diffuseLighting, specularLighting);
#ifdef OUTPUT_SPLIT_LIGHTING

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

正在加载...
取消
保存