浏览代码

Merge branch 'master' into sg/fix-hd-meta-code-cuplication

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

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


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

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

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


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

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

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


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

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


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

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

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


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

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


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

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

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

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

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


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

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

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


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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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


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

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

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

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

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


return normalize(lerp(N, grainNormal, anisotropy));
}
// For GGX aniso and IBL we have done an empirical (eye balled) approximation compare to the reference.
// We use a single fetch, and we stretch the normal to use based on various criteria.
// result are far away from the reference but better than nothing
// Anisotropic ratio (0->no isotropic; 1->full anisotropy in tangent direction) - positive use bitangentWS - negative use tangentWS
// Note: returned iblPerceptualRoughness shouldn't be use for sampling FGD texture in a pre-integration
void GetGGXAnisotropicModifiedNormalAndRoughness(real3 bitangentWS, real3 tangentWS, real3 N, real3 V, real anisotropy, real perceptualRoughness, out real3 iblN, out real iblPerceptualRoughness)
{
// For positive anisotropy values: tangent = highlight stretch (anisotropy) direction, bitangent = grain (brush) direction.
float3 grainDirWS = (anisotropy >= 0.0) ? bitangentWS : tangentWS;
// Reduce stretching for (perceptualRoughness < 0.2).
float stretch = abs(anisotropy) * saturate(5.0 * perceptualRoughness);
// NOTE: If we follow the theory we should use the modified normal for the different calculation implying a normal (like NdotV)
// However modified normal is just a hack. The goal is just to stretch a cubemap, no accuracy here. Let's save performance instead.
iblN = GetAnisotropicModifiedNormal(grainDirWS, N, V, stretch);
iblPerceptualRoughness = perceptualRoughness * saturate(1.2 - abs(anisotropy));
}
// Ref: "Moving Frostbite to PBR", p. 69.
real3 GetSpecularDominantDir(real3 N, real3 R, real perceptualRoughness, real NdotV)
{

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


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

7
com.unity.render-pipelines.core/CoreRP/Shadow/ShadowBase.cs


public class ShadowInitParameters
{
public const int kDefaultShadowAtlasSize = 4096;
public const int kDefaultMaxPointLightShadows = 6;
public const int kDefaultMaxSpotLightShadows = 12;
public const int kDefaultMaxDirectionalLightShadows = 1;
public int maxPointLightShadows = kDefaultMaxPointLightShadows;
public int maxSpotLightShadows = kDefaultMaxSpotLightShadows;
public int maxDirectionalLightShadows = kDefaultMaxDirectionalLightShadows;
}
// Class used to pass parameters to the shadow system on a per frame basis.

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


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

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

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


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

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


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

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


- Fixed compilation errors on Nintendo Switch (limited XRSetting support).
- Fixed apply range attenuation option on punctual light
- Fixed issue when using more than one volume mask texture with density volumes.
- Fixed an error which prevented volumetric lighting from working if no density volumes with 3D textures were present.
- Fixed issue with color temperature not take correctly into account with static lighting
- Don't display fog when diffuse lighting, specular lighting, or lux meter debug mode are enabled.
- Exposed shadow budget parameters in HDRP asset
- Add an option to generate an emissive mesh for area lights (currently rectangle light only). The mesh fits the size, intensity and color of the light.
- Add an option to the HDRP asset to increase the resolution of volumetric lighting.
- Add additional ligth unit support for punctual light (Lumens, Candela) and area lights (Lumens, Luminance)
- Change code in area light with LTC for Lit shader. Magnitude is now take from FGD texture instead of a separate texture.
- Change code in area light with LTC for Lit shader. Magnitude is now take from FGD texture instead of a separate texture
- Improve camera relative rendering: We now apply camera translation on the model matrix, so before the TransformObjectToWorld(). Note: unity_WorldToObject and unity_ObjectToWorld must never be used directly.
- Rename positionWS to positionRWS (Camera relative world position) at a lot of places (mainly in interpolator and FragInputs). In case of custom shader user will be required to update their code.
- Rename positionWS, capturePositionWS, proxyPositionWS, influencePositionWS to positionRWS, capturePositionRWS, proxyPositionRWS, influencePositionRWS (Camera relative world position) in LightDefinition struct.
- Improve the quality of trilinear filtering of density volume textures.
- Fix issue with forward opaque lit shader variant being removed by the shader preprocessor
## [2.0.4-preview]

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

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


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

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


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

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

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

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


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

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

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


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

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

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


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

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

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

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

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

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

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

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

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

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

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


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

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

21
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Volumetric/Texture3DCreationEditor.cs


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ///
/// MIT License ///
/// ///
/// Copyright (c) 2016 Rapha�l Ernaelsten (@RaphErnaelsten) ///
/// ///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), ///
/// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, ///
/// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ///
/// ///
/// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ///
/// ///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ///
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ///
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS ///
/// IN THE SOFTWARE. ///
/// ///
/// PLEASE CONSIDER CREDITING AURA IN YOUR PROJECTS. IF RELEVANT, USE THE UNMODIFIED LOGO PROVIDED IN THE "LICENSE" FOLDER. ///
/// ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using System;
using UnityEngine;
using System.Collections.Generic;

9
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Lit/LitShaderPreprocessor.cs


return true;
bool isGBufferPass = snippet.passName == "GBuffer";
bool isForwardPass = snippet.passName == "Forward";
//bool isForwardPass = snippet.passName == "Forward";
bool isDepthOnlyPass = snippet.passName == "DepthOnly";
bool isTransparentForwardPass = snippet.passName == "TransparentDepthPostpass" || snippet.passName == "TransparentBackface" || snippet.passName == "TransparentDepthPrepass";

return true;
}
if (!hdrpAsset.renderPipelineSettings.supportOnlyForward)
// TODO: add an option to say we are using only the deferred shader variant (for Lit)
//if (0)
if (isForwardPass && !inputData.shaderKeywordSet.IsEnabled(m_DebugDisplay))
return true;
//if (isForwardPass && !inputData.shaderKeywordSet.IsEnabled(m_DebugDisplay))
// return true;
}
}

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


public static GUIContent baseColorText = new GUIContent("Base Color + Opacity", "Albedo (RGB) and Opacity (A)");
public static GUIContent smoothnessMapChannelText = new GUIContent("Smoothness Source", "Smoothness texture and channel");
public static GUIContent metallicText = new GUIContent("Metallic", "Metallic scale factor");
public static GUIContent smoothnessText = new GUIContent("Smoothness", "Smoothness scale factor");
public static GUIContent smoothnessRemappingText = new GUIContent("Smoothness Remapping", "Smoothness remapping");

31
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Lit/StandardsToHDLitMaterialUpgrader.cs


// Metallic
bool hasMetallic = false;
Texture metallicMap = Texture2D.blackTexture;
Texture metallicMap = TextureCombiner.TextureFromColor(Color.black);
// Convert _Metallic value from Gamma to Linear
float metallicValue = Mathf.Pow(srcMaterial.GetFloat("_Metallic"), 2.2f);
dstMaterial.SetFloat("_Metallic", metallicValue);
hasMetallic = srcMaterial.GetTexture("_MetallicGlossMap") != null;
if (hasMetallic)
{

{
float metallicValue = Mathf.Pow(srcMaterial.GetFloat("_Metallic"), 2.2f); // Convert _Metallic value from Gamma to Linear
dstMaterial.SetFloat("_Metallic", metallicValue);
metallicMap = TextureCombiner.TextureFromColor(Color.white * metallicValue);
metallicMap = TextureCombiner.TextureFromColor(Color.white);
}
}

if (hasOcclusion) occlusionMap = TextureCombiner.GetTextureSafe(srcMaterial, "_OcclusionMap", Color.white);
dstMaterial.SetFloat("_AORemapMin", 1f - srcMaterial.GetFloat("_OcclusionStrength"));
// Detail Mask
bool hasDetailMask = srcMaterial.GetTexture("_DetailMask") != null;
Texture detailMaskMap = Texture2D.whiteTexture;

bool hasSmoothness = false;
Texture2D smoothnessMap = TextureCombiner.TextureFromColor(Color.grey);
Texture2D smoothnessMap = TextureCombiner.TextureFromColor(Color.white);
dstMaterial.SetFloat("_SmoothnessRemapMax", srcMaterial.GetFloat("_Glossiness"));
if (srcMaterial.shader.name == Standard_Rough)
{

}
else
{
smoothnessMap = TextureCombiner.TextureFromColor(Color.white * srcMaterial.GetFloat("_Glossiness"));
smoothnessMap = TextureCombiner.TextureFromColor(Color.white);
}
}

Texture2D maskMap;
TextureCombiner maskMapCombiner = new TextureCombiner(
metallicMap, 0, // R: Metallic from red
occlusionMap, 1, // G: Occlusion from green
detailMaskMap, 3, // B: Detail Mask from alpha
metallicMap, 0, // R: Metallic from red
occlusionMap, 1, // G: Occlusion from green
detailMaskMap, 3, // B: Detail Mask from alpha
dstMaterial.SetFloat("_Metallic", 1f); // Force _Metallic value to 1, to use the value stored in the mask map without modification
string maskMapPath = AssetDatabase.GetAssetPath(srcMaterial);
maskMapPath = maskMapPath.Remove(maskMapPath.Length - 4) + "_MaskMap.png";

dstMaterial.SetFloat("_AORemapMin", 1f - srcMaterial.GetFloat("_OcclusionStrength"));
// Specular Setup Specific
if (srcMaterial.shader.name == Standard_Spec)

}
Color hdrEmission = srcMaterial.GetColor("_EmissionColor");
dstMaterial.SetColor("_EmissiveColor", hdrEmission);
dstMaterial.SetColor("_EmissiveColor", (srcMaterial.GetFloat("_EmissionEnabled") != 0)?hdrEmission: Color.black);
HDEditorUtils.ResetMaterialKeywords(dstMaterial);
}

4
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/StackLit/BaseMaterialUI.cs


m_ChannelProperty = new ComboProperty(parent, propertyName + "Channel", "Channel", Enum.GetNames(typeof(Channel)), false);
m_RemapProperty = new Property(parent, constantPropertyName + "Remap", "Remapping", "Defines the range to remap/scale the values in texture", false);
m_InvertRemapProperty = new Property(parent, constantPropertyName + "RemapInverted", "Invert Remapping", "Whether the mapping values are inverted.", false);
m_RemapProperty = new Property(parent, propertyName + "Remap", "Remapping", "Defines the range to remap/scale the values in texture", false);
m_InvertRemapProperty = new Property(parent, propertyName + "RemapInverted", "Invert Remapping", "Whether the mapping values are inverted.", false);
}
public override void OnFindProperty(MaterialProperty[] props)

115
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/StackLit/StackLitUI.cs


protected const string k_IridescenceMaskMap = "_IridescenceMaskMap";
protected const string k_IridescenceMaskMapUV = "_IridescenceMaskMapUV";
// Details
protected const string k_EnableDetails = "_EnableDetails";
protected const string k_DetailMask = "_DetailMask";
protected const string k_DetailMaskMap = "_DetailMaskMap";
protected const string k_DetailMaskMapUV = "_DetailMaskMapUV";
protected const string k_DetailSmoothness = "_DetailSmoothness";
protected const string k_DetailSmoothnessScale = "_DetailSmoothnessScale";
protected const string k_DetailSmoothnessMap = "_DetailSmoothnessMap";
protected const string k_DetailSmoothnessMapUV = "_DetailSmoothnessMapUV";
protected const string k_DetailNormalMap = "_DetailNormalMap";
protected const string k_DetailNormalMapUV = "_DetailNormalMapUV";
protected const string k_DetailNormalScale = "_DetailNormalScale";
// Stencil is use to control lighting mode (regular, split lighting)
protected const string kStencilRef = "_StencilRef";
protected const string kStencilWriteMask = "_StencilWriteMask";

private readonly GroupProperty _baseMaterialProperties = null;
private readonly GroupProperty _materialProperties = null;
private Property EnableDetails;
private Property EnableDualSpecularLobe;
private Property EnableDualSpecularLobe;
private Property EnableIridescence;
private Property EnableGeometricNormalFiltering;

});
//
EnableDetails = new Property(this, k_EnableDetails, "Enable Details", "Enable Detail", true);
EnableSSS = new Property(this, k_EnableSubsurfaceScattering, "Enable Subsurface Scattering", "Enable Subsurface Scattering", true);
EnableTransmission = new Property(this, k_EnableTransmission, "Enable Transmission", "Enable Transmission", true);
EnableCoat = new Property(this, k_EnableCoat, "Enable Coat", "Enable coat layer with true vertical physically based BSDF mixing", true);

{
new GroupProperty(this, "_MaterialFeatures", "Material Features", new BaseProperty[]
{
EnableDetails,
EnableDualSpecularLobe,
EnableAnisotropy,
EnableCoat,

new TextureProperty(this, k_NormalMap, k_NormalScale, "Normal", "Normal Map", true, false, true),
new TextureProperty(this, k_AmbientOcclusionMap, k_AmbientOcclusion, "AmbientOcclusion", "AmbientOcclusion Map", false, false),
}),
new GroupProperty(this, "_Details", "Details", new BaseProperty[]
{
new TextureProperty(this, k_DetailMaskMap, "", "Detail Mask Map", "Detail Mask Map", false, false),
new TextureProperty(this, k_DetailNormalMap, k_DetailNormalScale, "Detail Normal Map", "Detail Normal Map Scale", true, false, true),
new TextureProperty(this, k_DetailSmoothnessMap, k_DetailSmoothnessScale, "Detail Smoothness", "Detail Smoothness", true, false),
}, _ => EnableDetails.BoolValue == true),
new GroupProperty(this, "_DualSpecularLobe", "Dual Specular Lobe", new BaseProperty[]
{

// TODO: Caution this can generate a lot of garbage collection call ?
string useMapPropertyName = basePropertyName + "UseMap";
string mapPropertyName = basePropertyName + "Map";
string remapPropertyName = basePropertyName + "Remap";
string invertPropertyName = basePropertyName + "RemapInverted";
string rangePropertyName = basePropertyName + "Range";
string remapPropertyName = basePropertyName + "MapRemap";
string invertPropertyName = basePropertyName + "MapRemapInverted";
string rangePropertyName = basePropertyName + "MapRange";
Vector4 rangeVector = material.GetVector(remapPropertyName);
if (material.HasProperty(invertPropertyName) && material.GetFloat(invertPropertyName) > 0.0f)
if (material.HasProperty(remapPropertyName) && material.HasProperty(rangePropertyName))
float s = rangeVector.x;
rangeVector.x = rangeVector.y;
rangeVector.y = s;
Vector4 rangeVector = material.GetVector(remapPropertyName);
if (material.HasProperty(invertPropertyName) && material.GetFloat(invertPropertyName) > 0.0f)
{
float s = rangeVector.x;
rangeVector.x = rangeVector.y;
rangeVector.y = s;
}
material.SetVector(rangePropertyName, rangeVector);
material.SetFloat(useMapPropertyName, 1.0f);
material.SetVector(rangePropertyName, rangeVector);
if (material.HasProperty(useMapPropertyName))
{
material.SetFloat(useMapPropertyName, 1.0f);
}
int channel = (int)material.GetFloat(channelPropertyName);
switch (channel)
if (material.HasProperty(channelPropertyName))
case 0:
material.SetVector(channelMaskPropertyName, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
break;
case 1:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
break;
case 2:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
break;
case 3:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
break;
int channel = (int)material.GetFloat(channelPropertyName);
switch (channel)
{
case 0:
material.SetVector(channelMaskPropertyName, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
break;
case 1:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
break;
case 2:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 0.0f, 1.0f, 0.0f));
break;
case 3:
material.SetVector(channelMaskPropertyName, new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
break;
}
material.SetFloat(useMapPropertyName, 0.0f);
material.SetVector(rangePropertyName, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
material.SetVector(channelMaskPropertyName, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
if (material.HasProperty(useMapPropertyName))
{
material.SetFloat(useMapPropertyName, 0.0f);
}
if (material.HasProperty(rangePropertyName))
{
material.SetVector(rangePropertyName, new Vector4(0.0f, 1.0f, 0.0f, 0.0f));
}
if (material.HasProperty(channelPropertyName))
{
material.SetVector(channelMaskPropertyName, new Vector4(1.0f, 0.0f, 0.0f, 0.0f));
}
}
}

//TODO see BaseLitUI.cs:SetupBaseLitKeywords (stencil etc)
SetupBaseUnlitKeywords(material);
SetupBaseUnlitMaterialPass(material);

}
}
//TODO: stencil state, displacement, wind, depthoffset, tessellation
SetupMainTexForAlphaTestGI("_BaseColorMap", "_BaseColor", material);
//TODO: disable DBUFFER

SetupTextureMaterialProperty(material, k_IridescenceThickness);
SetupTextureMaterialProperty(material, k_IridescenceMask);
SetupTextureMaterialProperty(material, k_CoatSmoothness);
// details
SetupTextureMaterialProperty(material, k_DetailMask);
SetupTextureMaterialProperty(material, k_DetailSmoothness);
// Check if we are using specific UVs.
TextureProperty.UVMapping[] uvIndices = new[]

(TextureProperty.UVMapping)material.GetFloat(k_IridescenceMaskMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_CoatSmoothnessMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_CoatNormalMapUV),
// Details
(TextureProperty.UVMapping)material.GetFloat(k_DetailMaskMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_DetailSmoothnessMapUV),
(TextureProperty.UVMapping)material.GetFloat(k_DetailNormalMapUV),
};
// Set keyword for mapping

requireTriplanar = requireTriplanar || uvIndices[i] == TextureProperty.UVMapping.Triplanar;
}
CoreUtils.SetKeyword(material, "_USE_TRIPLANAR", requireTriplanar);
bool detailsEnabled = material.HasProperty(k_EnableDetails) && material.GetFloat(k_EnableDetails) > 0.0f;
CoreUtils.SetKeyword(material, "_USE_DETAILMAP", detailsEnabled);
bool dualSpecularLobeEnabled = material.HasProperty(k_EnableDualSpecularLobe) && material.GetFloat(k_EnableDualSpecularLobe) > 0.0f;
CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_DUAL_SPECULAR_LOBE", dualSpecularLobeEnabled);

5
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/HDEditorUtils.cs


return "Packages/com.unity.render-pipelines.core/CoreRP/";
}
public static T LoadAsset<T>(string relativePath) where T : UnityEngine.Object
{
return AssetDatabase.LoadAssetAtPath<T>(GetHDRenderPipelinePath() + relativePath);
}
public static bool ResetMaterialKeywords(Material material)
{
MaterialResetter resetter;

10
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/Settings/RenderPipelineSettingsUI.cs


EditorGUILayout.PropertyField(d.supportSSR, _.GetContent("Support SSR|Enable memory use by SSR effect."));
EditorGUILayout.PropertyField(d.supportSSAO, _.GetContent("Support SSAO|Enable memory use by SSAO effect."));
EditorGUILayout.PropertyField(d.supportDBuffer, _.GetContent("Support Decal Buffer|Enable memory and variant of decal buffer."));
EditorGUILayout.PropertyField(d.supportMSAA, _.GetContent("Support Multi Sampling Anti-Aliasing|This feature doesn't work currently."));
EditorGUILayout.PropertyField(d.MSAASampleCount, _.GetContent("MSAA Sample Count|Allow to select the level of MSAA."));
// TODO: Implement MSAA - Hide for now as it doesn't work
//EditorGUILayout.PropertyField(d.supportMSAA, _.GetContent("Support Multi Sampling Anti-Aliasing|This feature doesn't work currently."));
//EditorGUILayout.PropertyField(d.MSAASampleCount, _.GetContent("MSAA Sample Count|Allow to select the level of MSAA."));
EditorGUILayout.PropertyField(d.enableUltraQualitySSS, _.GetContent("Increase SSS Sample Count|This allow better SSS quality. Warning: Slow feature, don't use for game."));
EditorGUILayout.PropertyField(d.supportVolumetric, _.GetContent("Support volumetric|Enable memory and shader variant for volumetric."));
EditorGUILayout.PropertyField(d.increaseSssSampleCount, _.GetContent("Increase SSS Sample Count|This allows for better SSS quality. Warning: high performance cost, do not enable on consoles."));
EditorGUILayout.PropertyField(d.supportVolumetrics, _.GetContent("Support volumetrics|Enable memory and shader variant for volumetric."));
EditorGUILayout.PropertyField(d.increaseResolutionOfVolumetrics, _.GetContent("Increase resolution of volumetrics|Increase the resolution of volumetric lighting buffers. Warning: high performance cost, do not enable on consoles."));
EditorGUILayout.PropertyField(d.supportRuntimeDebugDisplay, _.GetContent("Support runtime debug display|Remove all debug display shader variant only in the player. Allow faster build."));
EditorGUILayout.PropertyField(d.supportDitheringCrossFade, _.GetContent("Support dithering cross fade|Remove all dithering cross fade shader variant only in the player. Allow faster build."));

2
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/Settings/SerializedFrameSettings.cs


enableSubsurfaceScattering = root.Find((FrameSettings d) => d.enableSubsurfaceScattering);
enableTransmission = root.Find((FrameSettings d) => d.enableTransmission);
enableAtmosphericScattering = root.Find((FrameSettings d) => d.enableAtmosphericScattering);
enableVolumetric = root.Find((FrameSettings d) => d.enableVolumetric);
enableVolumetric = root.Find((FrameSettings d) => d.enableVolumetrics);
diffuseGlobalDimmer = root.Find((FrameSettings d) => d.diffuseGlobalDimmer);
specularGlobalDimmer = root.Find((FrameSettings d) => d.specularGlobalDimmer);
enableForwardRenderingOnly = root.Find((FrameSettings d) => d.enableForwardRenderingOnly);

40
com.unity.render-pipelines.high-definition/HDRP/Editor/RenderPipeline/Settings/SerializedRenderPipelineSettings.cs


public SerializedProperty supportOnlyForward;
public SerializedProperty supportMotionVectors;
public SerializedProperty supportStereo;
public SerializedProperty enableUltraQualitySSS;
public SerializedProperty supportVolumetric;
[UnityEngine.Serialization.FormerlySerializedAs("enableUltraQualitySSS")]
public SerializedProperty increaseSssSampleCount;
[UnityEngine.Serialization.FormerlySerializedAs("supportVolumetric")]
public SerializedProperty supportVolumetrics;
public SerializedProperty increaseResolutionOfVolumetrics;
public SerializedProperty supportRuntimeDebugDisplay;
public SerializedProperty supportDitheringCrossFade;

{
this.root = root;
supportShadowMask = root.Find((RenderPipelineSettings s) => s.supportShadowMask);
supportSSR = root.Find((RenderPipelineSettings s) => s.supportSSR);
supportSSAO = root.Find((RenderPipelineSettings s) => s.supportSSAO);
supportDBuffer = root.Find((RenderPipelineSettings s) => s.supportDBuffer);
supportMSAA = root.Find((RenderPipelineSettings s) => s.supportMSAA);
MSAASampleCount = root.Find((RenderPipelineSettings s) => s.msaaSampleCount);
supportSubsurfaceScattering = root.Find((RenderPipelineSettings s) => s.supportSubsurfaceScattering);
supportOnlyForward = root.Find((RenderPipelineSettings s) => s.supportOnlyForward);
supportMotionVectors = root.Find((RenderPipelineSettings s) => s.supportMotionVectors);
supportStereo = root.Find((RenderPipelineSettings s) => s.supportStereo);
enableUltraQualitySSS = root.Find((RenderPipelineSettings s) => s.enableUltraQualitySSS);
supportVolumetric = root.Find((RenderPipelineSettings s) => s.supportVolumetric);
supportRuntimeDebugDisplay = root.Find((RenderPipelineSettings s) => s.supportRuntimeDebugDisplay);
supportDitheringCrossFade = root.Find((RenderPipelineSettings s) => s.supportDitheringCrossFade);
supportShadowMask = root.Find((RenderPipelineSettings s) => s.supportShadowMask);
supportSSR = root.Find((RenderPipelineSettings s) => s.supportSSR);
supportSSAO = root.Find((RenderPipelineSettings s) => s.supportSSAO);
supportDBuffer = root.Find((RenderPipelineSettings s) => s.supportDBuffer);
supportMSAA = root.Find((RenderPipelineSettings s) => s.supportMSAA);
MSAASampleCount = root.Find((RenderPipelineSettings s) => s.msaaSampleCount);
supportSubsurfaceScattering = root.Find((RenderPipelineSettings s) => s.supportSubsurfaceScattering);
supportOnlyForward = root.Find((RenderPipelineSettings s) => s.supportOnlyForward);
supportMotionVectors = root.Find((RenderPipelineSettings s) => s.supportMotionVectors);
supportStereo = root.Find((RenderPipelineSettings s) => s.supportStereo);
increaseSssSampleCount = root.Find((RenderPipelineSettings s) => s.increaseSssSampleCount);
supportVolumetrics = root.Find((RenderPipelineSettings s) => s.supportVolumetrics);
increaseResolutionOfVolumetrics = root.Find((RenderPipelineSettings s) => s.increaseResolutionOfVolumetrics);
supportRuntimeDebugDisplay = root.Find((RenderPipelineSettings s) => s.supportRuntimeDebugDisplay);
supportDitheringCrossFade = root.Find((RenderPipelineSettings s) => s.supportDitheringCrossFade);
shadowInitParams = new SerializedShadowInitParameters(root.Find((RenderPipelineSettings s) => s.shadowInitParams));
decalSettings = new SerializedGlobalDecalSettings(root.Find((RenderPipelineSettings s) => s.decalSettings));
shadowInitParams = new SerializedShadowInitParameters(root.Find((RenderPipelineSettings s) => s.shadowInitParams));
decalSettings = new SerializedGlobalDecalSettings(root.Find((RenderPipelineSettings s) => s.decalSettings));
}
}
}

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

正在加载...
取消
保存