浏览代码
Merge pull request #980 from Unity-Technologies/Branch_ShadowsInVolume
Merge pull request #980 from Unity-Technologies/Branch_ShadowsInVolume
Moved Cascade and Contact shadows settings to the volume system./main
GitHub
7 年前
当前提交
841f635b
共有 14 个文件被更改,包括 238 次插入 和 89 次删除
-
2ScriptableRenderPipeline/Core/CoreRP/Editor/Volume/VolumeProfileFactory.cs
-
10ScriptableRenderPipeline/Core/CoreRP/Shadow/AdditionalShadowData.cs
-
9ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.Styles.cs
-
58ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/SkySettingsEditor.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDUtils.cs
-
26ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
-
46ScriptableRenderPipeline/HDRenderPipeline/HDRP/Shadows/HDShadowSettings.cs
-
57ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/ContactShadowsEditor.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/ContactShadowsEditor.cs.meta
-
66ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/HDShadowSettingsEditor.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/HDShadowSettingsEditor.cs.meta
-
16ScriptableRenderPipeline/HDRenderPipeline/HDRP/Shadows/ContactShadows.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Shadows/ContactShadows.cs.meta
|
|||
using System.Collections; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[CanEditMultipleObjects] |
|||
[VolumeComponentEditor(typeof(ContactShadows))] |
|||
public class ContactShadowsEditor : VolumeComponentEditor |
|||
{ |
|||
public readonly GUIContent contactShadow = new GUIContent("Contact Shadows"); |
|||
public readonly GUIContent contactShadowLength = new GUIContent("Length", "Length of rays used to gather contact shadows in world units.\nZero will disable the feature."); |
|||
public readonly GUIContent contactShadowDistanceScaleFactor = new GUIContent("Distance Scale Factor", "Contact Shadows are scaled up with distance. Use this parameter to dampen this effect."); |
|||
public readonly GUIContent contactShadowMaxDistance = new GUIContent("Max Distance", "Distance from the camera in world units at which contact shadows are faded out to zero."); |
|||
public readonly GUIContent contactShadowFadeDistance = new GUIContent("Fade Distance", "Distance in world units over which the contact shadows are faded out (see Max Distance)."); |
|||
public readonly GUIContent contactShadowSampleCount = new GUIContent("Sample Count", "Number of samples when ray casting."); |
|||
|
|||
|
|||
SerializedDataParameter m_Enable; |
|||
SerializedDataParameter m_Length; |
|||
SerializedDataParameter m_DistanceScaleFactor; |
|||
SerializedDataParameter m_MaxDistance; |
|||
SerializedDataParameter m_FadeDistance; |
|||
SerializedDataParameter m_SampleCount; |
|||
|
|||
|
|||
public override void OnEnable() |
|||
{ |
|||
var o = new PropertyFetcher<ContactShadows>(serializedObject); |
|||
|
|||
m_Enable = Unpack(o.Find(x => x.enable)); |
|||
m_Length = Unpack(o.Find(x => x.length)); |
|||
m_DistanceScaleFactor = Unpack(o.Find(x => x.distanceScaleFactor)); |
|||
m_MaxDistance = Unpack(o.Find(x => x.maxDistance)); |
|||
m_FadeDistance = Unpack(o.Find(x => x.fadeDistance)); |
|||
m_SampleCount = Unpack(o.Find(x => x.sampleCount)); |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
PropertyField(m_Enable, CoreEditorUtils.GetContent("Enable")); |
|||
|
|||
if (!m_Enable.value.hasMultipleDifferentValues) |
|||
{ |
|||
using (new EditorGUI.DisabledGroupScope(!m_Enable.value.boolValue)) |
|||
{ |
|||
PropertyField(m_Length, CoreEditorUtils.GetContent("Length|Length of rays used to gather contact shadows in world units.")); |
|||
PropertyField(m_DistanceScaleFactor, CoreEditorUtils.GetContent("Distance Scale Factor|Contact Shadows are scaled up with distance. Use this parameter to dampen this effect.")); |
|||
PropertyField(m_MaxDistance, CoreEditorUtils.GetContent("Max Distance|Distance from the camera in world units at which contact shadows are faded out to zero.")); |
|||
PropertyField(m_FadeDistance, CoreEditorUtils.GetContent("Fade Distance|Distance in world units over which the contact shadows fade out (see Max Distance).")); |
|||
PropertyField(m_SampleCount, CoreEditorUtils.GetContent("Sample Count|Number of samples when ray casting.")); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f5a268c81ffd7634db3a9a0cb30af239 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[CanEditMultipleObjects] |
|||
[VolumeComponentEditor(typeof(HDShadowSettings))] |
|||
public class HDShadowSettingsEditor : VolumeComponentEditor |
|||
{ |
|||
SerializedDataParameter m_MaxShadowDistance; |
|||
|
|||
SerializedDataParameter m_CascadeShadowSplitCount; |
|||
|
|||
SerializedDataParameter[] m_CascadeShadowSplits = new SerializedDataParameter[3]; |
|||
SerializedDataParameter[] m_CascadeShadowBorders = new SerializedDataParameter[4]; |
|||
|
|||
// For now we don't use borders so we hide the UI.
|
|||
bool m_bShowBorders = false; |
|||
|
|||
public override void OnEnable() |
|||
{ |
|||
var o = new PropertyFetcher<HDShadowSettings>(serializedObject); |
|||
|
|||
m_MaxShadowDistance = Unpack(o.Find(x => x.maxShadowDistance)); |
|||
m_CascadeShadowSplitCount = Unpack(o.Find(x => x.cascadeShadowSplitCount)); |
|||
m_CascadeShadowSplits[0] = Unpack(o.Find(x => x.cascadeShadowSplit0)); |
|||
m_CascadeShadowSplits[1] = Unpack(o.Find(x => x.cascadeShadowSplit1)); |
|||
m_CascadeShadowSplits[2] = Unpack(o.Find(x => x.cascadeShadowSplit2)); |
|||
m_CascadeShadowBorders[0] = Unpack(o.Find(x => x.cascadeShadowBorder0)); |
|||
m_CascadeShadowBorders[1] = Unpack(o.Find(x => x.cascadeShadowBorder1)); |
|||
m_CascadeShadowBorders[2] = Unpack(o.Find(x => x.cascadeShadowBorder2)); |
|||
m_CascadeShadowBorders[3] = Unpack(o.Find(x => x.cascadeShadowBorder3)); |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
PropertyField(m_MaxShadowDistance, CoreEditorUtils.GetContent("Max Distance")); |
|||
|
|||
EditorGUILayout.Space(); |
|||
PropertyField(m_CascadeShadowSplitCount, CoreEditorUtils.GetContent("Cascade Count")); |
|||
|
|||
if (!m_CascadeShadowSplitCount.value.hasMultipleDifferentValues) |
|||
{ |
|||
EditorGUI.indentLevel++; |
|||
int splitCount = m_CascadeShadowSplitCount.value.intValue; |
|||
for (int i = 0; i < splitCount - 1; i++) |
|||
{ |
|||
PropertyField(m_CascadeShadowSplits[i], CoreEditorUtils.GetContent(string.Format("Split {0}", i + 1))); |
|||
} |
|||
|
|||
if(m_bShowBorders) |
|||
{ |
|||
EditorGUILayout.Space(); |
|||
|
|||
for (int i = 0; i < splitCount; i++) |
|||
{ |
|||
PropertyField(m_CascadeShadowBorders[i], CoreEditorUtils.GetContent(string.Format("Border {0}", i + 1))); |
|||
} |
|||
} |
|||
EditorGUI.indentLevel--; |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d8efece7d7ee34048a4b794bf3234ca3 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[Serializable] |
|||
public class ContactShadows : VolumeComponent |
|||
{ |
|||
// Contact shadows
|
|||
public BoolParameter enable = new BoolParameter(false); |
|||
public ClampedFloatParameter length = new ClampedFloatParameter(0.15f, 0.0f, 1.0f); |
|||
public ClampedFloatParameter distanceScaleFactor = new ClampedFloatParameter(0.5f, 0.0f, 1.0f); |
|||
public MinFloatParameter maxDistance = new MinFloatParameter(50.0f, 0.0f); |
|||
public MinFloatParameter fadeDistance = new MinFloatParameter(5.0f, 0.0f); |
|||
public NoInterpClampedIntParameter sampleCount = new NoInterpClampedIntParameter(8, 4, 64); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 56b145d2b9ee1ac4f846968484e7485a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue