浏览代码

Merge branch 'master' into feature/ReflectionProbeEditor

/feature-ReflectionProbeFit
Frédéric Vauchelles 7 年前
当前提交
50a43207
共有 52 个文件被更改,包括 4400 次插入2528 次删除
  1. 999
      ImageTemplates/HDRenderPipeline/Scenes/2xxx_Lighting/2001_Dynamic_Directional.unity.png
  2. 998
      ImageTemplates/HDRenderPipeline/Scenes/2xxx_Lighting/2002_Dynamic_Mix.unity.png
  3. 999
      ImageTemplates/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters.unity.png
  4. 106
      SampleScenes/HDTest/HDRenderLoopTest.unity
  5. 43
      ScriptableRenderPipeline/Core/Editor/Volume/VolumeEditor.cs
  6. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/API/D3D11.hlsl
  7. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/API/Metal.hlsl
  8. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/API/PSSL.hlsl
  9. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/API/Vulkan.hlsl
  10. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/API/XBoxOne.hlsl
  11. 216
      ScriptableRenderPipeline/Core/ShaderLibrary/Color.hlsl
  12. 57
      ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl
  13. 25
      ScriptableRenderPipeline/Core/ShaderLibrary/Packing.hlsl
  14. 23
      ScriptableRenderPipeline/Core/ShaderLibrary/Random.hlsl
  15. 2
      ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Hammersley.hlsl
  16. 22
      ScriptableRenderPipeline/Core/Volume/Volume.cs
  17. 18
      ScriptableRenderPipeline/Core/Volume/VolumeComponent.cs
  18. 116
      ScriptableRenderPipeline/Core/Volume/VolumeManager.cs
  19. 30
      ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs
  20. 2
      ScriptableRenderPipeline/Core/package.json
  21. 10
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.Styles.cs
  22. 24
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.cs
  23. 6
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/SubsurfaceScattering/SubsurfaceScatteringSettingsEditor.Styles.cs
  24. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  25. 8
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDAdditionalLightData.cs
  26. 6
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDLightEditorUtilities.cs
  27. 10
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs
  28. 52
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
  29. 2
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.hlsl
  30. 39
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  31. 2
      ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VaryingMesh.hlsl
  32. 4
      ScriptableRenderPipeline/HDRenderPipeline/package.json
  33. 71
      ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs
  34. 4
      ScriptableRenderPipeline/LightweightPipeline/package.json
  35. 2
      ScriptableRenderPipeline/master-package.json
  36. 120
      Tests/GraphicsTests/Framework/Editor/TestFramework.cs
  37. 6
      Tests/GraphicsTests/Framework/SetupSceneForRenderPipelineTest.cs
  38. 860
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1203_Lit_Transparent.unity
  39. 4
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1210_Lit_BentNormal.unity
  40. 146
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2001_Dynamic_Directional.unity
  41. 628
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2002_Dynamic_Mix.unity
  42. 110
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters.unity
  43. 2
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters/HDRP_Default_Sky 1.asset
  44. 691
      ScriptableRenderPipeline/Core/Editor/FilterWindow.cs
  45. 11
      ScriptableRenderPipeline/Core/Editor/FilterWindow.cs.meta
  46. 137
      ScriptableRenderPipeline/Core/Editor/Volume/VolumeComponentProvider.cs
  47. 11
      ScriptableRenderPipeline/Core/Editor/Volume/VolumeComponentProvider.cs.meta
  48. 44
      ScriptableRenderPipeline/Core/Volume/VolumeStack.cs
  49. 11
      ScriptableRenderPipeline/Core/Volume/VolumeStack.cs.meta
  50. 198
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/Materials/Transparent.mat
  51. 8
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/Materials/Transparent.mat.meta
  52. 8
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2201_Env_SurfaceReactions.meta

999
ImageTemplates/HDRenderPipeline/Scenes/2xxx_Lighting/2001_Dynamic_Directional.unity.png
文件差异内容过多而无法显示
查看文件

998
ImageTemplates/HDRenderPipeline/Scenes/2xxx_Lighting/2002_Dynamic_Mix.unity.png
文件差异内容过多而无法显示
查看文件

999
ImageTemplates/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters.unity.png
文件差异内容过多而无法显示
查看文件

106
SampleScenes/HDTest/HDRenderLoopTest.unity


--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3

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

m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_UseShadowmask: 1
m_UseShadowmask: 0
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 16
shapeWidth: 0
shapeWidth: 16
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_IsActive: 1
--- !u!114 &827169274
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 827169273}

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 16
shapeWidth: 2
shapeWidth: 16
shapeHeight: 2
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_GameObject: {fileID: 827169273}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 12

serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_AreaSize: {x: 16, y: 2}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0

m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!114 &827169277
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 827169273}

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 1
shapeLength: 4
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 1
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_IsActive: 1
--- !u!114 &1640077384
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1640077383}

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 4
shapeWidth: 2
shapeWidth: 4
shapeHeight: 2
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_AreaSize: {x: 4, y: 2}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0

m_LocalEulerAnglesHint: {x: 0, y: 180, z: 90.00001}
--- !u!114 &1640077387
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1640077383}

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 4
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

43
ScriptableRenderPipeline/Core/Editor/Volume/VolumeEditor.cs


actualTarget.isDirty = false;
}
using (var scope = new EditorGUILayout.VerticalScope())
using (var vscope = new EditorGUILayout.VerticalScope())
{
EditorGUILayout.PropertyField(m_IsGlobal);

if (m_Editors.Count > 0)
CoreEditorUtils.DrawSplitter();
else
EditorGUILayout.HelpBox("No override set on this volume.", MessageType.Info);
EditorGUILayout.HelpBox("No override set on this volume. Drop a component here or use the Add button.", MessageType.Info);
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.FlexibleSpace();
EditorGUILayout.Space();
//if (GUILayout.Button(CoreEditorUtils.GetContent("Add Component"), GUILayout.Width(230f), GUILayout.Height(24f)))
//{
using (var hscope = new EditorGUILayout.HorizontalScope())
{
if (GUILayout.Button(CoreEditorUtils.GetContent("Add component overrides..."), EditorStyles.miniButton))
{
var r = hscope.rect;
var pos = new Vector2(r.x + r.width / 2f, r.yMax + 18f);
FilterWindow.Show(pos, new VolumeComponentProvider(actualTarget, this));
}
}
//}
GUILayout.FlexibleSpace();
}
EditorGUILayout.Space();
if (IsDragValid(scope.rect, e.mousePosition))
if (IsDragValid(vscope.rect, e.mousePosition))
{
DragAndDrop.visualMode = DragAndDropVisualMode.Link;
e.Use();

}
else if (e.type == EventType.DragPerform)
{
if (IsDragValid(scope.rect, e.mousePosition))
if (IsDragValid(vscope.rect, e.mousePosition))
{
DragAndDrop.AcceptDrag();

}
// index is only used when we need to re-create a component in a specific spot (e.g. reset)
void CreateEditor(VolumeComponent settings, SerializedProperty property, int index = -1)
void CreateEditor(VolumeComponent settings, SerializedProperty property, int index = -1, bool forceOpen = false)
{
var settingsType = settings.GetType();
Type editorType;

var editor = (VolumeComponentEditor)Activator.CreateInstance(editorType);
editor.Init(settings, this);
editor.baseProperty = property.Copy();
if (forceOpen)
editor.baseProperty.isExpanded = true;
if (index < 0)
m_Editors.Add(editor);

void AddComponent(Type type)
internal void AddComponent(Type type)
{
serializedObject.Update();

effectProp.objectReferenceValue = component;
// Create & store the internal editor object for this effect
CreateEditor(component, effectProp);
CreateEditor(component, effectProp, forceOpen: true);
void RemoveComponent(int id)
internal void RemoveComponent(int id)
{
// Huh. Hack to keep foldout state on the next element...
bool nextFoldoutState = false;

// Reset is done by deleting and removing the object from the list and adding a new one in
// the same spot as it was before
void ResetComponent(Type type, int id)
internal void ResetComponent(Type type, int id)
{
// Remove from the cached editors list
m_Editors[id].OnDisable();

Undo.DestroyObjectImmediate(prevSettings);
}
void MoveComponent(int id, int offset)
internal void MoveComponent(int id, int offset)
{
// Move components
serializedObject.Update();

4
ScriptableRenderPipeline/Core/ShaderLibrary/API/D3D11.hlsl


#define UNITY_UV_STARTS_AT_TOP 1
#define UNITY_REVERSED_Z 1
#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

4
ScriptableRenderPipeline/Core/ShaderLibrary/API/Metal.hlsl


#define UNITY_UV_STARTS_AT_TOP 1
#define UNITY_REVERSED_Z 1
#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

5
ScriptableRenderPipeline/Core/ShaderLibrary/API/PSSL.hlsl


// This file assume SHADER_API_D3D11 is defined
#define INTRINSIC_BITFIELD_EXTRACT
#define BitFieldExtract __v_bfe_u32
#define INTRINSIC_BITFIELD_EXTRACT_SIGN_EXTEND
#define BitFieldExtractSignExtend __v_bfe_i32
#define INTRINSIC_WAVEREADFIRSTLANE
#define WaveReadFirstLane ReadFirstLane
#define INTRINSIC_MAD24

#define UNITY_NEAR_CLIP_VALUE (1.0)
// This value will not go through any matrix projection convertion
#define UNITY_RAW_FAR_CLIP_VALUE (0.0)
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

5
ScriptableRenderPipeline/Core/ShaderLibrary/API/Vulkan.hlsl


// This file assume SHADER_API_VULKAN is defined
// TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed.
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

5
ScriptableRenderPipeline/Core/ShaderLibrary/API/XBoxOne.hlsl


// This file assume SHADER_API_D3D11 is defined
// TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed.
// This value will not go through any matrix projection convertion
// This value will not go through any matrix projection conversion
#define FRONT_FACE_SEMATIC SV_IsFrontFace
#define FRONT_FACE_SEMANTIC SV_IsFrontFace
#define FRONT_FACE_TYPE bool
#define IS_FRONT_VFACE(VAL, FRONT, BACK) ((VAL) ? (FRONT) : (BACK))

216
ScriptableRenderPipeline/Core/ShaderLibrary/Color.hlsl


return dot(linearRgb, float3(0.2126729f, 0.7151522f, 0.0721750f));
}
float Luminance(float4 linearRgba)
{
return Luminance(linearRgba.rgb);
}
// This function take a rgb color (best is to provide color in sRGB space)
// and return a YCoCg color in [0..1] space for 8bit (An offset is apply in the function)
// Ref: http://www.nvidia.com/object/real-time-ycocg-dxt-compression.html

float W = w.x + w.y + w.z + w.w;
// handle the special case where all the weights are zero.
return (W == 0.0) ? a0.y : (w.x * a0.y + w.y* a1.y + w.z* a2.y + w.w * a3.y) / W;
}
// Hue, Saturation, Value
// Ranges:
// Hue [0.0, 1.0]
// Sat [0.0, 1.0]
// Lum [0.0, HALF_MAX]
float3 RgbToHsv(float3 c)
{
const float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
const float e = 1.0e-4;
return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
float3 HsvToRgb(float3 c)
{
const float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
// SMPTE ST.2084 (PQ) transfer functions
// 1.0 = 100nits, 100.0 = 10knits
#define DEFAULT_MAX_PQ 100.0
struct ParamsPQ
{
float N, M;
float C1, C2, C3;
};
static const ParamsPQ PQ =
{
2610.0 / 4096.0 / 4.0, // N
2523.0 / 4096.0 * 128.0, // M
3424.0 / 4096.0, // C1
2413.0 / 4096.0 * 32.0, // C2
2392.0 / 4096.0 * 32.0, // C3
};
float3 LinearToPQ(float3 x, float maxPQValue)
{
x = PositivePow(x / maxPQValue, PQ.N);
float3 nd = (PQ.C1 + PQ.C2 * x) / (1.0 + PQ.C3 * x);
return PositivePow(nd, PQ.M);
}
float3 LinearToPQ(float3 x)
{
return LinearToPQ(x, DEFAULT_MAX_PQ);
}
float3 PQToLinear(float3 x, float maxPQValue)
{
x = PositivePow(x, rcp(PQ.M));
float3 nd = max(x - PQ.C1, 0.0) / (PQ.C2 - (PQ.C3 * x));
return PositivePow(nd, rcp(PQ.N)) * maxPQValue;
}
float3 PQToLinear(float3 x)
{
return PQToLinear(x, DEFAULT_MAX_PQ);
}
// Alexa LogC converters (El 1000)
// See http://www.vocas.nl/webfm_send/964
// Max range is ~58.85666
// Set to 1 to use more precise but more expensive log/linear conversions. I haven't found a proper
// use case for the high precision version yet so I'm leaving this to 0.
#define USE_PRECISE_LOGC 0
struct ParamsLogC
{
float cut;
float a, b, c, d, e, f;
};
static const ParamsLogC LogC =
{
0.011361, // cut
5.555556, // a
0.047996, // b
0.244161, // c
0.386036, // d
5.301883, // e
0.092819 // f
};
float LinearToLogC_Precise(half x)
{
float o;
if (x > LogC.cut)
o = LogC.c * log10(LogC.a * x + LogC.b) + LogC.d;
else
o = LogC.e * x + LogC.f;
return o;
}
float3 LinearToLogC(float3 x)
{
#if USE_PRECISE_LOGC
return float3(
LinearToLogC_Precise(x.x),
LinearToLogC_Precise(x.y),
LinearToLogC_Precise(x.z)
);
#else
return LogC.c * log10(LogC.a * x + LogC.b) + LogC.d;
#endif
}
float LogCToLinear_Precise(float x)
{
float o;
if (x > LogC.e * LogC.cut + LogC.f)
o = (pow(10.0, (x - LogC.d) / LogC.c) - LogC.b) / LogC.a;
else
o = (x - LogC.f) / LogC.e;
return o;
}
float3 LogCToLinear(float3 x)
{
#if USE_PRECISE_LOGC
return float3(
LogCToLinear_Precise(x.x),
LogCToLinear_Precise(x.y),
LogCToLinear_Precise(x.z)
);
#else
return (pow(10.0, (x - LogC.d) / LogC.c) - LogC.b) / LogC.a;
#endif
}
//-----------------------------------------------------------------------------
// Utilities
//-----------------------------------------------------------------------------
// Fast reversible tonemapper
// http://gpuopen.com/optimized-reversible-tonemapper-for-resolve/
float3 FastTonemap(float3 c)
{
return c * rcp(Max3(c.r, c.g, c.b) + 1.0);
}
float4 FastTonemap(float4 c)
{
return float4(FastTonemap(c.rgb), c.a);
}
float3 FastTonemap(float3 c, float w)
{
return c * (w * rcp(Max3(c.r, c.g, c.b) + 1.0));
}
float4 FastTonemap(float4 c, float w)
{
return float4(FastTonemap(c.rgb, w), c.a);
}
float3 FastTonemapInvert(float3 c)
{
return c * rcp(1.0 - Max3(c.r, c.g, c.b));
}
float4 FastTonemapInvert(float4 c)
{
return float4(FastTonemapInvert(c.rgb), c.a);
}
// 3D LUT grading
// scaleOffset = (1 / lut_size, lut_size - 1)
float3 ApplyLut3D(TEXTURE3D_ARGS(tex, samplerTex), float3 uvw, float2 scaleOffset)
{
float shift = floor(uvw.z);
uvw.xy = uvw.xy * scaleOffset.y * scaleOffset.xx + scaleOffset.xx * 0.5;
uvw.x += shift * scaleOffset.x;
return SAMPLE_TEXTURE3D(tex, samplerTex, uvw).rgb;
}
// 2D LUT grading
// scaleOffset = (1 / lut_width, 1 / lut_height, lut_height - 1)
float3 ApplyLut2D(TEXTURE2D_ARGS(tex, samplerTex), float3 uvw, float3 scaleOffset)
{
// Strip format where `height = sqrt(width)`
uvw.z *= scaleOffset.z;
float shift = floor(uvw.z);
uvw.xy = uvw.xy * scaleOffset.z * scaleOffset.xy + scaleOffset.xy * 0.5;
uvw.x += shift * scaleOffset.y;
uvw.xyz = lerp(
SAMPLE_TEXTURE2D(tex, samplerTex, uvw.xy).rgb,
SAMPLE_TEXTURE2D(tex, samplerTex, uvw.xy + float2(scaleOffset.y, 0.0)).rgb,
uvw.z - shift
);
return uvw;
}
// Returns the default value for a given position on a 2D strip-format color lookup table
// params = (lut_height, 0.5 / lut_width, 0.5 / lut_height, lut_height / lut_height - 1)
float3 GetLutStripValue(float2 uv, float4 params)
{
uv -= params.yz;
float3 color;
color.r = frac(uv.x * params.x);
color.b = uv.x - color.r / params.x;
color.g = uv.y;
return color * params.w;
}
#endif // UNITY_COLOR_INCLUDED

57
ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl


// Unsigned integer bit field extraction.
// Note that the intrinsic itself generates a vector instruction.
// Wrap this function with WaveReadFirstLane() to get scalar output.
uint BitFieldExtract(uint data, uint numBits, uint offset)
uint BitFieldExtract(uint data, uint offset, uint numBits)
uint mask = UINT_MAX >> (32u - numBits);
uint mask = (1u << numBits) - 1u;
#ifndef INTRINSIC_BITFIELD_EXTRACT_SIGN_EXTEND
// Integer bit field extraction with sign extension.
// Note that the intrinsic itself generates a vector instruction.
// Wrap this function with WaveReadFirstLane() to get scalar output.
int BitFieldExtractSignExtend(int data, uint offset, uint numBits)
{
int shifted = data >> offset; // Sign-extending (arithmetic) shift
int signBit = shifted & (1u << (numBits - 1u));
uint mask = (1u << numBits) - 1u;
return -signBit | (shifted & mask); // Use 2-complement for negation to replicate the sign bit
}
#endif // INTRINSIC_BITFIELD_EXTRACT_SIGN_EXTEND
return BitFieldExtract(data, 1u, offset) != 0;
return BitFieldExtract(data, offset, 1u) != 0;
}
void SetBit(inout uint data, uint offset)

return (x < 1.0) ? poly : HALF_PI - poly;
}
#if (SHADER_TARGET >= 45)
uint FastLog2(uint x)
{
return firstbithigh(x) - 1u;
}
#endif
// 4 VGPR, 16 FR (12 FR, 1 QR), 2 scalar
// input [-infinity, infinity] and output [-PI/2, PI/2]
float FastATan(float x)

}
// Same as smoothstep except it assume 0, 1 interval for x
float Smoothstep01(float x)
{
return x * x * (3.0 - (2.0 * x));
}
static const float3x3 k_identity3x3 = {1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0};
static const float4x4 k_identity4x4 = {1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0};
// Using pow often result to a warning like this
// "pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them"
// PositivePow remove this warning when you know the value is positive and avoid inf/NAN.

float3 Orthonormalize(float3 tangent, float3 normal)
{
return normalize(tangent - dot(tangent, normal) * normal);
}
// Same as smoothstep except it assume 0, 1 interval for x
float Smoothstep01(float x)
{
return x * x * (3.0 - (2.0 * x));
}
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// Space transformations
// ----------------------------------------------------------------------------
static const float3x3 k_identity3x3 = {1, 0, 0,
0, 1, 0,
0, 0, 1};
static const float4x4 k_identity4x4 = {1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1};
// Use case examples:
// (position = positionCS) => (clipSpaceTransform = use default)

25
ScriptableRenderPipeline/Core/ShaderLibrary/Packing.hlsl


// Packs an integer stored using at most 'numBits' into a [0..1] float.
float PackInt(uint i, uint numBits)
{
uint maxInt = UINT_MAX >> (32u - numBits);
uint maxInt = (1u << numBits) - 1u;
return saturate(i * rcp(maxInt));
}

uint maxInt = UINT_MAX >> (32u - numBits);
uint maxInt = (1u << numBits) - 1u;
return (uint)(f * maxInt + 0.5); // Round instead of truncating
}

// Packs 8 lowermost bits of a [0..65535] integer into a [0..1] float.
float PackShortLo(uint i)
{
uint lo = BitFieldExtract(i, 8u, 0u);
uint lo = BitFieldExtract(i, 0u, 8u);
return PackInt(lo, 8);
}

//-----------------------------------------------------------------------------
// src must be between 0.0 and 1.0
uint PackFloatToUInt(float src, uint numBits, uint offset)
uint PackFloatToUInt(float src, uint offset, uint numBits)
float UnpackUIntToFloat(uint src, uint numBits, uint offset)
float UnpackUIntToFloat(uint src, uint offset, uint numBits)
uint maxInt = UINT_MAX >> (32u - numBits);
return float(BitFieldExtract(src, numBits, offset)) * rcp(maxInt);
uint maxInt = (1u << numBits) - 1u;
return float(BitFieldExtract(src, offset, numBits)) * rcp(maxInt);
return (PackFloatToUInt(rgba.x, 10, 0) | PackFloatToUInt(rgba.y, 10, 10) | PackFloatToUInt(rgba.z, 10, 20) | PackFloatToUInt(rgba.w, 2, 30));
return (PackFloatToUInt(rgba.x, 0, 10) |
PackFloatToUInt(rgba.y, 10, 10) |
PackFloatToUInt(rgba.z, 20, 10) |
PackFloatToUInt(rgba.w, 30, 2));
ouput.x = UnpackUIntToFloat(rgba, 10, 0);
ouput.x = UnpackUIntToFloat(rgba, 0, 10);
ouput.z = UnpackUIntToFloat(rgba, 10, 20);
ouput.w = UnpackUIntToFloat(rgba, 2, 30);
ouput.z = UnpackUIntToFloat(rgba, 20, 10);
ouput.w = UnpackUIntToFloat(rgba, 30, 2);
return ouput;
}

23
ScriptableRenderPipeline/Core/ShaderLibrary/Random.hlsl


return JenkinsHash(v.x ^ JenkinsHash(v.y) ^ JenkinsHash(v.z) ^ JenkinsHash(v.w));
}
// Construct a float with half-open range [0:1] using low 23 bits.
// Construct a float with half-open range [0, 1) using low 23 bits.
float ConstructFloat(uint m) {
const uint ieeeMantissa = 0x007FFFFFu; // Binary FP32 mantissa bitmask
const uint ieeeOne = 0x3F800000u; // 1.0 in FP32 IEEE
float ConstructFloat(int m) {
const int ieeeMantissa = 0x007FFFFF; // Binary FP32 mantissa bitmask
const int ieeeOne = 0x3F800000; // 1.0 in FP32 IEEE
m &= ieeeMantissa; // Keep only mantissa bits (fractional part)
m |= ieeeOne; // Add fractional part to 1.0
m &= ieeeMantissa; // Keep only mantissa bits (fractional part)
m |= ieeeOne; // Add fractional part to 1.0
float f = asfloat(m); // Range [1, 2)
return f - 1; // Range [0, 1)
}
float f = asfloat(m); // Range [1:2]
return f - 1; // Range [0:1]
float ConstructFloat(uint m)
{
return ConstructFloat(asint(m));
// Pseudo-random value in half-open range [0:1]. The distribution is reasonably uniform.
// Pseudo-random value in half-open range [0, 1). The distribution is reasonably uniform.
// Ref: https://stackoverflow.com/a/17479300
float GenerateHashedRandomFloat(uint x)
{

2
ScriptableRenderPipeline/Core/ShaderLibrary/Sampling/Hammersley.hlsl


// Ref: http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
uint ReverseBits32(uint bits)
{
#if 1 // Shader model 5
#if (SHADER_TARGET >= 45)
return reversebits(bits);
#else
bits = (bits << 16) | (bits >> 16);

22
ScriptableRenderPipeline/Core/Volume/Volume.cs


public T Add<T>(bool overrides = false)
where T : VolumeComponent
{
if (Has<T>())
return (T)Add(typeof(T), overrides);
}
public VolumeComponent Add(Type type, bool overrides = false)
{
if (Has(type))
var component = ScriptableObject.CreateInstance<T>();
var component = (VolumeComponent)ScriptableObject.CreateInstance(type);
component.SetAllOverridesTo(overrides);
components.Add(component);
isDirty = true;

public void Remove<T>()
where T : VolumeComponent
{
Remove(typeof(T));
}
public void Remove(Type type)
{
var type = typeof(T);
for (int i = 0; i < components.Count; i++)
{

public bool Has<T>()
where T : VolumeComponent
{
var type = typeof(T);
return Has(typeof(T));
}
public bool Has(Type type)
{
foreach (var component in components)
{
if (component.GetType() == type)

var scale = transform.localScale;
var invScale = new Vector3(1f / scale.x, 1f / scale.y, 1f / scale.z);
Gizmos.matrix = Matrix4x4.TRS(transform.position, transform.rotation, scale);
Gizmos.color = new Color(0f, 1f, 0.1f, 0.6f);
Gizmos.color = new Color(0f, 1f, 0.1f, 0.35f);
// Draw a separate gizmo for each collider
foreach (var collider in colliders)

18
ScriptableRenderPipeline/Core/Volume/VolumeComponent.cs


namespace UnityEngine.Experimental.Rendering
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class VolumeComponentMenu : Attribute
{
public readonly string menu;
// TODO: Add support for component icons
public VolumeComponentMenu(string menu)
{
this.menu = menu;
}
}
[Serializable]
public class VolumeComponent : ScriptableObject
{

internal ReadOnlyCollection<VolumeParameter> parameters { get; private set; }
void OnEnable()
protected virtual void OnEnable()
{
// Automatically grab all fields of type VolumeParameter for this instance
parameters = this.GetType()

.Select(t => (VolumeParameter)t.GetValue(this))
.ToList()
.AsReadOnly();
}
protected virtual void OnDisable()
{
}
public void SetAllOverridesTo(bool state)

116
ScriptableRenderPipeline/Core/Volume/VolumeManager.cs


}
//<<<
// Internal stack
public VolumeStack stack { get; private set; }
// Current list of tracked component types
public IEnumerable<Type> baseComponentTypes { get; private set; }
// Max amount of layers available in Unity
const int k_MaxLayerCount = 32;

// Keep track of sorting states for layer masks
readonly Dictionary<LayerMask, bool> m_SortNeeded;
// Internal state of all component types
readonly Dictionary<Type, VolumeComponent> m_Components;
// Internal list of default state for each component type - this is used to reset component
// states on update instead of having to implement a Reset method on all components (which
// would be error-prone)

readonly List<Collider> m_TempColliders;
// In the editor, when entering play-mode, it will call the constructor and OnEditorReload()
// which in turn will call ReloadBaseTypes() twice, so we need to keep track of the reloads
// to avoid wasting any more CPU than required
static bool s_StopReloads = false;
VolumeManager()
{
m_SortedVolumes = new Dictionary<LayerMask, List<Volume>>();

m_Components = new Dictionary<Type, VolumeComponent>();
}
#if UNITY_EDITOR
// Called every time Unity recompiles scripts in the editor. We need this to keep track of
// any new custom component the user might add to the project.
[UnityEditor.Callbacks.DidReloadScripts]
static void OnEditorReload()
{
if (!s_StopReloads)
instance.ReloadBaseTypes();
s_StopReloads = false;
stack = CreateStack();
#endif
// Clean component map & default states
foreach (var component in m_Components)
CoreUtils.Destroy(component.Value);
foreach (var component in m_ComponentsDefaultState)
CoreUtils.Destroy(component);
m_Components.Clear();
m_ComponentsDefaultState.Clear();
// Rebuild it from scratch
var types = CoreUtils.GetAllAssemblyTypes()
// Grab all the component types we can find
baseComponentTypes = CoreUtils.GetAllAssemblyTypes()
foreach (var type in types)
// Keep an instance of each type to be used in a virtual lowest priority global volume
// so that we have a default state to fallback to when exiting volumes
foreach (var type in baseComponentTypes)
// We need two instances, one for global state tracking and another one to keep a
// default state that will act as the lowest priority global volume (so that we have
// a state to fallback to when exiting volumes)
m_Components.Add(type, inst);
inst = (VolumeComponent)ScriptableObject.CreateInstance(type);
s_StopReloads = true;
public T GetComponent<T>()
where T : VolumeComponent
{
var comp = GetComponent(typeof(T));
return (T)comp;
}
public VolumeComponent GetComponent(Type type)
public VolumeStack CreateStack()
VolumeComponent comp;
m_Components.TryGetValue(type, out comp);
return comp;
return new VolumeStack(baseComponentTypes);
}
public void Register(Volume volume, int layer)

// Look for existing cached layer masks and add it there if needed
foreach (var kvp in m_SortedVolumes)
{
var mask = kvp.Key;
if ((mask & (1 << layer)) != 0)
if ((kvp.Key & (1 << layer)) != 0)
kvp.Value.Add(volume);
}

foreach (var kvp in m_SortedVolumes)
{
var mask = kvp.Key;
if ((mask & (1 << layer)) == 0)
if ((kvp.Key & (1 << layer)) == 0)
continue;
kvp.Value.Remove(volume);

public bool IsComponentActiveInMask<T>(LayerMask layerMask)
where T : VolumeComponent
{
int mask = layerMask.value;
foreach (var kvp in m_SortedVolumes)
{
if ((kvp.Key & mask) == 0)
continue;
foreach (var volume in kvp.Value)
{
T component;
if (volume.TryGet(out component) && component.active)
return true;
}
}
return false;
}
internal void SetLayerDirty(int layer)
{
Assert.IsTrue(layer >= 0 && layer <= k_MaxLayerCount, "Invalid layer bit");

}
// Go through all listed components and lerp overriden values in the global state
void OverrideData(List<VolumeComponent> components, float interpFactor)
void OverrideData(VolumeStack stack, List<VolumeComponent> components, float interpFactor)
{
foreach (var component in components)
{

var target = GetComponent(component.GetType());
var target = stack.GetComponent(component.GetType());
int count = component.parameters.Count;
for (int i = 0; i < count; i++)

}
// Faster version of OverrideData to force replace values in the global state
void ReplaceData(List<VolumeComponent> components)
void ReplaceData(VolumeStack stack, List<VolumeComponent> components)
var target = GetComponent(component.GetType());
var target = stack.GetComponent(component.GetType());
int count = component.parameters.Count;
for (int i = 0; i < count; i++)

// in the update loop before rendering
public void Update(Transform trigger, LayerMask layerMask)
{
Update(stack, trigger, layerMask);
}
// Update a specific stack - can be used to manage your own stack and store it for later use
public void Update(VolumeStack stack, Transform trigger, LayerMask layerMask)
{
ReplaceData(m_ComponentsDefaultState);
ReplaceData(stack, m_ComponentsDefaultState);
bool onlyGlobal = trigger == null;
var triggerPos = onlyGlobal ? Vector3.zero : trigger.position;

// Global volumes always have influence
if (volume.isGlobal)
{
OverrideData(volume.components, Mathf.Clamp01(volume.weight));
OverrideData(stack, volume.components, Mathf.Clamp01(volume.weight));
continue;
}

interpFactor = 1f - (closestDistanceSqr / blendDistSqr);
// No need to clamp01 the interpolation factor as it'll always be in [0;1[ range
OverrideData(volume.components, interpFactor * Mathf.Clamp01(volume.weight));
OverrideData(stack, volume.components, interpFactor * Mathf.Clamp01(volume.weight));
}
}

30
ScriptableRenderPipeline/Core/Volume/VolumeParameter.cs


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;

}
[Serializable, DebuggerDisplay(k_DebuggerDisplay)]
public class VolumeParameter<T> : VolumeParameter
public class VolumeParameter<T> : VolumeParameter, IEquatable<VolumeParameter<T>>
{
[SerializeField]
protected T m_Value;

public static bool operator ==(VolumeParameter<T> lhs, T rhs)
{
return lhs.value != null && lhs.value.Equals(rhs);
return lhs != null && lhs.value != null && lhs.value.Equals(rhs);
}
public bool Equals(VolumeParameter<T> other)
{
if (ReferenceEquals(null, other))
return false;
if (ReferenceEquals(this, other))
return true;
return EqualityComparer<T>.Default.Equals(m_Value, other.m_Value);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
return false;
if (ReferenceEquals(this, obj))
return true;
if (obj.GetType() != GetType())
return false;
return Equals((VolumeParameter<T>)obj);
}
//

2
ScriptableRenderPipeline/Core/package.json


{
"name": "com.unity.render-pipelines.core",
"description": "Core library for Unity render pipelines.",
"version": "0.1.20",
"version": "0.1.21",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.7"

10
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.Styles.cs


public readonly GUIContent fadeDistance = new GUIContent("Fade Distance", "The distance at which the light will smoothly fade before being culled to minimize popping.");
public readonly GUIContent spotInnerPercent = new GUIContent("Inner Percent", "Controls size of the angular attenuation in percent of the base angle of the Spot light's cone.");
public readonly GUIContent spotLightShape = new GUIContent("Shape", "The shape use for the spotlight. Has an impact on the cookie transformation and light angular attenuation.");
public readonly GUIContent shapeLengthLine = new GUIContent("Length", "Length of the line light");
public readonly GUIContent shapeLengthRect = new GUIContent("Size X", "SizeX of the rectangle light");
public readonly GUIContent shapeWidthRect = new GUIContent("Size Y", "SizeY of the rectangle light");
public readonly GUIContent shapeWidthLine = new GUIContent("Length", "Length of the line light");
public readonly GUIContent shapeWidthRect = new GUIContent("Size X", "SizeX of the rectangle light");
public readonly GUIContent shapeHeightRect = new GUIContent("Size Y", "SizeY of the rectangle light");
public readonly GUIContent shapeLengthBox = new GUIContent("Size X", "");
public readonly GUIContent shapeWidthBox = new GUIContent("Size Y", "");
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 shape = new GUIContent("Type", "Specifies the current type of light. Possible types are Directional, Spot, Point, Rectangle and Line lights.");

24
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.cs


public SerializedProperty affectSpecular;
public SerializedProperty lightTypeExtent;
public SerializedProperty spotLightShape;
public SerializedProperty shapeLength;
public SerializedProperty shapeHeight;
public SerializedProperty aspectRatio;
public SerializedProperty shapeRadius;
public SerializedProperty maxSmoothness;

affectSpecular = o.Find(x => x.affectSpecular),
lightTypeExtent = o.Find(x => x.lightTypeExtent),
spotLightShape = o.Find(x => x.spotLightShape),
shapeLength = o.Find(x => x.shapeLength),
shapeHeight = o.Find(x => x.shapeHeight),
aspectRatio = o.Find(x => x.aspectRatio),
shapeRadius = o.Find(x => x.shapeRadius),
maxSmoothness = o.Find(x => x.maxSmoothness),

{
m_LightShape = (LightShape)EditorGUILayout.Popup(s_Styles.shape, (int)m_LightShape, s_Styles.shapeNames);
if (m_LightShape != LightShape.Directional)
settings.DrawRange(false);
// LightShape is HD specific, it need to drive LightType from the original LightType
// when it make sense, so the GI is still in sync with the light shape
switch (m_LightShape)

}
else if (spotLightShape == SpotLightShape.Box)
{
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeLength, s_Styles.shapeLengthBox);
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeHeight, s_Styles.shapeHeightBox);
}
EditorGUILayout.PropertyField(m_AdditionalLightData.maxSmoothness, s_Styles.maxSmoothness);
break;

//m_BaseData.type.enumValueIndex = (int)LightType.Area;
settings.lightType.enumValueIndex = (int)LightType.Point;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Rectangle;
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeLength, s_Styles.shapeLengthRect);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeLength.floatValue;
settings.areaSizeY.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeHeight, s_Styles.shapeHeightRect);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = m_AdditionalLightData.shapeHeight.floatValue;
settings.shadowsType.enumValueIndex = (int)LightShadows.None;
break;

settings.lightType.enumValueIndex = (int)LightType.Point;
m_AdditionalLightData.lightTypeExtent.enumValueIndex = (int)LightTypeExtent.Line;
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeLength, s_Styles.shapeLengthLine);
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeWidth, s_Styles.shapeWidthLine);
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeLength.floatValue;
settings.areaSizeX.floatValue = m_AdditionalLightData.shapeWidth.floatValue;
settings.areaSizeY.floatValue = 0.01f;
settings.shadowsType.enumValueIndex = (int)LightShadows.None;
break;

settings.DrawColor();
settings.DrawIntensity();
settings.DrawBounceIntensity();
settings.DrawRange(false);
settings.DrawLightmapping();
// No cookie with area light (maybe in future textured area light ?)

if (settings.cookie != null && m_LightShape == LightShape.Directional)
{
EditorGUI.indentLevel++;
EditorGUILayout.Slider(m_AdditionalLightData.shapeLength, 0.01f, 10f, s_Styles.cookieSizeX);
EditorGUILayout.Slider(m_AdditionalLightData.shapeWidth, 0.01f, 10f, s_Styles.cookieSizeY);
EditorGUILayout.Slider(m_AdditionalLightData.shapeWidth, 0.01f, 10f, s_Styles.cookieSizeX);
EditorGUILayout.Slider(m_AdditionalLightData.shapeHeight, 0.01f, 10f, s_Styles.cookieSizeY);
EditorGUI.indentLevel--;
}
}

6
ScriptableRenderPipeline/HDRenderPipeline/Editor/Material/SubsurfaceScattering/SubsurfaceScatteringSettingsEditor.Styles.cs


public readonly GUIContent profileMinMaxThickness = new GUIContent("Min-Max Thickness (mm)", "Shows the values of the thickness remap below (in millimeters).");
public readonly GUIContent profileThicknessRemap = new GUIContent("Thickness Remap (mm)", "Remaps the thickness parameter from [0, 1] to the desired range (in millimeters).");
public readonly GUIContent profileWorldScale = new GUIContent("World Scale", "Size of the world unit in meters.");
public readonly GUIContent profileFresnel0 = new GUIContent("Specular", "Percentage of light reflected at incident angle. Typical skin value is 0.028");
// Old SSS Model >>>
public readonly GUIContent profileFresnel0 = new GUIContent("Specular", "Fraction of light reflected at the normal angle of incidence. Typical skin value is 0.028");
// Jimenez SSS Model
// <<< Old SSS Model
// End Jimenez SSS Model
public readonly GUIStyle centeredMiniBoldLabel = new GUIStyle(GUI.skin.label);
public Styles()

14
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


cmd.CopyTexture(m_CameraDepthStencilBufferRT, m_CameraDepthBufferCopyRT);
}
}
cmd.SetGlobalTexture(HDShaderIDs._MainDepthTexture, GetDepthTexture());
}
}

// 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.
cmd.SetGlobalTexture(HDShaderIDs._MainDepthTexture, GetDepthTexture());
RenderPyramidDepth(camera, cmd, renderContext, FullScreenDebugMode.DepthPyramid);

// Currently disabled
return ;
// We need to copy depth buffer texture if we want to bind it at this stage
CopyDepthBufferIfNeeded(cmd); // THe call will bind HDShaderIDs._MainDepthTexture
// We need to copy depth buffer texture if we want to bind it at this stage
CopyDepthBufferIfNeeded(cmd);
// Depth texture is now ready, bind it.
cmd.SetGlobalTexture(HDShaderIDs._MainDepthTexture, GetDepthTexture());
CoreUtils.SetRenderTarget(cmd, m_DbufferManager.GetDBuffers(), m_CameraDepthStencilBufferRT, ClearFlag.Color, CoreUtils.clearColorAllBlack);
DecalSystem.instance.Render(renderContext, cameraPos, cmd);
}

8
ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDAdditionalLightData.cs


// Only for Rectangle/Line/box projector lights
[Range(0.0f, 20.0f)]
[FormerlySerializedAs("lightLength")]
public float shapeLength = 0.5f;
[FormerlySerializedAs("lightWidth")]
public float shapeWidth = 0.5f;
[FormerlySerializedAs("lightWidth")]
public float shapeWidth = 0.5f;
[FormerlySerializedAs("lightHeight")]
public float shapeHeight = 0.5f;
// Only for pyramid projector
public float aspectRatio = 1.0f;

6
ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDLightEditorUtilities.cs


{
var additionalLightData = spherelight.GetComponent<HDAdditionalLightData>();
if (additionalLightData == null) return;
Gizmos.DrawSphere(spherelight.transform.position, additionalLightData.shapeLength);
Gizmos.DrawSphere(spherelight.transform.position, additionalLightData.shapeWidth);
if (spherelight.shadows != LightShadows.None) Gizmos.DrawWireSphere(spherelight.transform.position, spherelight.shadowNearPlane);
Gizmos.DrawWireSphere(spherelight.transform.position, spherelight.range);
}

}
else // Ortho frustum
{
//DrawLightOrthoFrustum(Vector3.zero, additionalLightData.shapeLength, additionalLightData.shapeWidth, frustumlight.range, 0.0f);
//DrawLightOrthoFrustum(Vector3.zero, additionalLightData.shapeWidth, additionalLightData.shapeHeight, frustumlight.range, 0.0f);
Vector3 frustumsize = new Vector3(additionalLightData.shapeLength, additionalLightData.shapeWidth, frustumlight.range);
Vector3 frustumsize = new Vector3(additionalLightData.shapeWidth, additionalLightData.shapeHeight, frustumlight.range);
Gizmos.DrawWireCube(frustumCenter, frustumsize);
}
Gizmos.matrix = Matrix4x4.identity;

10
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightDefinition.cs


public Vector3 forward;
public int cookieIndex; // -1 if unused
public Vector3 right; // Rescaled by (2 / shapeLength)
public Vector3 right; // Rescaled by (2 / shapeWidth)
public Vector3 up; // Rescaled by (2 / shapeWidth)
public Vector3 up; // Rescaled by (2 / shapeHeight)
public float diffuseScale;
public Vector2 fadeDistanceScaleAndBias; // Use with ShadowMask feature

public Vector3 forward;
public int cookieIndex; // -1 if unused
public Vector3 right; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeLength)
public Vector3 right; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeWidth)
public Vector3 up; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeWidth)
public Vector3 up; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeHeight)
public float diffuseScale;
public float angleScale; // Spot light

public Vector4 shadowMaskSelector; // Use with ShadowMask feature
public Vector2 size; // Used by area and pyramid projector lights
public Vector2 size; // Used by area (X = length or width, Y = height) and box projector lights (X = range (depth))
public GPULightType lightType;
public float minRoughness; // This is use to give a small "area" to punctual light, as if we have a light with a radius.
};

52
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


// Light direction for directional is opposite to the forward direction
directionalLightData.forward = light.light.transform.forward;
// Rescale for cookies and windowing.
directionalLightData.up = light.light.transform.up * 2 / additionalData.shapeWidth;
directionalLightData.right = light.light.transform.right * 2 / additionalData.shapeLength;
directionalLightData.up = light.light.transform.up * 2 / additionalData.shapeHeight;
directionalLightData.right = light.light.transform.right * 2 / additionalData.shapeWidth;
directionalLightData.positionWS = light.light.transform.position;
directionalLightData.color = GetLightColor(light);
directionalLightData.diffuseScale = additionalData.affectDiffuse ? diffuseDimmer : 0.0f;

return 1.0f - Mathf.Clamp01(distanceToCamera * scale + bias);
}
public bool GetLightData(CommandBuffer cmd, ShadowSettings shadowSettings, Camera camera, GPULightType gpuLightType, VisibleLight light, HDAdditionalLightData additionalLightData, AdditionalShadowData additionalshadowData, int lightIndex)
public bool GetLightData(CommandBuffer cmd, ShadowSettings shadowSettings, Camera camera, GPULightType gpuLightType,
VisibleLight light, HDAdditionalLightData additionalLightData, AdditionalShadowData additionalshadowData,
int lightIndex, ref Vector3 lightDimensions)
{
var lightData = new LightData();

lightData.up = light.light.transform.up;
lightData.right = light.light.transform.right;
lightData.size = new Vector2(additionalLightData.shapeLength, additionalLightData.shapeWidth);
lightDimensions.x = additionalLightData.shapeWidth;
lightDimensions.y = additionalLightData.shapeHeight;
lightDimensions.z = light.range;
lightData.size.x = light.range;
lightData.right *= 2.0f / additionalLightData.shapeLength;
lightData.up *= 2.0f / additionalLightData.shapeWidth;
lightData.right *= 2.0f / additionalLightData.shapeWidth;
lightData.up *= 2.0f / additionalLightData.shapeHeight;
}
else if (lightData.lightType == GPULightType.ProjectorPyramid)
{

float frustumHeight;
float frustumWidth;
float frustumWidth, frustumHeight;
if (additionalLightData.aspectRatio >= 1.0f)
{
frustumHeight = 2.0f * Mathf.Tan(spotAngle * 0.5f * Mathf.Deg2Rad);

frustumHeight = frustumWidth / additionalLightData.aspectRatio;
}
lightData.size = new Vector2(frustumWidth, frustumHeight);
// Adjust based on the new parametrization.
lightDimensions.x = frustumWidth;
lightDimensions.y = frustumHeight;
// Rescale for cookies and windowing.
lightData.right *= 2.0f / frustumWidth;

// These are the neutral values allowing GetAngleAnttenuation in shader code to return 1.0
lightData.angleScale = 0.0f;
lightData.angleOffset = 1.0f;
}
if (lightData.lightType == GPULightType.Rectangle || lightData.lightType == GPULightType.Line)
{
lightData.size = new Vector2(additionalLightData.shapeWidth, additionalLightData.shapeHeight);
}
float distanceToCamera = (lightData.positionWS - camera.transform.position).magnitude;

}
// TODO: we should be able to do this calculation only with LightData without VisibleLight light, but for now pass both
public void GetLightVolumeDataAndBound(LightCategory lightCategory, GPULightType gpuLightType, LightVolumeType lightVolumeType, VisibleLight light, LightData lightData, Matrix4x4 worldToView)
public void GetLightVolumeDataAndBound(LightCategory lightCategory, GPULightType gpuLightType, LightVolumeType lightVolumeType,
VisibleLight light, LightData lightData, Vector3 lightDimensions, Matrix4x4 worldToView)
var range = light.range;
var range = lightDimensions.z;
var lightToWorld = light.localToWorld;
Vector3 positionWS = lightData.positionWS;
Vector3 positionVS = worldToView.MultiplyPoint(positionWS);

if (gpuLightType == GPULightType.ProjectorPyramid)
{
Vector3 lightPosToProjWindowCorner = (0.5f * lightData.size.x) * vx + (0.5f * lightData.size.y) * vy + 1.0f * vz;
Vector3 lightPosToProjWindowCorner = (0.5f * lightDimensions.x) * vx + (0.5f * lightDimensions.y) * vy + 1.0f * vz;
cs = Vector3.Dot(vz, Vector3.Normalize(lightPosToProjWindowCorner));
si = Mathf.Sqrt(1.0f - cs * cs);
}

}
else if (gpuLightType == GPULightType.Line)
{
Vector3 dimensions = new Vector3(lightData.size.x + 2 * range, 2 * range, 2 * range); // Omni-directional
Vector3 dimensions = new Vector3(lightDimensions.x + 2 * range, 2 * range, 2 * range); // Omni-directional
Vector3 extents = 0.5f * dimensions;
bound.center = positionVS;

lightVolumeData.lightAxisX = xAxisVS;
lightVolumeData.lightAxisY = yAxisVS;
lightVolumeData.lightAxisZ = zAxisVS;
lightVolumeData.boxInnerDist = new Vector3(lightData.size.x, 0, 0);
lightVolumeData.boxInnerDist = new Vector3(lightDimensions.x, 0, 0);
Vector3 dimensions = new Vector3(lightData.size.x + 2 * range, lightData.size.y + 2 * range, range); // One-sided
Vector3 dimensions = new Vector3(lightDimensions.x + 2 * range, lightDimensions.y + 2 * range, range); // One-sided
Vector3 extents = 0.5f * dimensions;
Vector3 centerVS = positionVS + extents.z * zAxisVS;

}
else if (gpuLightType == GPULightType.ProjectorBox)
{
Vector3 dimensions = new Vector3(lightData.size.x, lightData.size.y, range); // One-sided
Vector3 dimensions = new Vector3(lightDimensions.x, lightDimensions.y, range); // One-sided
Vector3 extents = 0.5f * dimensions;
Vector3 centerVS = positionVS + extents.z * zAxisVS;

continue;
}
Vector3 lightDimensions = new Vector3(); // X = length or width, Y = height, Z = range (depth)
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex))
if (GetLightData(cmd, shadowSettings, camera, gpuLightType, light, additionalLightData, additionalShadowData, lightIndex, ref lightDimensions))
{
switch (lightCategory)
{

}
// Then culling side. Must be call in this order as we pass the created Light data to the function
GetLightVolumeDataAndBound(lightCategory, gpuLightType, lightVolumeType, light, m_lightList.lights[m_lightList.lights.Count - 1], worldToView);
GetLightVolumeDataAndBound(lightCategory, gpuLightType, lightVolumeType, light, m_lightList.lights[m_lightList.lights.Count - 1], lightDimensions, worldToView);
// We make the light position camera-relative as late as possible in order
// to allow the preceding code to work with the absolute world space coordinates.

2
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.hlsl


lightData = FetchLight(lightStart, min(++i, last));
}
while (i <= last && lightData.lightType == GPULIGHTTYPE_RECTANGLE)
while (i <= last) // GPULIGHTTYPE_RECTANGLE
{
lightData.lightType = GPULIGHTTYPE_RECTANGLE; // Enforce constant propagation

39
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


{
bsdfData.diffuseColor = surfaceData.baseColor;
bsdfData.fresnel0 = _TransmissionTintsAndFresnel0[surfaceData.subsurfaceProfile].a;
uint transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u, 2u * surfaceData.subsurfaceProfile);
uint transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u * surfaceData.subsurfaceProfile, 2u);
FillMaterialIdSssData(surfaceData.subsurfaceProfile,
surfaceData.subsurfaceRadius,

DecodeFromSSSBuffer(inGBuffer0, positionSS, sssData);
subsurfaceProfile = sssData.subsurfaceProfile;
transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u, 2u * subsurfaceProfile);
transmissionMode = BitFieldExtract(asuint(_TransmissionFlags), 2u * subsurfaceProfile, 2u);
radius = sssData.subsurfaceRadius;
thickness = inGBuffer2.g;

// we need to push the shading position back to avoid self-shadowing problems.
float3 ComputeThicknessDisplacement(BSDFData bsdfData, float3 L, float NdotL)
{
// Compute the thickness in world units along the normal.
float thicknessInMeters = bsdfData.thickness * METERS_PER_MILLIMETER;
float thicknessInUnits = thicknessInMeters * _WorldScales[bsdfData.subsurfaceProfile].y;
float displacement = 0;
[flatten] if (bsdfData.useThickObjectMode && NdotL < 0)
{
// Compute the thickness in world units along the normal.
float thicknessInMeters = bsdfData.thickness * METERS_PER_MILLIMETER;
float thicknessInUnits = thicknessInMeters * _WorldScales[bsdfData.subsurfaceProfile].y;
// Compute the thickness in world units along the light vector.
float unprojectedThickness = thicknessInUnits / -NdotL;
// Compute the thickness in world units along the light vector.
displacement = thicknessInUnits / -NdotL;
}
return unprojectedThickness * L;
return displacement * L;
}
// Currently, we only model diffuse transmission. Specular transmission is not yet supported.

float3 L = -lightData.forward; // Lights point backward in Unity
float NdotL = dot(N, L);
[flatten] if (bsdfData.useThickObjectMode && NdotL < 0)
{
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
}
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
float3 color; float attenuation;
EvaluateLight_Directional(lightLoopContext, posInput, lightData, bakeLightingData, N, L,

[branch] if (intensity > 0.0)
[branch] if (intensity > 0)
{
BSDF(V, L, posInput.positionWS, preLightData, bsdfData, lighting.diffuse, lighting.specular);

[flatten] if (bsdfData.enableTransmission)
[branch] if (bsdfData.enableTransmission)
{
// We use diffuse lighting for accumulation since it is going to be blurred during the SSS pass.
lighting.diffuse += EvaluateTransmission(bsdfData, NdotL, preLightData.NdotV, attenuation * lightData.diffuseScale);

float3 L = unL * distRcp;
float NdotL = dot(N, L);
[flatten] if (bsdfData.useThickObjectMode && NdotL < 0)
{
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
}
posInput.positionWS += ComputeThicknessDisplacement(bsdfData, L, NdotL);
float3 color; float attenuation;
EvaluateLight_Punctual(lightLoopContext, posInput, lightData, bakeLightingData, N, L, dist, distSq,

[branch] if (intensity > 0.0)
[branch] if (intensity > 0)
{
// Simulate a sphere light with this hack.
bsdfData.roughnessT = max(bsdfData.roughnessT, lightData.minRoughness);

lighting.specular *= intensity * lightData.specularScale;
}
[flatten] if (bsdfData.enableTransmission)
[branch] if (bsdfData.enableTransmission)
{
// We use diffuse lighting for accumulation since it is going to be blurred during the SSS pass.
lighting.diffuse += EvaluateTransmission(bsdfData, NdotL, preLightData.NdotV, attenuation * lightData.diffuseScale);

2
ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VaryingMesh.hlsl


#endif
#if defined(VARYINGS_NEED_CULLFACE) && SHADER_STAGE_FRAGMENT
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMATIC;
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
#endif
};

4
ScriptableRenderPipeline/HDRenderPipeline/package.json


{
"name": "com.unity.render-pipelines.high-definition",
"description": "HD Render Pipeline for Unity.",
"version": "0.1.20",
"version": "0.1.21",
"com.unity.render-pipelines.core": "0.1.20"
"com.unity.render-pipelines.core": "0.1.21"
}
}

71
ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs


#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.ProjectWindowCallback;
#endif
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public enum ShadowCascades

public class LightweightPipelineAsset : RenderPipelineAsset
{
public static readonly string[] m_SearchPaths = {"Assets", "Packages/com.unity.render-pipelines"};
public static readonly string[] m_SearchPaths = {"Assets", "Packages/com.unity.render-pipelines.lightweight"};
// Default values set when a new LightweightPipeline asset is created
[SerializeField] private int m_MaxPixelLights = 4;

[SerializeField] private Material m_DefaultParticleMaterial;
[SerializeField] private Material m_DefaultTerrainMaterial;
[UnityEditor.MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Asset", priority = CoreUtils.assetCreateMenuPriority1)]
[MenuItem("Assets/Create/Render Pipeline/Lightweight/Pipeline Asset", priority = CoreUtils.assetCreateMenuPriority1)]
var instance = CreateInstance<LightweightPipelineAsset>();
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateLightweightPipelineAsset>(),
"LightweightAsset.asset", null, null);
}
string[] guids = UnityEditor.AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths);
LightweightPipelineResource resourceAsset = null;
foreach (string guid in guids)
class CreateLightweightPipelineAsset : EndNameEditAction
{
public override void Action(int instanceId, string pathName, string resourceFile)
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(guid);
resourceAsset = UnityEditor.AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
if (resourceAsset != null)
break;
}
var instance = CreateInstance<LightweightPipelineAsset>();
// There's currently an issue that prevents FindAssets from find resources withing the package folder.
if (resourceAsset == null)
{
string path = "Packages/com.unity.render-pipelines.lightweight/Data/LightweightPipelineResource.asset";
resourceAsset = UnityEditor.AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
}
string[] guids = AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths);
LightweightPipelineResource resourceAsset = null;
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
resourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
if (resourceAsset != null)
break;
}
if (resourceAsset != null)
{
instance.m_DefaultMaterial = resourceAsset.DefaultMaterial;
instance.m_DefaultParticleMaterial = resourceAsset.DefaultParticleMaterial;
instance.m_DefaultTerrainMaterial = resourceAsset.DefaultTerrainMaterial;
}
// There's currently an issue that prevents FindAssets from find resources withing the package folder.
if (resourceAsset == null)
{
string path = "Packages/com.unity.render-pipelines.lightweight/Data/LightweightPipelineResource.asset";
resourceAsset = AssetDatabase.LoadAssetAtPath<LightweightPipelineResource>(path);
}
instance.m_DefaultShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
instance.m_BlitShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_BLIT));
instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));
if (resourceAsset != null)
{
instance.m_DefaultMaterial = resourceAsset.DefaultMaterial;
instance.m_DefaultParticleMaterial = resourceAsset.DefaultParticleMaterial;
instance.m_DefaultTerrainMaterial = resourceAsset.DefaultTerrainMaterial;
}
string assetPath = UnityEditor.EditorUtility.SaveFilePanelInProject("Save Lightweight Asset", "LightweightAsset", "asset",
"Please enter a file name to save the asset to");
instance.m_DefaultShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
instance.m_BlitShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_BLIT));
instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));
if (assetPath.Length > 0)
UnityEditor.AssetDatabase.CreateAsset(instance, assetPath);
AssetDatabase.CreateAsset(instance, pathName);
}
#endif
protected override IRenderPipeline InternalCreatePipeline()

4
ScriptableRenderPipeline/LightweightPipeline/package.json


{
"name": "com.unity.render-pipelines.lightweight",
"description": "Lightweight Render Pipeline for Unity.",
"version": "0.1.20",
"version": "0.1.21",
"com.unity.render-pipelines.core": "0.1.20"
"com.unity.render-pipelines.core": "0.1.21"
}
}

2
ScriptableRenderPipeline/master-package.json


{
"version": "0.1.20",
"version": "0.1.21",
"unity": "2018.1",
"dependencies": {
"com.unity.postprocessing": "0.1.7"

120
Tests/GraphicsTests/Framework/Editor/TestFramework.cs


using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;

}
// collect the scenes that we can use
// Renderpipeline assets used for the tests
public static Dictionary<string, string> renderPipelineAssets = new Dictionary<string, string>()
{
{ "HDRP", "HDRenderPipeline/CommonAssets/HDRP_GraphicTests_Asset.asset" },
{ "LWRP", "LightweightPipeline/LightweightPipelineAsset.asset" }
};
// Renderpipeline assets used for the tests
public static Dictionary<string, string> renderPipelineScenesFolder = new Dictionary<string, string>()
{
{ "HDRP", "HDRenderPipeline/Scenes" },
{ "LWRP", "LightweightPipeline" }
};
// collect the scenes that we can use
public static IEnumerable HDScenes
public static IEnumerable HDRP
return GetScenesForPipeline("HDRenderPipeline");
return GetScenesForPipelineID("HDRP");
public static IEnumerable LWScenes
public static IEnumerable LWRP
return GetScenesForPipeline("LightweightPipeline");
return GetScenesForPipelineID("LWRP");
}
public static IEnumerable GetScenesForPipelineID( string _pipelineID )
{
return GetScenesForPipeline( renderPipelineScenesFolder[_pipelineID] );
}
public static IEnumerable GetScenesForPipeline(string _pipelinePath)

var filesPath = Path.Combine(absoluteScenesPath, _pipelinePath);
// find all the scenes
var allPaths = System.IO.Directory.GetFiles(filesPath, "*.unity", System.IO.SearchOption.AllDirectories);
var allPaths = Directory.GetFiles(filesPath, "*.unity", SearchOption.AllDirectories);
// Convert to List for easy sorting in alphabetical ordre
List<string> allPaths_List = new List<string>(allPaths);
allPaths_List.Sort();
foreach (var path in allPaths)
for (int i=0; i<allPaths_List.Count; ++i)
var path = allPaths_List[i];
var p = new FileInfo(path);
var split = s_Path.Aggregate("", Path.Combine);
split = string.Format("{0}{1}", split, Path.DirectorySeparatorChar);

}
}
[TearDown]
public void TearDown()
// Change the SRP before a full batch of tests
public virtual string _SRP_ID { get { return "NONE"; } }
[OneTimeSetUp]
public void OneTimeSetUp()
var testSetup = Object.FindObjectOfType<SetupSceneForRenderPipelineTest>();
if (testSetup == null)
return;
SetupRenderPipeAsset();
}
testSetup.TearDown();
[OneTimeTearDown]
public void OnTimeTearDown()
{
RestoreRenderPipeAsset();
[UnityTest]
public IEnumerator HDRP_TestScene([ValueSource(typeof(CollectScenes), "HDScenes")]TestInfo testInfo)
public static RenderPipelineAsset GetRenderPipelineAsset(string _SRP_ID)
return TestScene(testInfo);
string absolutePath = s_Path.Aggregate(s_RootPath, Path.Combine);
string filePath = Path.Combine(absolutePath, renderPipelineAssets[_SRP_ID] );
return (RenderPipelineAsset)AssetDatabase.LoadAssetAtPath(filePath, typeof(RenderPipelineAsset));
[UnityTest]
public IEnumerator LWRP_TestScene([ValueSource(typeof(CollectScenes), "LWScenes")]TestInfo testInfo)
public static RenderPipelineAsset beforeTestsRenderPipeAsset;
public static RenderPipelineAsset wantedTestsRenderPipeAsset;
public void SetupRenderPipeAsset()
return TestScene(testInfo);
Debug.Log("Set " + _SRP_ID + " render pipeline.");
beforeTestsRenderPipeAsset = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset;
wantedTestsRenderPipeAsset = GetRenderPipelineAsset(_SRP_ID);
if (wantedTestsRenderPipeAsset != beforeTestsRenderPipeAsset)
UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset = wantedTestsRenderPipeAsset;
public IEnumerator TestScene(TestInfo testInfo)
public void RestoreRenderPipeAsset()
{
if (wantedTestsRenderPipeAsset != beforeTestsRenderPipeAsset)
UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset = beforeTestsRenderPipeAsset;
}
// the actual test
public static IEnumerator TestScene(TestInfo testInfo)
{
var prjRelativeGraphsPath = s_Path.Aggregate(s_RootPath, Path.Combine);
var filePath = Path.Combine(prjRelativeGraphsPath, testInfo.relativePath);

var testSetup = Object.FindObjectOfType<SetupSceneForRenderPipelineTest> ();
SetupSceneForRenderPipelineTest testSetup = Object.FindObjectOfType<SetupSceneForRenderPipelineTest> ();
Assert.IsNotNull(testSetup, "No SetupSceneForRenderPipelineTest in scene " + testInfo.name);
Assert.IsNotNull(testSetup.cameraToUse, "No configured camera in <SetupSceneForRenderPipelineTest>");

}
Assert.IsTrue(areEqual, "Scene from {0}, did not match .template file.", testInfo.relativePath);
testSetup.TearDown();
private bool CompareTextures(Texture2D fromDisk, Texture2D captured, float threshold)
private static bool CompareTextures(Texture2D fromDisk, Texture2D captured, float threshold)
{
if (fromDisk == null || captured == null)
return false;

}
float rmse = Mathf.Sqrt(sumOfSquaredColorDistances / numberOfPixels);
return rmse < threshold;
}
// Graphic Tests Subclasses that inherit the functions bot provide different SRP_ID
public class HDRP : GraphicsTests
{
public override string _SRP_ID { get { return "HDRP"; } }
[UnityTest]
public IEnumerator HDRP_Test([ValueSource(typeof(CollectScenes), "HDRP")]TestInfo testInfo)
{
return TestScene(testInfo);
}
}
public class LTRP : GraphicsTests
{
public override string _SRP_ID { get { return "LWRP"; } }
[UnityTest]
public IEnumerator LWRP_Test([ValueSource(typeof(CollectScenes), "LWRP")]TestInfo testInfo)
{
return TestScene(testInfo);
}
}
}
}

6
Tests/GraphicsTests/Framework/SetupSceneForRenderPipelineTest.cs


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

public void Setup()
{
m_OriginalAsset = GraphicsSettings.renderPipelineAsset;
GraphicsSettings.renderPipelineAsset = renderPipeline;
if (m_OriginalAsset != renderPipeline) GraphicsSettings.renderPipelineAsset = renderPipeline;
GraphicsSettings.renderPipelineAsset = m_OriginalAsset;
if ( GraphicsSettings.renderPipelineAsset != m_OriginalAsset ) GraphicsSettings.renderPipelineAsset = m_OriginalAsset;
}
}
}

860
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1203_Lit_Transparent.unity
文件差异内容过多而无法显示
查看文件

4
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1210_Lit_BentNormal.unity


affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 2.5
shapeWidth: 4.51
shapeWidth: 2.5
shapeHeight: 4.51
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

146
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2001_Dynamic_Directional.unity


- component: {fileID: 835557364}
- component: {fileID: 835557363}
- component: {fileID: 835557362}
- component: {fileID: 835557361}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged

m_IsActive: 1
--- !u!136 &835557361
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 835557360}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &835557362
MeshRenderer:
m_ObjectHideFlags: 0

m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1134522063
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.x
value: -0.113
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.y
value: 0.08
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.z
value: -1.511
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.y
value: -0.25287157
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.w
value: 0.96749985
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.x
value: 4.4106
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.y
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.z
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalEulerAnglesHint.y
value: -29.295002
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1669536974
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1669536978}
- component: {fileID: 1669536977}
- component: {fileID: 1669536976}
m_Layer: 0
m_Name: Capsule (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!23 &1669536976
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1669536974}
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_Materials:
- {fileID: 2100000, guid: 2505e1d9c7a8c654487d6a2dcae04242, 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 &1669536977
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1669536974}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1669536978
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1669536974}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.13, y: -2, z: -1.02}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1900725046
GameObject:
m_ObjectHideFlags: 0

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 8
shapeHeight: 8
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

628
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2002_Dynamic_Mix.unity


debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &183745593
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 737838453}
m_Modifications:
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.x
value: 0.100000024
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.y
value: 1.817
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.z
value: -0.923
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.y
value: -0.33849397
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.w
value: 0.9409686
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.y
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.z
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalEulerAnglesHint.y
value: -39.570004
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
m_IsPrefabParent: 0
--- !u!4 &183745594 stripped
Transform:
m_PrefabParentObject: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23,
type: 2}
m_PrefabInternal: {fileID: 183745593}
--- !u!1001 &333183857
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1192666584}
m_Modifications:
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.x
value: 0.03999996
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.y
value: 1.817
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.z
value: -0.99
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.y
value: -0.34168717
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.w
value: 0.93981373
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.y
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.z
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalEulerAnglesHint.y
value: -39.959003
objectReference: {fileID: 0}
- target: {fileID: 1752614318191108, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_Name
value: Cube (2)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
m_IsPrefabParent: 0
--- !u!4 &333183858 stripped
Transform:
m_PrefabParentObject: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23,
type: 2}
m_PrefabInternal: {fileID: 333183857}
--- !u!1 &467207848
GameObject:
m_ObjectHideFlags: 0

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 1
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

- {fileID: 1890834151}
- {fileID: 626316075}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 2
--- !u!1001 &607344269
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1902903443}
m_Modifications:
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.x
value: 0.427
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.y
value: 1.501
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.z
value: 0.6890001
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.y
value: 0.41579127
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.w
value: 0.90946007
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.y
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.z
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalEulerAnglesHint.y
value: 49.138
objectReference: {fileID: 0}
- target: {fileID: 1752614318191108, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_Name
value: Cube (3)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
m_IsPrefabParent: 0
--- !u!4 &607344270 stripped
Transform:
m_PrefabParentObject: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23,
type: 2}
m_PrefabInternal: {fileID: 607344269}
--- !u!1 &626316074
GameObject:
m_ObjectHideFlags: 0

m_Children:
- {fileID: 1028431635}
- {fileID: 1169686270}
- {fileID: 2138720844}
- {fileID: 183745594}
--- !u!1001 &809663470
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2109923720}
m_Modifications:
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.x
value: 0.15299988
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.y
value: 1.817
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalPosition.z
value: -0.80200005
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.y
value: -0.27791908
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalRotation.w
value: 0.96060455
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.y
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalScale.z
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_LocalEulerAnglesHint.y
value: -32.272003
objectReference: {fileID: 0}
- target: {fileID: 1752614318191108, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
propertyPath: m_Name
value: Cube (1)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23, type: 2}
m_IsPrefabParent: 0
--- !u!4 &809663471 stripped
Transform:
m_PrefabParentObject: {fileID: 4729046375724384, guid: 48a8bf1cfd4090647aa6cdcd4cddfc23,
type: 2}
m_PrefabInternal: {fileID: 809663470}
--- !u!1 &835557360
GameObject:
m_ObjectHideFlags: 0

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 3.5
shapeHeight: 3.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Children:
- {fileID: 1498382502}
- {fileID: 673842479}
- {fileID: 1753161994}
- {fileID: 333183858}
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Father: {fileID: 1192666584}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1556403009
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1556403010}
- component: {fileID: 1556403013}
- component: {fileID: 1556403012}
- component: {fileID: 1556403011}
m_Layer: 0
m_Name: Capsule (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1556403010
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1556403009}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.93, y: 1, z: -0.58}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2109923720}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &1556403011
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1556403009}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1556403012
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1556403009}
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_Materials:
- {fileID: 2100000, guid: 2505e1d9c7a8c654487d6a2dcae04242, 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 &1556403013
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1556403009}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1637281119
GameObject:
m_ObjectHideFlags: 0

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1 &1660772714
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1660772715}
- component: {fileID: 1660772718}
- component: {fileID: 1660772717}
- component: {fileID: 1660772716}
m_Layer: 0
m_Name: Capsule (4)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1660772715
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1660772714}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.69299984, y: 1, z: 2.0500002}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1902903443}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &1660772716
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1660772714}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1660772717
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1660772714}
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_Materials:
- {fileID: 2100000, guid: 2505e1d9c7a8c654487d6a2dcae04242, 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 &1660772718
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1660772714}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1753161993
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1753161994}
- component: {fileID: 1753161997}
- component: {fileID: 1753161996}
- component: {fileID: 1753161995}
m_Layer: 0
m_Name: Capsule (3)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1753161994
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1753161993}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.86000013, y: 1, z: -0.72}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1192666584}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &1753161995
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1753161993}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1753161996
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1753161993}
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_Materials:
- {fileID: 2100000, guid: 2505e1d9c7a8c654487d6a2dcae04242, 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 &1753161997
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1753161993}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1837398465
GameObject:
m_ObjectHideFlags: 0

- {fileID: 1302673723}
- {fileID: 1837398469}
- {fileID: 467207852}
- {fileID: 1660772715}
- {fileID: 607344270}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1930668412
GameObject:

m_Children:
- {fileID: 835557364}
- {fileID: 956017065}
- {fileID: 1556403010}
- {fileID: 809663471}
--- !u!1 &2138720843
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2138720844}
- component: {fileID: 2138720847}
- component: {fileID: 2138720846}
- component: {fileID: 2138720845}
m_Layer: 0
m_Name: Capsule (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2138720844
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138720843}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.8699999, y: 1, z: -0.62}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 737838453}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &2138720845
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138720843}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &2138720846
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138720843}
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_Materials:
- {fileID: 2100000, guid: 2505e1d9c7a8c654487d6a2dcae04242, 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 &2138720847
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2138720843}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}

110
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.3661533, g: 0.3847445, b: 0.42534745, a: 1}
m_IndirectSpecularColor: {r: 0.07321051, g: 0.076927215, b: 0.08504366, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 119984175}
m_LocalRotation: {x: -0, y: -0, z: 0.70710677, w: 0.7071068}
m_LocalPosition: {x: -2.429, y: -0.5, z: 0}
m_LocalRotation: {x: 0.059106357, y: -0.05910636, z: 0.7046321, w: 0.7046322}
m_LocalPosition: {x: -2.429, y: -2.11, z: -0.4}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90.00001}
m_LocalEulerAnglesHint: {x: 9.59, y: 0, z: 90.00001}
--- !u!102 &119984177
TextMesh:
serializedVersion: 3

m_GameObject: {fileID: 119984175}
m_Text: Spot Point
m_Text: ' Line Rect. Spot Point'
m_CharacterSize: 0.2
m_CharacterSize: 0.15
m_LineSpacing: 1
m_Anchor: 7
m_Alignment: 1

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

serializedVersion: 8
m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 3.14
m_Intensity: 1
m_Range: 0.6
m_SpotAngle: 140
m_CookieSize: 10

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

serializedVersion: 8
m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 3.14
m_Intensity: 1
m_Range: 0.6
m_SpotAngle: 140
m_CookieSize: 10

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.2

affectSpecular: 0
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.6
m_Range: 0.8
m_SpotAngle: 140
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.7
m_Range: 0.8
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.7
m_Range: 0.8
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.6
m_Range: 0.8
m_SpotAngle: 140
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 2
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.6
m_Range: 0.8
m_SpotAngle: 140
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.7
m_Range: 0.8
m_SpotAngle: 179
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.8

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.6

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.6
m_Range: 0.7
m_SpotAngle: 179
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 2
shapeLength: 1.1
shapeWidth: 6
shapeWidth: 1.1
shapeHeight: 6
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 0.4

value:
objectReference: {fileID: 11400000, guid: 6afe60f7be788644f84fb8dc55566ff7,
type: 2}
- target: {fileID: 114110876577682668, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: m_BackGroundColor.r
value: 0.2509804
objectReference: {fileID: 0}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: m_BackGroundColor.g
value: 0.2509804
objectReference: {fileID: 0}
- target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 2}
propertyPath: m_BackGroundColor.b
value: 0.2509804
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 2}
m_IsPrefabParent: 0

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.6
m_Range: 0.7
m_SpotAngle: 179
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

m_Type: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 0.6
m_Range: 0.7
m_SpotAngle: 179
m_CookieSize: 10
m_Shadows:

affectSpecular: 1
lightTypeExtent: 1
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

serializedVersion: 8
m_Type: 2
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 3.14
m_Intensity: 1
m_Range: 0.6
m_SpotAngle: 140
m_CookieSize: 10

affectSpecular: 0
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

affectSpecular: 1
lightTypeExtent: 0
spotLightShape: 0
shapeLength: 0.5
shapeHeight: 0.5
aspectRatio: 1
shapeRadius: 0
maxSmoothness: 1

2
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2003_Light_Parameters/HDRP_Default_Sky 1.asset


m_EditorClassIdentifier:
rotation: 160
exposure: 0
multiplier: 1
multiplier: 0.2
resolution: 256
updateMode: 0
updatePeriod: 0

691
ScriptableRenderPipeline/Core/Editor/FilterWindow.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace UnityEditor.Experimental.Rendering
{
[InitializeOnLoad]
public class FilterWindow : EditorWindow
{
public interface IProvider
{
Vector2 position { get; set; }
void CreateComponentTree(List<Element> tree);
bool GoToChild(Element element, bool addIfComponent);
}
public static readonly float DefaultWidth = 250f;
public static readonly float DefaultHeight = 300f;
#region BaseElements
public class Element : IComparable
{
public int level;
public GUIContent content;
public string name
{
get { return content.text; }
}
public int CompareTo(object o)
{
return name.CompareTo((o as Element).name);
}
}
[Serializable]
public class GroupElement : Element
{
public Vector2 scroll;
public int selectedIndex;
public bool WantsFocus { get; protected set; }
public virtual bool ShouldDisable
{
get { return false; }
}
public GroupElement(int level, string name)
{
this.level = level;
content = new GUIContent(name);
}
public virtual bool HandleKeyboard(Event evt, FilterWindow window, Action goToParent)
{
return false;
}
public virtual bool OnGUI(FilterWindow sFilterWindow)
{
return false;
}
}
#endregion
// Styles
class Styles
{
public GUIStyle header = (GUIStyle)typeof(EditorStyles).GetProperty("inspectorBig", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null, null);
public GUIStyle componentButton = new GUIStyle("PR Label");
public GUIStyle groupButton;
public GUIStyle background = "grey_border";
public GUIStyle rightArrow = "AC RightArrow";
public GUIStyle leftArrow = "AC LeftArrow";
public Styles()
{
header.font = EditorStyles.boldLabel.font;
componentButton.alignment = TextAnchor.MiddleLeft;
componentButton.fixedHeight = 20;
componentButton.imagePosition = ImagePosition.ImageAbove;
groupButton = new GUIStyle(componentButton);
}
}
const int k_HeaderHeight = 30;
const int k_WindowHeight = 400 - 80;
const int k_HelpHeight = 80 * 0;
const string k_ComponentSearch = "NodeSearchString";
static Styles s_Styles;
static FilterWindow s_FilterWindow;
static long s_LastClosedTime;
static bool s_DirtyList;
IProvider m_Provider;
Element[] m_Tree;
Element[] m_SearchResultTree;
List<GroupElement> m_Stack = new List<GroupElement>();
float m_Anim = 1;
int m_AnimTarget = 1;
long m_LastTime;
bool m_ScrollToSelected;
string m_DelayedSearch;
string m_Search = "";
bool m_HasSearch { get { return !string.IsNullOrEmpty(m_Search); } }
GroupElement m_ActiveParent { get { return m_Stack[m_Stack.Count - 2 + m_AnimTarget]; } }
Element[] m_ActiveTree { get { return m_HasSearch ? m_SearchResultTree : m_Tree; } }
Element m_ActiveElement
{
get
{
if (m_ActiveTree == null)
return null;
var children = GetChildren(m_ActiveTree, m_ActiveParent);
return children.Count == 0
? null
: children[m_ActiveParent.selectedIndex];
}
}
bool m_IsAnimating { get { return !Mathf.Approximately(m_Anim, m_AnimTarget); } }
static FilterWindow()
{
s_DirtyList = true;
}
void OnEnable()
{
s_FilterWindow = this;
m_Search = "";
}
void OnDisable()
{
s_LastClosedTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
s_FilterWindow = null;
}
internal static bool ValidateAddComponentMenuItem()
{
return true;
}
internal static bool Show(Vector2 position, IProvider provider)
{
// If the window is already open, close it instead.
var wins = Resources.FindObjectsOfTypeAll(typeof(FilterWindow));
if (wins.Length > 0)
{
try
{
((EditorWindow)wins[0]).Close();
return false;
}
catch (Exception)
{
s_FilterWindow = null;
}
}
// We could not use realtimeSinceStartUp since it is set to 0 when entering/exitting
// playmode, we assume an increasing time when comparing time.
long nowMilliSeconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
bool justClosed = nowMilliSeconds < s_LastClosedTime + 50;
if (!justClosed)
{
Event.current.Use();
if (s_FilterWindow == null)
{
s_FilterWindow = CreateInstance<FilterWindow>();
s_FilterWindow.hideFlags = HideFlags.HideAndDontSave;
}
s_FilterWindow.Init(position, provider);
return true;
}
return false;
}
static object Invoke(Type t, object inst, string method, params object[] args)
{
var flags = (inst == null ? BindingFlags.Static : BindingFlags.Instance) | BindingFlags.NonPublic;
var mi = t.GetMethod(method, flags);
return mi.Invoke(inst, args);
}
void Init(Vector2 position, IProvider provider)
{
m_Provider = provider;
// Has to be done before calling Show / ShowWithMode
m_Provider.position = position;
position = GUIUtility.GUIToScreenPoint(position);
var buttonRect = new Rect(position.x - DefaultWidth / 2, position.y - 16, DefaultWidth, 1);
CreateComponentTree();
ShowAsDropDown(buttonRect, new Vector2(buttonRect.width, k_WindowHeight));
Focus();
wantsMouseMove = true;
}
void CreateComponentTree()
{
var tree = new List<Element>();
m_Provider.CreateComponentTree(tree);
m_Tree = tree.ToArray();
// Rebuild stack
if (m_Stack.Count == 0)
{
m_Stack.Add(m_Tree[0] as GroupElement);
}
else
{
// The root is always the match for level 0
var match = m_Tree[0] as GroupElement;
int level = 0;
while (true)
{
// Assign the match for the current level
var oldElement = m_Stack[level];
m_Stack[level] = match;
m_Stack[level].selectedIndex = oldElement.selectedIndex;
m_Stack[level].scroll = oldElement.scroll;
// See if we reached last element of stack
level++;
if (level == m_Stack.Count)
break;
// Try to find a child of the same name as we had before
var children = GetChildren(m_ActiveTree, match);
var childMatch = children.FirstOrDefault(c => c.name == m_Stack[level].name);
if (childMatch is GroupElement)
{
match = childMatch as GroupElement;
}
else
{
// If we couldn't find the child, remove all further elements from the stack
while (m_Stack.Count > level)
m_Stack.RemoveAt(level);
}
}
}
s_DirtyList = false;
RebuildSearch();
}
internal void OnGUI()
{
if (s_Styles == null)
s_Styles = new Styles();
GUI.Label(new Rect(0, 0, position.width, position.height), GUIContent.none, s_Styles.background);
if (s_DirtyList)
CreateComponentTree();
// Keyboard
HandleKeyboard();
GUILayout.Space(7);
// Search
if (!m_ActiveParent.WantsFocus)
{
EditorGUI.FocusTextInControl("ComponentSearch");
Focus();
}
var searchRect = GUILayoutUtility.GetRect(10, 20);
searchRect.x += 8;
searchRect.width -= 16;
GUI.SetNextControlName("ComponentSearch");
using (new EditorGUI.DisabledScope(m_ActiveParent.ShouldDisable))
{
string newSearch = (string)Invoke(typeof(EditorGUI), null, "SearchField", searchRect, m_DelayedSearch ?? m_Search);
if (newSearch != m_Search || m_DelayedSearch != null)
{
if (!m_IsAnimating)
{
m_Search = m_DelayedSearch ?? newSearch;
EditorPrefs.SetString(k_ComponentSearch, m_Search);
RebuildSearch();
m_DelayedSearch = null;
}
else
{
m_DelayedSearch = newSearch;
}
}
}
// Show lists
ListGUI(m_ActiveTree, m_Anim, GetElementRelative(0), GetElementRelative(-1));
if (m_Anim < 1)
ListGUI(m_ActiveTree, m_Anim + 1, GetElementRelative(-1), GetElementRelative(-2));
// Animate
if (m_IsAnimating && Event.current.type == EventType.Repaint)
{
long now = DateTime.Now.Ticks;
float deltaTime = (now - m_LastTime) / (float)TimeSpan.TicksPerSecond;
m_LastTime = now;
m_Anim = Mathf.MoveTowards(m_Anim, m_AnimTarget, deltaTime * 4);
if (m_AnimTarget == 0 && Mathf.Approximately(m_Anim, 0))
{
m_Anim = 1;
m_AnimTarget = 1;
m_Stack.RemoveAt(m_Stack.Count - 1);
}
Repaint();
}
}
void HandleKeyboard()
{
var evt = Event.current;
if (evt.type == EventType.KeyDown)
{
// Special handling when in new script panel
if (!m_ActiveParent.HandleKeyboard(evt, s_FilterWindow, GoToParent))
{
// Always do these
if (evt.keyCode == KeyCode.DownArrow)
{
m_ActiveParent.selectedIndex++;
m_ActiveParent.selectedIndex = Mathf.Min(m_ActiveParent.selectedIndex, GetChildren(m_ActiveTree, m_ActiveParent).Count - 1);
m_ScrollToSelected = true;
evt.Use();
}
if (evt.keyCode == KeyCode.UpArrow)
{
m_ActiveParent.selectedIndex--;
m_ActiveParent.selectedIndex = Mathf.Max(m_ActiveParent.selectedIndex, 0);
m_ScrollToSelected = true;
evt.Use();
}
if (evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter)
{
GoToChild(m_ActiveElement, true);
evt.Use();
}
// Do these if we're not in search mode
if (!m_HasSearch)
{
if (evt.keyCode == KeyCode.LeftArrow || evt.keyCode == KeyCode.Backspace)
{
GoToParent();
evt.Use();
}
if (evt.keyCode == KeyCode.RightArrow)
{
GoToChild(m_ActiveElement, false);
evt.Use();
}
if (evt.keyCode == KeyCode.Escape)
{
Close();
evt.Use();
}
}
}
}
}
const string k_SearchHeader = "Search";
void RebuildSearch()
{
if (!m_HasSearch)
{
m_SearchResultTree = null;
if (m_Stack[m_Stack.Count - 1].name == k_SearchHeader)
{
m_Stack.Clear();
m_Stack.Add(m_Tree[0] as GroupElement);
}
m_AnimTarget = 1;
m_LastTime = DateTime.Now.Ticks;
return;
}
// Support multiple search words separated by spaces.
var searchWords = m_Search.ToLower().Split(' ');
// We keep two lists. Matches that matches the start of an item always get first priority.
var matchesStart = new List<Element>();
var matchesWithin = new List<Element>();
foreach (var e in m_Tree)
{
if (e is GroupElement)
continue;
string name = e.name.ToLower().Replace(" ", "");
bool didMatchAll = true;
bool didMatchStart = false;
// See if we match ALL the seaarch words.
for (int w = 0; w < searchWords.Length; w++)
{
string search = searchWords[w];
if (name.Contains(search))
{
// If the start of the item matches the first search word, make a note of that.
if (w == 0 && name.StartsWith(search))
didMatchStart = true;
}
else
{
// As soon as any word is not matched, we disregard this item.
didMatchAll = false;
break;
}
}
// We always need to match all search words.
// If we ALSO matched the start, this item gets priority.
if (didMatchAll)
{
if (didMatchStart)
matchesStart.Add(e);
else
matchesWithin.Add(e);
}
}
matchesStart.Sort();
matchesWithin.Sort();
// Create search tree
var tree = new List<Element>();
// Add parent
tree.Add(new GroupElement(0, k_SearchHeader));
// Add search results
tree.AddRange(matchesStart);
tree.AddRange(matchesWithin);
// Create search result tree
m_SearchResultTree = tree.ToArray();
m_Stack.Clear();
m_Stack.Add(m_SearchResultTree[0] as GroupElement);
// Always select the first search result when search is changed (e.g. a character was typed in or deleted),
// because it's usually the best match.
if (GetChildren(m_ActiveTree, m_ActiveParent).Count >= 1)
m_ActiveParent.selectedIndex = 0;
else
m_ActiveParent.selectedIndex = -1;
}
GroupElement GetElementRelative(int rel)
{
int i = m_Stack.Count + rel - 1;
if (i < 0)
return null;
return m_Stack[i];
}
void GoToParent()
{
if (m_Stack.Count > 1)
{
m_AnimTarget = 0;
m_LastTime = DateTime.Now.Ticks;
}
}
void ListGUI(Element[] tree, float anim, GroupElement parent, GroupElement grandParent)
{
// Smooth the fractional part of the anim value
anim = Mathf.Floor(anim) + Mathf.SmoothStep(0, 1, Mathf.Repeat(anim, 1));
// Calculate rect for animated area
var animRect = position;
animRect.x = position.width * (1 - anim) + 1;
animRect.y = k_HeaderHeight;
animRect.height -= k_HeaderHeight + k_HelpHeight;
animRect.width -= 2;
// Start of animated area (the part that moves left and right)
GUILayout.BeginArea(animRect);
// Header
var headerRect = GUILayoutUtility.GetRect(10, 25);
string name = parent.name;
GUI.Label(headerRect, name, s_Styles.header);
// Back button
if (grandParent != null)
{
var arrowRect = new Rect(headerRect.x + 4, headerRect.y + 7, 13, 13);
var e = Event.current;
if (e.type == EventType.Repaint)
s_Styles.leftArrow.Draw(arrowRect, false, false, false, false);
if (e.type == EventType.MouseDown && headerRect.Contains(e.mousePosition))
{
GoToParent();
e.Use();
}
}
if (!parent.OnGUI(s_FilterWindow))
ListGUI(tree, parent);
GUILayout.EndArea();
}
void GoToChild(Element e, bool addIfComponent)
{
if (m_Provider.GoToChild(e, addIfComponent))
{
Close();
}
else if (!m_HasSearch)
{
m_LastTime = DateTime.Now.Ticks;
if (m_AnimTarget == 0)
{
m_AnimTarget = 1;
}
else if (Mathf.Approximately(m_Anim, 1f))
{
m_Anim = 0;
m_Stack.Add(e as GroupElement);
}
}
}
void ListGUI(Element[] tree, GroupElement parent)
{
// Start of scroll view list
parent.scroll = GUILayout.BeginScrollView(parent.scroll);
EditorGUIUtility.SetIconSize(new Vector2(16, 16));
var children = GetChildren(tree, parent);
var selectedRect = new Rect();
var evt = Event.current;
// Iterate through the children
for (int i = 0; i < children.Count; i++)
{
var e = children[i];
var r = GUILayoutUtility.GetRect(16, 20, GUILayout.ExpandWidth(true));
// Select the element the mouse cursor is over.
// Only do it on mouse move - keyboard controls are allowed to overwrite this until the next time the mouse moves.
if (evt.type == EventType.MouseMove || evt.type == EventType.MouseDown)
{
if (parent.selectedIndex != i && r.Contains(evt.mousePosition))
{
parent.selectedIndex = i;
Repaint();
}
}
bool selected = false;
// Handle selected item
if (i == parent.selectedIndex)
{
selected = true;
selectedRect = r;
}
// Draw element
if (evt.type == EventType.Repaint)
{
var labelStyle = (e is GroupElement) ? s_Styles.groupButton : s_Styles.componentButton;
labelStyle.Draw(r, e.content, false, false, selected, selected);
if (e is GroupElement)
{
var arrowRect = new Rect(r.x + r.width - 13, r.y + 4, 13, 13);
s_Styles.rightArrow.Draw(arrowRect, false, false, false, false);
}
}
if (evt.type == EventType.MouseDown && r.Contains(evt.mousePosition))
{
evt.Use();
parent.selectedIndex = i;
GoToChild(e, true);
}
}
EditorGUIUtility.SetIconSize(Vector2.zero);
GUILayout.EndScrollView();
// Scroll to show selected
if (m_ScrollToSelected && evt.type == EventType.Repaint)
{
m_ScrollToSelected = false;
var scrollRect = GUILayoutUtility.GetLastRect();
if (selectedRect.yMax - scrollRect.height > parent.scroll.y)
{
parent.scroll.y = selectedRect.yMax - scrollRect.height;
Repaint();
}
if (selectedRect.y < parent.scroll.y)
{
parent.scroll.y = selectedRect.y;
Repaint();
}
}
}
List<Element> GetChildren(Element[] tree, Element parent)
{
var children = new List<Element>();
int level = -1;
int i;
for (i = 0; i < tree.Length; i++)
{
if (tree[i] == parent)
{
level = parent.level + 1;
i++;
break;
}
}
if (level == -1)
return children;
for (; i < tree.Length; i++)
{
var e = tree[i];
if (e.level < level)
break;
if (e.level > level && !m_HasSearch)
continue;
children.Add(e);
}
return children;
}
}
}

11
ScriptableRenderPipeline/Core/Editor/FilterWindow.cs.meta


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

137
ScriptableRenderPipeline/Core/Editor/Volume/VolumeComponentProvider.cs


using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
namespace UnityEditor.Experimental.Rendering
{
using IProvider = FilterWindow.IProvider;
using Element = FilterWindow.Element;
using GroupElement = FilterWindow.GroupElement;
class VolumeComponentProvider : IProvider
{
class VolumeComponentElement : Element
{
public Type type;
public VolumeComponentElement(int level, string label, Type type)
{
this.level = level;
this.type = type;
// TODO: Add support for custom icons
content = new GUIContent(label);
}
}
class PathNode : IComparable<PathNode>
{
public List<PathNode> nodes = new List<PathNode>();
public string name;
public Type type;
public int CompareTo(PathNode other)
{
return name.CompareTo(other.name);
}
}
public Vector2 position { get; set; }
Volume m_Target;
VolumeEditor m_TargetEditor;
public VolumeComponentProvider(Volume target, VolumeEditor targetEditor)
{
m_Target = target;
m_TargetEditor = targetEditor;
}
public void CreateComponentTree(List<Element> tree)
{
tree.Add(new GroupElement(0, "Volume Components"));
var attrType = typeof(VolumeComponentMenu);
var types = VolumeManager.instance.baseComponentTypes;
var rootNode = new PathNode();
foreach (var t in types)
{
// Skip components that have already been added to the volume
if (m_Target.Has(t))
continue;
string path = string.Empty;
// Look for a VolumeComponentMenu attribute
var attrs = t.GetCustomAttributes(attrType, false);
if (attrs.Length > 0)
{
var attr = attrs[0] as VolumeComponentMenu;
if (attr != null)
path = attr.menu;
}
// If no attribute or in case something went wrong when grabbing it, fallback to a
// beautified class name
if (string.IsNullOrEmpty(path))
path = ObjectNames.NicifyVariableName(t.Name);
// Prep the categories & types tree
AddNode(rootNode, path, t);
}
// Recursively add all elements to the tree
Traverse(rootNode, 1, tree);
}
public bool GoToChild(Element element, bool addIfComponent)
{
if (element is VolumeComponentElement)
{
var e = (VolumeComponentElement)element;
m_TargetEditor.AddComponent(e.type);
return true;
}
return false;
}
void AddNode(PathNode root, string path, Type type)
{
var current = root;
var parts = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var part in parts)
{
var child = current.nodes.Find(x => x.name == part);
if (child == null)
{
child = new PathNode { name = part, type = type };
current.nodes.Add(child);
}
current = child;
}
}
void Traverse(PathNode node, int depth, List<Element> tree)
{
node.nodes.Sort();
foreach (var n in node.nodes)
{
if (n.nodes.Count > 0) // Group
{
tree.Add(new GroupElement(depth, n.name));
Traverse(n, depth + 1, tree);
}
else // Element
{
tree.Add(new VolumeComponentElement(depth, n.name, n.type));
}
}
}
}
}

11
ScriptableRenderPipeline/Core/Editor/Volume/VolumeComponentProvider.cs.meta


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

44
ScriptableRenderPipeline/Core/Volume/VolumeStack.cs


using System;
using System.Collections.Generic;
namespace UnityEngine.Experimental.Rendering
{
public sealed class VolumeStack : IDisposable
{
// Holds the state of _all_ component types you can possibly add on volumes
public readonly Dictionary<Type, VolumeComponent> components;
internal VolumeStack(IEnumerable<Type> baseTypes)
{
components = new Dictionary<Type, VolumeComponent>();
foreach (var type in baseTypes)
{
var inst = (VolumeComponent)ScriptableObject.CreateInstance(type);
components.Add(type, inst);
}
}
public T GetComponent<T>()
where T : VolumeComponent
{
var comp = GetComponent(typeof(T));
return (T)comp;
}
public VolumeComponent GetComponent(Type type)
{
VolumeComponent comp;
components.TryGetValue(type, out comp);
return comp;
}
public void Dispose()
{
foreach (var component in components)
CoreUtils.Destroy(component.Value);
components.Clear();
}
}
}

11
ScriptableRenderPipeline/Core/Volume/VolumeStack.cs.meta


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

198
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/Materials/Transparent.mat


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Transparent
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords: _ALBEDOAFFECTEMISSIVE_OFF _ALPHACUTOFFENABLE_OFF _BLENDMODE_ALPHA
_BLENDMODE_PRESERVE_SPECULAR_LIGHTING _DEPTHOFFSETENABLE_OFF _DISTORTIONENABLE_OFF
_DOUBLESIDEDENABLE_OFF _ENABLESPECULAROCCLUSION_OFF _ENABLEWIND_OFF _ENABLE_FOG_ON_TRANSPARENT
_NORMALMAP_TANGENT_SPACE _PREREFRACTIONPASS_OFF _SURFACE_TYPE_TRANSPARENT _TRANSPARENTBACKFACEENABLE_OFF
_TRANSPARENTDEPTHPOSTPASSENABLE_OFF
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- DistortionVectors
- TransparentDepthPostpass
- TransparentBackface
- TransparentBackfaceDebugDisplay
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AnisotropyMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissiveColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _HeightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecularColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceRadiusMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TransmittanceColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AORemapMax: 1
- _AORemapMin: 0
- _ATDistance: 1
- _AlbedoAffectEmissive: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _AlphaCutoffPostpass: 0.5
- _Anisotropy: 0
- _BlendMode: 0
- _CoatCoverage: 1
- _CoatIOR: 0.5
- _CullMode: 2
- _CullModeForward: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAlbedoScale: 1
- _DetailNormalScale: 1
- _DetailSmoothnessScale: 1
- _DisplacementLockObjectScale: 1
- _DisplacementLockTilingScale: 1
- _DisplacementMode: 0
- _DistortionBlendMode: 0
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 1
- _DistortionBlurRemapMax: 1
- _DistortionBlurRemapMin: 0
- _DistortionBlurScale: 1
- _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 1
- _DistortionDstBlend: 1
- _DistortionEnable: 0
- _DistortionScale: 1
- _DistortionSrcBlend: 1
- _DistortionVectorBias: -1
- _DistortionVectorScale: 2
- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _Drag: 1
- _DstBlend: 10
- _EmissiveColorMode: 1
- _EmissiveIntensity: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _EnableSpecularOcclusion: 0
- _EnableWind: 0
- _HeightAmplitude: 0.02
- _HeightCenter: 0.5
- _HeightMax: 1
- _HeightMin: -1
- _IOR: 1
- _InitialBend: 1
- _InvTilingScale: 1
- _LinkDetailsWithBase: 1
- _MaterialID: 1
- _Metallic: 0
- _NormalMapSpace: 0
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PPDPrimitiveLength: 1
- _PPDPrimitiveWidth: 1
- _PreRefractionPass: 0
- _RefractionMode: 0
- _ShiverDirectionality: 0.5
- _ShiverDrag: 0.2
- _Smoothness: 0.5
- _SmoothnessRemapMax: 1
- _SmoothnessRemapMin: 0
- _SrcBlend: 1
- _StencilRef: 2
- _Stiffness: 1
- _SubsurfaceProfile: 0
- _SubsurfaceRadius: 1
- _SurfaceType: 1
- _TexWorldScale: 1
- _Thickness: 1
- _ThicknessMultiplier: 1
- _TransparentBackfaceEnable: 0
- _TransparentDepthPostpassEnable: 0
- _UVBase: 0
- _UVDetail: 0
- _ZTestMode: 4
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0.51, g: 0.74935526, b: 1, a: 0.5019608}
- _Color: {r: 0.50999993, g: 0.74935526, b: 1, a: 0.5019608}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 1, g: 1, b: 1, a: 1}
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}

8
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/Materials/Transparent.mat.meta


fileFormatVersion: 2
guid: 2505e1d9c7a8c654487d6a2dcae04242
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

8
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/2xxx_Lighting/2201_Env_SurfaceReactions.meta


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